text
stringlengths 30
1.67M
|
|---|
<s> package org . gatein . wsrp . test . support ; import org . gatein . common . util . ParameterValidation ; import org . gatein . pc . federation . FederatingPortletInvoker ; import org . gatein . wsrp . WSRPConsumer ; import org . gatein . wsrp . api . session . SessionEventBroadcaster ; import org . gatein . wsrp . consumer . ConsumerException ; import org . gatein . wsrp . consumer . EndpointConfigurationInfo ; import org . gatein . wsrp . consumer . ProducerInfo ; import org . gatein . wsrp . consumer . handlers . session . InMemorySessionRegistry ; import org . gatein . wsrp . consumer . handlers . session . SessionRegistry ; import org . gatein . wsrp . consumer . migration . InMemoryMigrationService ; import org . gatein . wsrp . consumer . migration . MigrationService ; import org . gatein . wsrp . consumer . spi . ConsumerRegistrySPI ; import java . util . ArrayList ; import java . util . Collection ; import java . util . HashMap ; import java . util . Iterator ; import java . util . List ; import java . util . Map ; public class MockConsumerRegistry implements ConsumerRegistrySPI { private Map < String , WSRPConsumer > consumers = new HashMap ( <NUM_LIT:3> ) ; public static final String MOCK_SERVICE_DESCRIPTION = "<STR_LIT>" ; public static final String MOCK_MARKUP = "<STR_LIT>" ; public static final String CONSUMER1 = "<STR_LIT>" ; public static final String CONSUMER2 = "<STR_LIT>" ; private InMemorySessionRegistry sessionRegistry = new InMemorySessionRegistry ( ) ; private InMemoryMigrationService migrationService = new InMemoryMigrationService ( ) ; public MockConsumerRegistry ( ) { reloadConsumers ( ) ; } public List < WSRPConsumer > getConfiguredConsumers ( ) { return new ArrayList < WSRPConsumer > ( consumers . values ( ) ) ; } public WSRPConsumer getConsumer ( String id ) { return consumers . get ( id ) ; } public FederatingPortletInvoker getFederatingPortletInvoker ( ) { return null ; } public WSRPConsumer createConsumer ( String id , Integer expirationCacheSeconds , String wsdlURL ) { MockWSRPConsumer consumer = new MockWSRPConsumer ( id ) ; ProducerInfo producerInfo = consumer . getProducerInfo ( ) ; producerInfo . setExpirationCacheSeconds ( expirationCacheSeconds ) ; producerInfo . getEndpointConfigurationInfo ( ) . setWsdlDefinitionURL ( wsdlURL ) ; consumers . put ( id , consumer ) ; return consumer ; } public void persistConsumer ( WSRPConsumer consumer ) { ParameterValidation . throwIllegalArgExceptionIfNull ( consumer , "<STR_LIT>" ) ; consumers . put ( consumer . getProducerId ( ) , consumer ) ; } public void activateConsumerWith ( String id ) throws ConsumerException { } public String updateProducerInfo ( ProducerInfo producerInfo ) { return null ; } public void deactivateConsumerWith ( String id ) throws ConsumerException { } public void registerOrDeregisterConsumerWith ( String id , boolean register ) { } public void destroyConsumer ( String id ) { } public void reloadConsumers ( ) { consumers . clear ( ) ; consumers . put ( CONSUMER1 , new MockWSRPConsumer ( CONSUMER1 ) ) ; MockWSRPConsumer consumer = new MockWSRPConsumer ( CONSUMER2 ) ; consumer . getProducerInfo ( ) . setActive ( true ) ; EndpointConfigurationInfo info = consumer . getProducerInfo ( ) . getEndpointConfigurationInfo ( ) ; consumers . put ( CONSUMER2 , consumer ) ; } public void start ( ) throws Exception { reloadConsumers ( ) ; } public void stop ( ) throws Exception { } public void save ( ProducerInfo info , String messageOnError ) throws ConsumerException { throw new UnsupportedOperationException ( ) ; } public void delete ( ProducerInfo info ) throws ConsumerException { throw new UnsupportedOperationException ( ) ; } public String update ( ProducerInfo producerInfo ) { throw new UnsupportedOperationException ( ) ; } public Iterator < ProducerInfo > getProducerInfosFromStorage ( ) { throw new UnsupportedOperationException ( ) ; } public ProducerInfo loadProducerInfo ( String id ) { throw new UnsupportedOperationException ( ) ; } public void setFederatingPortletInvoker ( FederatingPortletInvoker federatingPortletInvoker ) { } public void setSessionEventBroadcaster ( SessionEventBroadcaster sessionEventBroadcaster ) { } public ProducerInfo getProducerInfoByKey ( String key ) { throw new UnsupportedOperationException ( ) ; } public MigrationService getMigrationService ( ) { return migrationService ; } public void setMigrationService ( MigrationService migrationService ) { throw new UnsupportedOperationException ( ) ; } public SessionRegistry getSessionRegistry ( ) { return sessionRegistry ; } public void setSessionRegistry ( SessionRegistry sessionRegistry ) { throw new UnsupportedOperationException ( ) ; } public boolean containsConsumer ( String id ) { return consumers . containsKey ( id ) ; } public Collection < String > getConfiguredConsumersIds ( ) { return consumers . keySet ( ) ; } public int getConfiguredConsumerNumber ( ) { return consumers . size ( ) ; } public WSRPConsumer createConsumerFrom ( ProducerInfo producerInfo , boolean putInCache ) { throw new UnsupportedOperationException ( ) ; } public void registerWithFederatingPortletInvoker ( WSRPConsumer consumer ) { consumers . put ( consumer . getProducerId ( ) , consumer ) ; } public void deregisterWithFederatingPortletInvoker ( WSRPConsumer consumer ) { consumers . remove ( consumer . getProducerId ( ) ) ; } public long getPersistedLastModifiedForProducerInfoWith ( String id ) { return System . currentTimeMillis ( ) ; } } </s>
|
<s> package org . gatein . wsrp . test . support ; import org . gatein . common . NotYetImplemented ; import org . gatein . pc . api . Portlet ; import org . gatein . pc . api . PortletContext ; import org . gatein . pc . api . PortletInvokerException ; import org . gatein . pc . api . PortletStateType ; import org . gatein . pc . api . PortletStatus ; import org . gatein . pc . api . invocation . PortletInvocation ; import org . gatein . pc . api . invocation . response . PortletInvocationResponse ; import org . gatein . pc . api . state . DestroyCloneFailure ; import org . gatein . pc . api . state . PropertyChange ; import org . gatein . pc . api . state . PropertyMap ; import org . gatein . wsrp . api . session . SessionEvent ; import org . gatein . wsrp . consumer . ProducerInfo ; import org . gatein . wsrp . consumer . RefreshResult ; import org . gatein . wsrp . consumer . handlers . ProducerSessionInformation ; import org . gatein . wsrp . consumer . handlers . SessionHandler ; import org . gatein . wsrp . consumer . handlers . session . SessionRegistry ; import org . gatein . wsrp . consumer . migration . ExportInfo ; import org . gatein . wsrp . consumer . migration . ImportInfo ; import org . gatein . wsrp . consumer . migration . MigrationService ; import org . gatein . wsrp . consumer . portlet . info . WSRPPortletInfo ; import org . gatein . wsrp . consumer . spi . WSRPConsumerSPI ; import org . gatein . wsrp . services . MarkupService ; import org . oasis . wsrp . v2 . RegistrationContext ; import org . oasis . wsrp . v2 . RuntimeContext ; import org . oasis . wsrp . v2 . UserContext ; import javax . servlet . http . HttpSession ; import java . util . List ; import java . util . Set ; public class MockWSRPConsumer implements WSRPConsumerSPI { private ProducerInfo producerInfo ; private boolean useWSRP2 = true ; public MockWSRPConsumer ( String id ) { producerInfo = new ProducerInfo ( null ) ; producerInfo . setId ( id ) ; producerInfo . setEndpointConfigurationInfo ( new MockEndpointConfigurationInfo ( ) ) ; } public String getProducerId ( ) { return producerInfo . getId ( ) ; } public ProducerSessionInformation getProducerSessionInformationFrom ( PortletInvocation invocation ) { return null ; } public ProducerSessionInformation getProducerSessionInformationFrom ( HttpSession session ) { return null ; } public ProducerInfo getProducerInfo ( ) { return producerInfo ; } public MarkupService getMarkupService ( ) throws PortletInvokerException { throw new NotYetImplemented ( ) ; } public boolean supportsUserScope ( String userScope ) { throw new NotYetImplemented ( ) ; } public WSRPPortletInfo getPortletInfo ( PortletInvocation invocation ) throws PortletInvokerException { throw new NotYetImplemented ( ) ; } public SessionRegistry getSessionRegistry ( ) { throw new NotYetImplemented ( ) ; } public void setSessionRegistry ( SessionRegistry sessionInfos ) { throw new NotYetImplemented ( ) ; } public RegistrationContext getRegistrationContext ( ) throws PortletInvokerException { throw new NotYetImplemented ( ) ; } public UserContext getUserContextFrom ( WSRPPortletInfo info , PortletInvocation invocation , RuntimeContext runtimeContext ) throws PortletInvokerException { throw new NotYetImplemented ( ) ; } public SessionHandler getSessionHandler ( ) { throw new NotYetImplemented ( ) ; } public void setTemplatesIfNeeded ( WSRPPortletInfo info , PortletInvocation invocation , RuntimeContext runtimeContext ) throws PortletInvokerException { throw new NotYetImplemented ( ) ; } public void refreshProducerInfo ( ) throws PortletInvokerException { throw new NotYetImplemented ( ) ; } public void handleInvalidRegistrationFault ( ) throws PortletInvokerException { throw new NotYetImplemented ( ) ; } public void releaseSessions ( ) { } public void activate ( ) throws Exception { } public void deactivate ( ) throws Exception { } public boolean isActive ( ) { return true ; } public boolean isRefreshNeeded ( ) { return false ; } public RefreshResult refresh ( boolean forceRefresh ) { return null ; } public Set < Portlet > getPortlets ( ) throws PortletInvokerException { return null ; } public Portlet getPortlet ( PortletContext portletContext ) throws IllegalArgumentException , PortletInvokerException { return null ; } public PortletStatus getStatus ( PortletContext portletContext ) throws IllegalArgumentException , PortletInvokerException { return null ; } public PortletInvocationResponse invoke ( PortletInvocation invocation ) throws IllegalArgumentException , PortletInvokerException { return null ; } public PortletContext createClone ( PortletStateType stateType , PortletContext portletContext ) throws IllegalArgumentException , PortletInvokerException , UnsupportedOperationException { return null ; } public List < DestroyCloneFailure > destroyClones ( List < PortletContext > portletContexts ) throws IllegalArgumentException , PortletInvokerException , UnsupportedOperationException { return null ; } public PropertyMap getProperties ( PortletContext portletContext , Set keys ) throws IllegalArgumentException , PortletInvokerException , UnsupportedOperationException { return null ; } public PropertyMap getProperties ( PortletContext portletContext ) throws IllegalArgumentException , PortletInvokerException , UnsupportedOperationException { return null ; } public PortletContext setProperties ( PortletContext portletContext , PropertyChange [ ] changes ) throws IllegalArgumentException , PortletInvokerException , UnsupportedOperationException { return null ; } public void create ( ) throws Exception { } public void start ( ) throws Exception { } public void stop ( ) { } public ExportInfo exportPortlets ( List < String > portletHandles ) throws PortletInvokerException { throw new NotYetImplemented ( ) ; } public void releaseExport ( ExportInfo exportInfo ) { throw new NotYetImplemented ( ) ; } public MigrationService getMigrationService ( ) { throw new NotYetImplemented ( ) ; } public boolean isImportExportSupported ( ) { return false ; } public ImportInfo importPortlets ( ExportInfo exportInfo , List < String > portlets ) throws PortletInvokerException { throw new NotYetImplemented ( ) ; } public boolean isUsingWSRP2 ( ) { return useWSRP2 ; } public void setUsingWSRP2 ( boolean useWSRP2 ) { this . useWSRP2 = useWSRP2 ; } public void destroy ( ) { } public void onSessionEvent ( SessionEvent event ) { } public PortletContext exportPortlet ( PortletStateType stateType , PortletContext originalPortletContext ) throws PortletInvokerException { throw new NotYetImplemented ( ) ; } public PortletContext importPortlet ( PortletStateType stateType , PortletContext originalPortletContext ) throws PortletInvokerException { throw new NotYetImplemented ( ) ; } } </s>
|
<s> package org . gatein . wsrp . test . support ; import org . gatein . wsrp . consumer . EndpointConfigurationInfo ; import org . gatein . wsrp . test . protocol . v2 . BehaviorBackedServiceFactory ; public class MockEndpointConfigurationInfo extends EndpointConfigurationInfo { public MockEndpointConfigurationInfo ( ) { super ( new BehaviorBackedServiceFactory ( ) ) ; } } </s>
|
<s> package org . gatein . wsrp . test . support ; import org . gatein . pc . api . invocation . ResourceInvocation ; import org . gatein . pc . api . spi . PortletInvocationContext ; import org . gatein . pc . portlet . impl . spi . AbstractPortalContext ; import org . gatein . pc . portlet . impl . spi . AbstractSecurityContext ; public class TestResourceInvocation extends ResourceInvocation { public TestResourceInvocation ( PortletInvocationContext ctx ) throws IllegalArgumentException { super ( ctx ) ; setPortalContext ( new AbstractPortalContext ( ) ) ; setSecurityContext ( new AbstractSecurityContext ( MockHttpServletRequest . createMockRequest ( null ) ) ) ; setWindowContext ( new TestWindowContext ( ) ) ; } } </s>
|
<s> package org . gatein . wsrp . test . support ; import org . gatein . pc . api . invocation . ActionInvocation ; import org . gatein . pc . api . spi . PortletInvocationContext ; import org . gatein . pc . portlet . impl . spi . AbstractPortalContext ; import org . gatein . pc . portlet . impl . spi . AbstractSecurityContext ; public class TestActionInvocation extends ActionInvocation { public TestActionInvocation ( PortletInvocationContext ctx ) throws IllegalArgumentException { super ( ctx ) ; setPortalContext ( new AbstractPortalContext ( ) ) ; setSecurityContext ( new AbstractSecurityContext ( MockHttpServletRequest . createMockRequest ( null ) ) ) ; setWindowContext ( new TestWindowContext ( ) ) ; } } </s>
|
<s> package org . gatein . wsrp . test . support ; import org . gatein . pc . api . spi . WindowContext ; public class TestWindowContext implements WindowContext { public static final String NAMESPACE = "<STR_LIT>" ; private static final String ID = "<STR_LIT:id>" ; public String getId ( ) { return ID ; } public String getNamespace ( ) { return NAMESPACE ; } } </s>
|
<s> package org . gatein . wsrp . test . support ; import org . gatein . common . net . media . MediaType ; import org . gatein . common . util . MarkupInfo ; import org . gatein . pc . api . ActionURL ; import org . gatein . pc . api . ContainerURL ; import org . gatein . pc . api . RenderURL ; import org . gatein . pc . api . ResourceURL ; import org . gatein . pc . api . StateString ; import org . gatein . pc . api . URLFormat ; import org . gatein . pc . api . spi . PortletInvocationContext ; import org . gatein . pc . portlet . impl . spi . AbstractPortletInvocationContext ; import javax . servlet . http . HttpServletRequest ; import javax . servlet . http . HttpServletResponse ; public class TestPortletInvocationContext extends AbstractPortletInvocationContext implements PortletInvocationContext { private HttpServletRequest mockRequest ; private HttpServletResponse mockResponse ; public TestPortletInvocationContext ( ) { super ( MediaType . TEXT_HTML ) ; mockRequest = MockHttpServletRequest . createMockRequest ( null ) ; mockResponse = MockHttpServletResponse . createMockResponse ( ) ; } public void setMockRequest ( HttpServletRequest mockRequest ) { this . mockRequest = mockRequest ; } public void setMockResponse ( HttpServletResponse mockResponse ) { this . mockResponse = mockResponse ; } public HttpServletRequest getClientRequest ( ) { if ( mockRequest == null ) { throw new IllegalStateException ( ) ; } return mockRequest ; } public HttpServletResponse getClientResponse ( ) { if ( mockResponse == null ) { throw new IllegalStateException ( ) ; } return mockResponse ; } public String encodeResourceURL ( String url ) { return null ; } public String renderURL ( ContainerURL containerURL , URLFormat urlFormat ) { String result ; if ( containerURL instanceof ActionURL ) { ActionURL actionURL = ( ActionURL ) containerURL ; result = "<STR_LIT>" + actionURL . getInteractionState ( ) . getStringValue ( ) ; } else if ( containerURL instanceof RenderURL ) { result = "<STR_LIT>" ; } else { String url = "<STR_LIT>" ; ResourceURL resourceURL = ( ( ResourceURL ) containerURL ) ; if ( urlFormat . getWantEscapeXML ( ) ) { url += "<STR_LIT>" ; } else { url += "<STR_LIT:&>" ; } url += "<STR_LIT>" + resourceURL . getResourceId ( ) ; return url ; } StateString ns = containerURL . getNavigationalState ( ) ; result += "<STR_LIT>" + ( ns != null ? ns . getStringValue ( ) : null ) + "<STR_LIT>" + containerURL . getWindowState ( ) + "<STR_LIT>" + containerURL . getMode ( ) ; return result ; } } </s>
|
<s> package org . gatein . wsrp . test . support ; public class RequestedMarkupBehavior { private static ThreadLocal < String > requestedMarkupBehavior = new ThreadLocal < String > ( ) ; public static String getRequestedMarkupBehavior ( ) { return requestedMarkupBehavior . get ( ) ; } public static void setRequestedMarkupBehavior ( String requestedMarkupBehavior ) { RequestedMarkupBehavior . requestedMarkupBehavior . set ( requestedMarkupBehavior ) ; } } </s>
|
<s> package org . gatein . wsrp . test . support ; import org . gatein . pc . api . invocation . RenderInvocation ; import org . gatein . pc . api . spi . PortletInvocationContext ; import org . gatein . pc . portlet . impl . spi . AbstractPortalContext ; import org . gatein . pc . portlet . impl . spi . AbstractSecurityContext ; public class TestRenderInvocation extends RenderInvocation { public TestRenderInvocation ( PortletInvocationContext ctx ) throws IllegalArgumentException { super ( ctx ) ; setPortalContext ( new AbstractPortalContext ( ) ) ; setSecurityContext ( new AbstractSecurityContext ( MockHttpServletRequest . createMockRequest ( null ) ) ) ; setWindowContext ( new TestWindowContext ( ) ) ; } } </s>
|
<s> package org . gatein . wsrp . test . protocol . v2 ; import org . oasis . wsrp . v2 . CookieProtocol ; public interface TestWSRPProducer { void reset ( ) ; BehaviorRegistry getBehaviorRegistry ( ) ; void setCurrentMarkupBehaviorHandle ( String handle ) ; void setRequiresInitCookie ( CookieProtocol requiresInitCookie ) ; void usingStrictModeChangedTo ( boolean strictMode ) ; } </s>
|
<s> package org . gatein . wsrp . test . protocol . v2 ; import org . gatein . wsrp . spec . v2 . WSRP2ExceptionFactory ; import org . oasis . wsrp . v2 . InvalidHandle ; import java . util . HashMap ; import java . util . Map ; public class BehaviorRegistry { private final Map < String , MarkupBehavior > behaviors = new HashMap < String , MarkupBehavior > ( ) ; private PortletManagementBehavior portletManagementBehavior ; private ServiceDescriptionBehavior serviceDescriptionBehavior ; private RegistrationBehavior registrationBehavior ; public ServiceDescriptionBehavior getServiceDescriptionBehavior ( ) { if ( serviceDescriptionBehavior == null ) { return ServiceDescriptionBehavior . DEFAULT ; } return serviceDescriptionBehavior ; } public void clear ( ) { behaviors . clear ( ) ; } public MarkupBehavior getMarkupBehaviorFor ( String handle ) throws InvalidHandle { if ( behaviors . containsKey ( handle ) ) { return behaviors . get ( handle ) ; } throw WSRP2ExceptionFactory . throwWSException ( InvalidHandle . class , "<STR_LIT>" + handle + "<STR_LIT:'>" , null ) ; } public void registerMarkupBehavior ( MarkupBehavior behavior ) { for ( String handle : behavior . getSupportedHandles ( ) ) { MarkupBehavior existing = behaviors . get ( handle ) ; if ( existing != null ) { throw new IllegalArgumentException ( "<STR_LIT>" + behavior . getClass ( ) . getName ( ) + "<STR_LIT>" + handle + "<STR_LIT>" + existing . getClass ( ) . getName ( ) ) ; } behaviors . put ( handle , behavior ) ; } } public PortletManagementBehavior getPortletManagementBehavior ( ) { return portletManagementBehavior ; } public void setPortletManagementBehavior ( PortletManagementBehavior portletManagementBehavior ) { this . portletManagementBehavior = portletManagementBehavior ; } public void setServiceDescriptionBehavior ( ServiceDescriptionBehavior serviceDescriptionBehavior ) { this . serviceDescriptionBehavior = serviceDescriptionBehavior ; } public RegistrationBehavior getRegistrationBehavior ( ) { return registrationBehavior ; } public void setRegistrationBehavior ( RegistrationBehavior registrationBehavior ) { this . registrationBehavior = registrationBehavior ; } } </s>
|
<s> package org . gatein . wsrp . test . protocol . v2 ; import org . gatein . common . NotYetImplemented ; import org . gatein . wsrp . spec . v2 . WSRP2ExceptionFactory ; import org . oasis . wsrp . v2 . AccessDenied ; import org . oasis . wsrp . v2 . CookieProtocol ; import org . oasis . wsrp . v2 . CopiedPortlet ; import org . oasis . wsrp . v2 . EventDescription ; import org . oasis . wsrp . v2 . EventParams ; import org . oasis . wsrp . v2 . ExportByValueNotSupported ; import org . oasis . wsrp . v2 . ExportDescription ; import org . oasis . wsrp . v2 . ExportNoLongerValid ; import org . oasis . wsrp . v2 . ExportedPortlet ; import org . oasis . wsrp . v2 . Extension ; import org . oasis . wsrp . v2 . ExtensionDescription ; import org . oasis . wsrp . v2 . FailedPortlets ; import org . oasis . wsrp . v2 . GetRegistrationLifetime ; import org . oasis . wsrp . v2 . HandleEventsFailed ; import org . oasis . wsrp . v2 . ImportPortlet ; import org . oasis . wsrp . v2 . ImportPortletsFailed ; import org . oasis . wsrp . v2 . ImportedPortlet ; import org . oasis . wsrp . v2 . InconsistentParameters ; import org . oasis . wsrp . v2 . InteractionParams ; import org . oasis . wsrp . v2 . InvalidCookie ; import org . oasis . wsrp . v2 . InvalidHandle ; import org . oasis . wsrp . v2 . InvalidRegistration ; import org . oasis . wsrp . v2 . InvalidSession ; import org . oasis . wsrp . v2 . InvalidUserCategory ; import org . oasis . wsrp . v2 . ItemDescription ; import org . oasis . wsrp . v2 . Lifetime ; import org . oasis . wsrp . v2 . MarkupContext ; import org . oasis . wsrp . v2 . MarkupParams ; import org . oasis . wsrp . v2 . MissingParameters ; import org . oasis . wsrp . v2 . ModelDescription ; import org . oasis . wsrp . v2 . ModelTypes ; import org . oasis . wsrp . v2 . ModifyRegistrationRequired ; import org . oasis . wsrp . v2 . OperationFailed ; import org . oasis . wsrp . v2 . OperationNotSupported ; import org . oasis . wsrp . v2 . PortletContext ; import org . oasis . wsrp . v2 . PortletDescription ; import org . oasis . wsrp . v2 . PortletLifetime ; import org . oasis . wsrp . v2 . PortletStateChangeRequired ; import org . oasis . wsrp . v2 . Property ; import org . oasis . wsrp . v2 . PropertyList ; import org . oasis . wsrp . v2 . RegistrationContext ; import org . oasis . wsrp . v2 . RegistrationData ; import org . oasis . wsrp . v2 . ResetProperty ; import org . oasis . wsrp . v2 . ResourceContext ; import org . oasis . wsrp . v2 . ResourceList ; import org . oasis . wsrp . v2 . ResourceParams ; import org . oasis . wsrp . v2 . ResourceSuspended ; import org . oasis . wsrp . v2 . RuntimeContext ; import org . oasis . wsrp . v2 . SessionContext ; import org . oasis . wsrp . v2 . SetExportLifetime ; import org . oasis . wsrp . v2 . SetRegistrationLifetime ; import org . oasis . wsrp . v2 . UnsupportedLocale ; import org . oasis . wsrp . v2 . UnsupportedMimeType ; import org . oasis . wsrp . v2 . UnsupportedMode ; import org . oasis . wsrp . v2 . UnsupportedWindowState ; import org . oasis . wsrp . v2 . UpdateResponse ; import org . oasis . wsrp . v2 . UserContext ; import org . oasis . wsrp . v2 . WSRPV2MarkupPortType ; import org . oasis . wsrp . v2 . WSRPV2PortletManagementPortType ; import org . oasis . wsrp . v2 . WSRPV2RegistrationPortType ; import org . oasis . wsrp . v2 . WSRPV2ServiceDescriptionPortType ; import javax . jws . WebParam ; import javax . xml . ws . Holder ; import java . util . List ; public class TestWSRPProducerImpl implements TestWSRPProducer , WSRPV2MarkupPortType , WSRPV2PortletManagementPortType , WSRPV2RegistrationPortType , WSRPV2ServiceDescriptionPortType { private int sessionExpirationTime = <NUM_LIT> ; private CookieProtocol requiresInitCookie = CookieProtocol . NONE ; private BehaviorRegistry behaviorRegistry = new BehaviorRegistry ( ) ; public static final String USER_COOKIE = "<STR_LIT>" ; private String currentMarkupBehaviorHandle ; private boolean strict = true ; public TestWSRPProducerImpl ( ) { reset ( ) ; } public BehaviorRegistry getBehaviorRegistry ( ) { return behaviorRegistry ; } public void setCurrentMarkupBehaviorHandle ( String handle ) { currentMarkupBehaviorHandle = handle ; } public void reset ( ) { requiresInitCookie = null ; currentMarkupBehaviorHandle = null ; behaviorRegistry . clear ( ) ; } private MarkupBehavior getMarkupBehaviorFor ( String portletHandle ) throws InvalidHandle { return behaviorRegistry . getMarkupBehaviorFor ( portletHandle ) ; } private ServiceDescriptionBehavior getServiceDescriptionBehavior ( ) { return behaviorRegistry . getServiceDescriptionBehavior ( ) ; } public PortletManagementBehavior getPortletManagementBehavior ( ) { return behaviorRegistry . getPortletManagementBehavior ( ) ; } public void getServiceDescription ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) List < String > desiredLocales , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) List < String > portletHandles , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) UserContext userContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < Boolean > requiresRegistration , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < PortletDescription > > offeredPortlets , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < ItemDescription > > userCategoryDescriptions , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < ExtensionDescription > > extensionDescriptions , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < ItemDescription > > customWindowStateDescriptions , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < ItemDescription > > customModeDescriptions , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < CookieProtocol > requiresInitCookie , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < ModelDescription > registrationPropertyDescription , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < String > > locales , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < ResourceList > resourceList , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < EventDescription > > eventDescriptions , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < ModelTypes > schemaType , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < String > > supportedOptions , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < ExportDescription > exportDescription , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < Boolean > mayReturnRegistrationState , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < Extension > > extensions ) throws InvalidRegistration , ModifyRegistrationRequired , OperationFailed , ResourceSuspended { getServiceDescriptionBehavior ( ) . getServiceDescription ( registrationContext , desiredLocales , portletHandles , userContext , requiresRegistration , offeredPortlets , userCategoryDescriptions , extensionDescriptions , customWindowStateDescriptions , customModeDescriptions , requiresInitCookie , registrationPropertyDescription , locales , resourceList , eventDescriptions , schemaType , supportedOptions , exportDescription , mayReturnRegistrationState , extensions ) ; } public void getMarkup ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) PortletContext portletContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RuntimeContext runtimeContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) UserContext userContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) MarkupParams markupParams , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < MarkupContext > markupContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < SessionContext > sessionContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < Extension > > extensions ) throws AccessDenied , InconsistentParameters , InvalidCookie , InvalidHandle , InvalidRegistration , InvalidSession , InvalidUserCategory , MissingParameters , ModifyRegistrationRequired , OperationFailed , ResourceSuspended , UnsupportedLocale , UnsupportedMimeType , UnsupportedMode , UnsupportedWindowState { getMarkupBehaviorFor ( portletContext . getPortletHandle ( ) ) . getMarkup ( registrationContext , portletContext , runtimeContext , userContext , markupParams , markupContext , sessionContext , extensions ) ; } public void getResource ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . INOUT ) Holder < PortletContext > portletContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RuntimeContext runtimeContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) UserContext userContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) ResourceParams resourceParams , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < ResourceContext > resourceContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < SessionContext > sessionContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < Extension > > extensions ) throws AccessDenied , InconsistentParameters , InvalidCookie , InvalidHandle , InvalidRegistration , InvalidSession , InvalidUserCategory , MissingParameters , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended , UnsupportedLocale , UnsupportedMimeType , UnsupportedMode , UnsupportedWindowState { getMarkupBehaviorFor ( portletContext . value . getPortletHandle ( ) ) . getResource ( registrationContext , portletContext , runtimeContext , userContext , resourceParams , resourceContext , sessionContext , extensions ) ; } public void performBlockingInteraction ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) PortletContext portletContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RuntimeContext runtimeContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) UserContext userContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) MarkupParams markupParams , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) InteractionParams interactionParams , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < UpdateResponse > 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 < Extension > > extensions ) throws AccessDenied , InconsistentParameters , InvalidCookie , InvalidHandle , InvalidRegistration , InvalidSession , InvalidUserCategory , MissingParameters , ModifyRegistrationRequired , OperationFailed , PortletStateChangeRequired , ResourceSuspended , UnsupportedLocale , UnsupportedMimeType , UnsupportedMode , UnsupportedWindowState { getMarkupBehaviorFor ( portletContext . getPortletHandle ( ) ) . performBlockingInteraction ( registrationContext , portletContext , runtimeContext , userContext , markupParams , interactionParams , updateResponse , redirectURL , extensions ) ; } public void handleEvents ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) PortletContext portletContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RuntimeContext runtimeContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) UserContext userContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) MarkupParams markupParams , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) EventParams eventParams , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < UpdateResponse > updateResponse , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < HandleEventsFailed > > failedEvents , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < Extension > > extensions ) throws AccessDenied , InconsistentParameters , InvalidCookie , InvalidHandle , InvalidRegistration , InvalidSession , InvalidUserCategory , MissingParameters , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , PortletStateChangeRequired , ResourceSuspended , UnsupportedLocale , UnsupportedMimeType , UnsupportedMode , UnsupportedWindowState { getMarkupBehaviorFor ( portletContext . getPortletHandle ( ) ) . handleEvents ( registrationContext , portletContext , runtimeContext , userContext , markupParams , eventParams , updateResponse , failedEvents , extensions ) ; } public List < Extension > releaseSessions ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) List < String > sessionIDs , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) UserContext userContext ) throws AccessDenied , InvalidRegistration , MissingParameters , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended { throw new NotYetImplemented ( ) ; } public List < Extension > initCookie ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) UserContext userContext ) throws AccessDenied , InvalidRegistration , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended { if ( requiresInitCookie == null || CookieProtocol . NONE . equals ( requiresInitCookie ) ) { throw WSRP2ExceptionFactory . throwWSException ( OperationFailed . class , "<STR_LIT>" , null ) ; } try { return getMarkupBehaviorFor ( currentMarkupBehaviorHandle ) . initCookie ( registrationContext , userContext ) ; } catch ( InvalidHandle invalidHandle ) { throw WSRP2ExceptionFactory . throwWSException ( OperationFailed . class , "<STR_LIT>" , invalidHandle ) ; } } public void register ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationData registrationData , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Lifetime lifetime , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) UserContext userContext , @ 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 < Lifetime > scheduledDestruction , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < Extension > > extensions , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < String > registrationHandle ) throws MissingParameters , OperationFailed , OperationNotSupported { registrationHandle . value = "<STR_LIT>" ; } public List < Extension > deregister ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) UserContext userContext ) throws InvalidRegistration , OperationFailed , OperationNotSupported , ResourceSuspended { return null ; } public void modifyRegistration ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationData registrationData , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) UserContext userContext , @ 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 < Lifetime > scheduledDestruction , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < Extension > > extensions ) throws InvalidRegistration , MissingParameters , OperationFailed , OperationNotSupported , ResourceSuspended { } public Lifetime getRegistrationLifetime ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , partName = "<STR_LIT>" ) GetRegistrationLifetime getRegistrationLifetime ) throws AccessDenied , InvalidHandle , InvalidRegistration , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended { throw new NotYetImplemented ( ) ; } public Lifetime setRegistrationLifetime ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , partName = "<STR_LIT>" ) SetRegistrationLifetime setRegistrationLifetime ) throws AccessDenied , InvalidHandle , InvalidRegistration , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended { throw new NotYetImplemented ( ) ; } public void getPortletDescription ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) PortletContext portletContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) UserContext userContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) List < String > desiredLocales , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < PortletDescription > portletDescription , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < ResourceList > resourceList , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < Extension > > extensions ) throws AccessDenied , InconsistentParameters , InvalidHandle , InvalidRegistration , InvalidUserCategory , MissingParameters , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended { getPortletManagementBehavior ( ) . getPortletDescription ( registrationContext , portletContext , userContext , desiredLocales , portletDescription , resourceList , extensions ) ; } public void clonePortlet ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) PortletContext portletContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) UserContext userContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Lifetime lifetime , @ 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 < Lifetime > scheduledDestruction , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < Extension > > extensions ) throws AccessDenied , InconsistentParameters , InvalidHandle , InvalidRegistration , InvalidUserCategory , MissingParameters , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended { getPortletManagementBehavior ( ) . clonePortlet ( registrationContext , portletContext , userContext , lifetime , portletHandle , portletState , scheduledDestruction , extensions ) ; } public void destroyPortlets ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) List < String > portletHandles , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) UserContext userContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < FailedPortlets > > failedPortlets , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < Extension > > extensions ) throws InconsistentParameters , InvalidRegistration , MissingParameters , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended { getPortletManagementBehavior ( ) . destroyPortlets ( registrationContext , portletHandles , userContext , failedPortlets , extensions ) ; } public void getPortletsLifetime ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) List < PortletContext > portletContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) UserContext userContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < PortletLifetime > > portletLifetime , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < FailedPortlets > > failedPortlets , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < ResourceList > resourceList , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < Extension > > extensions ) throws AccessDenied , InconsistentParameters , InvalidHandle , InvalidRegistration , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended { getPortletManagementBehavior ( ) . getPortletsLifetime ( registrationContext , portletContext , userContext , portletLifetime , failedPortlets , resourceList , extensions ) ; } public void setPortletsLifetime ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) List < PortletContext > portletContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) UserContext userContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Lifetime lifetime , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < PortletLifetime > > updatedPortlet , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < FailedPortlets > > failedPortlets , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < ResourceList > resourceList , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < Extension > > extensions ) throws AccessDenied , InconsistentParameters , InvalidHandle , InvalidRegistration , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended { getPortletManagementBehavior ( ) . setPortletsLifetime ( registrationContext , portletContext , userContext , lifetime , updatedPortlet , failedPortlets , resourceList , extensions ) ; } public void copyPortlets ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationContext toRegistrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) UserContext toUserContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationContext fromRegistrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) UserContext fromUserContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) List < PortletContext > fromPortletContexts , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Lifetime lifetime , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < CopiedPortlet > > copiedPortlets , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < FailedPortlets > > failedPortlets , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < ResourceList > resourceList , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < Extension > > extensions ) throws AccessDenied , InconsistentParameters , InvalidHandle , InvalidRegistration , InvalidUserCategory , MissingParameters , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended { getPortletManagementBehavior ( ) . copyPortlets ( toRegistrationContext , toUserContext , fromRegistrationContext , fromUserContext , fromPortletContexts , lifetime , copiedPortlets , failedPortlets , resourceList , extensions ) ; } public void exportPortlets ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) List < PortletContext > portletContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) UserContext userContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . INOUT ) Holder < Lifetime > lifetime , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Boolean exportByValueRequired , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < byte [ ] > exportContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < ExportedPortlet > > exportedPortlet , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < FailedPortlets > > failedPortlets , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < ResourceList > resourceList , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < Extension > > extensions ) throws AccessDenied , ExportByValueNotSupported , InconsistentParameters , InvalidHandle , InvalidRegistration , InvalidUserCategory , MissingParameters , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended { getPortletManagementBehavior ( ) . exportPortlets ( registrationContext , portletContext , userContext , lifetime , exportByValueRequired , exportContext , exportedPortlet , failedPortlets , resourceList , extensions ) ; } public void importPortlets ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) byte [ ] importContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) List < ImportPortlet > importPortlet , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) UserContext userContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Lifetime lifetime , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < ImportedPortlet > > importedPortlets , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < ImportPortletsFailed > > importFailed , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < ResourceList > resourceList , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < Extension > > extensions ) throws AccessDenied , ExportNoLongerValid , InconsistentParameters , InvalidRegistration , InvalidUserCategory , MissingParameters , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended { getPortletManagementBehavior ( ) . importPortlets ( registrationContext , importContext , importPortlet , userContext , lifetime , importedPortlets , importFailed , resourceList , extensions ) ; } public List < Extension > releaseExport ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) byte [ ] exportContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) UserContext userContext ) { return getPortletManagementBehavior ( ) . releaseExport ( registrationContext , exportContext , userContext ) ; } public Lifetime setExportLifetime ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , partName = "<STR_LIT>" ) SetExportLifetime setExportLifetime ) throws AccessDenied , InvalidHandle , InvalidRegistration , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended { return getPortletManagementBehavior ( ) . setExportLifetime ( setExportLifetime ) ; } public void setPortletProperties ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) PortletContext portletContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) UserContext userContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) PropertyList 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 < Lifetime > scheduledDestruction , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < Extension > > extensions ) throws AccessDenied , InconsistentParameters , InvalidHandle , InvalidRegistration , InvalidUserCategory , MissingParameters , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended { getPortletManagementBehavior ( ) . setPortletProperties ( registrationContext , portletContext , userContext , propertyList , portletHandle , portletState , scheduledDestruction , extensions ) ; } public void getPortletProperties ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) PortletContext portletContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) UserContext userContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) List < String > names , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < Property > > properties , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < ResetProperty > > resetProperties , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < Extension > > extensions ) throws AccessDenied , InconsistentParameters , InvalidHandle , InvalidRegistration , InvalidUserCategory , MissingParameters , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended { getPortletManagementBehavior ( ) . getPortletProperties ( registrationContext , portletContext , userContext , names , properties , resetProperties , extensions ) ; } public void getPortletPropertyDescription ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) PortletContext portletContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) UserContext userContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) List < String > desiredLocales , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < ModelDescription > modelDescription , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < ResourceList > resourceList , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < Extension > > extensions ) throws AccessDenied , InconsistentParameters , InvalidHandle , InvalidRegistration , InvalidUserCategory , MissingParameters , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended { getPortletManagementBehavior ( ) . getPortletPropertyDescription ( registrationContext , portletContext , userContext , desiredLocales , modelDescription , resourceList , extensions ) ; } public CookieProtocol getRequiresInitCookie ( ) { return requiresInitCookie ; } public void setRequiresInitCookie ( CookieProtocol requiresInitCookie ) { this . requiresInitCookie = requiresInitCookie ; getServiceDescriptionBehavior ( ) . setRequiresInitCookie ( requiresInitCookie ) ; } public int getSessionExpirationTime ( ) { return sessionExpirationTime ; } public void setSessionExpirationTime ( int sessionExpirationTime ) { this . sessionExpirationTime = sessionExpirationTime ; } public void usingStrictModeChangedTo ( boolean strictMode ) { strict = strictMode ; } } </s>
|
<s> package org . gatein . wsrp . test . protocol . v2 ; import org . gatein . common . NotYetImplemented ; import org . oasis . wsrp . v2 . AccessDenied ; import org . oasis . wsrp . v2 . CopiedPortlet ; import org . oasis . wsrp . v2 . ExportByValueNotSupported ; import org . oasis . wsrp . v2 . ExportNoLongerValid ; import org . oasis . wsrp . v2 . ExportedPortlet ; import org . oasis . wsrp . v2 . Extension ; import org . oasis . wsrp . v2 . FailedPortlets ; import org . oasis . wsrp . v2 . ImportPortlet ; import org . oasis . wsrp . v2 . ImportPortletsFailed ; import org . oasis . wsrp . v2 . ImportedPortlet ; import org . oasis . wsrp . v2 . InconsistentParameters ; import org . oasis . wsrp . v2 . InvalidHandle ; import org . oasis . wsrp . v2 . InvalidRegistration ; import org . oasis . wsrp . v2 . InvalidUserCategory ; import org . oasis . wsrp . v2 . Lifetime ; import org . oasis . wsrp . v2 . MissingParameters ; import org . oasis . wsrp . v2 . ModelDescription ; import org . oasis . wsrp . v2 . ModifyRegistrationRequired ; import org . oasis . wsrp . v2 . OperationFailed ; import org . oasis . wsrp . v2 . OperationNotSupported ; import org . oasis . wsrp . v2 . PortletContext ; import org . oasis . wsrp . v2 . PortletDescription ; import org . oasis . wsrp . v2 . PortletLifetime ; import org . oasis . wsrp . v2 . Property ; import org . oasis . wsrp . v2 . PropertyList ; import org . oasis . wsrp . v2 . RegistrationContext ; import org . oasis . wsrp . v2 . ResetProperty ; import org . oasis . wsrp . v2 . ResourceList ; import org . oasis . wsrp . v2 . ResourceSuspended ; import org . oasis . wsrp . v2 . SetExportLifetime ; import org . oasis . wsrp . v2 . UserContext ; import org . oasis . wsrp . v2 . WSRPV2PortletManagementPortType ; import javax . jws . WebParam ; import javax . xml . ws . Holder ; import java . util . List ; public class PortletManagementBehavior extends TestProducerBehavior implements WSRPV2PortletManagementPortType { public void getPortletPropertyDescription ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) PortletContext portletContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) UserContext userContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) List < String > desiredLocales , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < ModelDescription > modelDescription , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < ResourceList > resourceList , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < Extension > > extensions ) throws AccessDenied , InconsistentParameters , InvalidHandle , InvalidRegistration , InvalidUserCategory , MissingParameters , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended { incrementCallCount ( ) ; } public void getPortletDescription ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) PortletContext portletContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) UserContext userContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) List < String > desiredLocales , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < PortletDescription > portletDescription , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < ResourceList > resourceList , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < Extension > > extensions ) throws AccessDenied , InconsistentParameters , InvalidHandle , InvalidRegistration , InvalidUserCategory , MissingParameters , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended { incrementCallCount ( ) ; } public void clonePortlet ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) PortletContext portletContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) UserContext userContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Lifetime lifetime , @ 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 < Lifetime > scheduledDestruction , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < Extension > > extensions ) throws AccessDenied , InconsistentParameters , InvalidHandle , InvalidRegistration , InvalidUserCategory , MissingParameters , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended { incrementCallCount ( ) ; } public void destroyPortlets ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) List < String > portletHandles , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) UserContext userContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < FailedPortlets > > failedPortlets , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < Extension > > extensions ) throws InconsistentParameters , InvalidRegistration , MissingParameters , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended { incrementCallCount ( ) ; } public void getPortletsLifetime ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) List < PortletContext > portletContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) UserContext userContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < PortletLifetime > > portletLifetime , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < FailedPortlets > > failedPortlets , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < ResourceList > resourceList , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < Extension > > extensions ) throws AccessDenied , InconsistentParameters , InvalidHandle , InvalidRegistration , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended { throw new NotYetImplemented ( ) ; } public void setPortletsLifetime ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) List < PortletContext > portletContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) UserContext userContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Lifetime lifetime , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < PortletLifetime > > updatedPortlet , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < FailedPortlets > > failedPortlets , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < ResourceList > resourceList , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < Extension > > extensions ) throws AccessDenied , InconsistentParameters , InvalidHandle , InvalidRegistration , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended { throw new NotYetImplemented ( ) ; } public void copyPortlets ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationContext toRegistrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) UserContext toUserContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationContext fromRegistrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) UserContext fromUserContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) List < PortletContext > fromPortletContexts , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Lifetime lifetime , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < CopiedPortlet > > copiedPortlets , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < FailedPortlets > > failedPortlets , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < ResourceList > resourceList , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < Extension > > extensions ) throws AccessDenied , InconsistentParameters , InvalidHandle , InvalidRegistration , InvalidUserCategory , MissingParameters , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended { throw new NotYetImplemented ( ) ; } public void exportPortlets ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) List < PortletContext > portletContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) UserContext userContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . INOUT ) Holder < Lifetime > lifetime , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Boolean exportByValueRequired , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < byte [ ] > exportContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < ExportedPortlet > > exportedPortlet , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < FailedPortlets > > failedPortlets , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < ResourceList > resourceList , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < Extension > > extensions ) throws AccessDenied , ExportByValueNotSupported , InconsistentParameters , InvalidHandle , InvalidRegistration , InvalidUserCategory , MissingParameters , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended { throw new NotYetImplemented ( ) ; } public void importPortlets ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) byte [ ] importContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) List < ImportPortlet > importPortlet , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) UserContext userContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Lifetime lifetime , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < ImportedPortlet > > importedPortlets , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < ImportPortletsFailed > > importFailed , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < ResourceList > resourceList , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < Extension > > extensions ) throws AccessDenied , ExportNoLongerValid , InconsistentParameters , InvalidRegistration , InvalidUserCategory , MissingParameters , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended { throw new NotYetImplemented ( ) ; } public List < Extension > releaseExport ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) byte [ ] exportContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) UserContext userContext ) { throw new NotYetImplemented ( ) ; } public Lifetime setExportLifetime ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , partName = "<STR_LIT>" ) SetExportLifetime setExportLifetime ) throws AccessDenied , InvalidHandle , InvalidRegistration , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended { throw new NotYetImplemented ( ) ; } public void setPortletProperties ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) PortletContext portletContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) UserContext userContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) PropertyList 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 < Lifetime > scheduledDestruction , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < Extension > > extensions ) throws AccessDenied , InconsistentParameters , InvalidHandle , InvalidRegistration , InvalidUserCategory , MissingParameters , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended { incrementCallCount ( ) ; } public void getPortletProperties ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) PortletContext portletContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) UserContext userContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) List < String > names , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < Property > > properties , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < ResetProperty > > resetProperties , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < Extension > > extensions ) throws AccessDenied , InconsistentParameters , InvalidHandle , InvalidRegistration , InvalidUserCategory , MissingParameters , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended { incrementCallCount ( ) ; } } </s>
|
<s> package org . gatein . wsrp . test . protocol . v2 ; import java . util . ArrayList ; import java . util . List ; import org . gatein . common . net . media . MediaType ; import org . gatein . wsrp . WSRPConstants ; import org . gatein . wsrp . WSRPTypeFactory ; import org . oasis . wsrp . v2 . LocalizedString ; import org . oasis . wsrp . v2 . MarkupType ; import org . oasis . wsrp . v2 . PortletDescription ; public abstract class TestProducerBehavior { protected int callCount ; public static final String SAMPLE_DESCRIPTION = "<STR_LIT>" ; public static final String SAMPLE_SHORTTITLE = "<STR_LIT>" ; public static final String SAMPLE_TITLE = "<STR_LIT>" ; public static final String SAMPLE_DISPLAYNAME = "<STR_LIT>" ; public static final String SAMPLE_KEYWORD = "<STR_LIT>" ; public void incrementCallCount ( ) { callCount ++ ; } public int getCallCount ( ) { return callCount ; } public PortletDescription createPortletDescription ( String portletHandle , String suffix ) { String mimeType = MediaType . TEXT_HTML . getValue ( ) ; List < String > modes = new ArrayList < String > ( ) ; modes . add ( WSRPConstants . VIEW_MODE ) ; List < String > windowStates = new ArrayList < String > ( ) ; windowStates . add ( WSRPConstants . NORMAL_WINDOW_STATE ) ; MarkupType markupType = WSRPTypeFactory . createMarkupType ( mimeType , modes , windowStates , WSRPConstants . getDefaultLocales ( ) ) ; List < MarkupType > markupTypes = new ArrayList < MarkupType > ( ) ; markupTypes . add ( markupType ) ; PortletDescription portletDesc = WSRPTypeFactory . createPortletDescription ( portletHandle , markupTypes ) ; portletDesc . getMarkupTypes ( ) . add ( markupType ) ; String suffixString = suffix == null ? "<STR_LIT>" : suffix ; portletDesc . setDescription ( createLocalizedString ( SAMPLE_DESCRIPTION + suffixString ) ) ; portletDesc . setTitle ( createLocalizedString ( SAMPLE_TITLE + suffixString ) ) ; portletDesc . setShortTitle ( createLocalizedString ( SAMPLE_SHORTTITLE + suffixString ) ) ; portletDesc . setDisplayName ( createLocalizedString ( SAMPLE_DISPLAYNAME + suffixString ) ) ; portletDesc . getKeywords ( ) . add ( createLocalizedString ( SAMPLE_KEYWORD + suffixString ) ) ; return portletDesc ; } public static LocalizedString createLocalizedString ( String value ) { return WSRPTypeFactory . createLocalizedString ( value ) ; } public static String extractString ( org . gatein . common . i18n . LocalizedString ls ) { return ls . getPreferredOrBestLocalizedMappingFor ( new String [ ] { "<STR_LIT:en>" } ) . getString ( ) ; } } </s>
|
<s> package org . gatein . wsrp . test . protocol . v2 . behaviors ; import org . gatein . wsrp . spec . v2 . WSRP2Constants ; import org . gatein . wsrp . test . protocol . v2 . ServiceDescriptionBehavior ; import org . oasis . wsrp . v2 . CookieProtocol ; import org . oasis . wsrp . v2 . EventDescription ; import org . oasis . wsrp . v2 . ExportDescription ; import org . oasis . wsrp . v2 . Extension ; import org . oasis . wsrp . v2 . ExtensionDescription ; import org . oasis . wsrp . v2 . InvalidRegistration ; import org . oasis . wsrp . v2 . ItemDescription ; import org . oasis . wsrp . v2 . ModelDescription ; import org . oasis . wsrp . v2 . ModelTypes ; import org . oasis . wsrp . v2 . ModifyRegistrationRequired ; import org . oasis . wsrp . v2 . OperationFailed ; import org . oasis . wsrp . v2 . PortletDescription ; import org . oasis . wsrp . v2 . RegistrationContext ; import org . oasis . wsrp . v2 . ResourceList ; import org . oasis . wsrp . v2 . ResourceSuspended ; import org . oasis . wsrp . v2 . UserContext ; import javax . jws . WebParam ; import javax . xml . ws . Holder ; import java . util . ArrayList ; import java . util . List ; public class SupportedOptionsServiceDescriptionBehavior extends ServiceDescriptionBehavior { @ Override public void getServiceDescription ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) List < String > desiredLocales , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) List < String > portletHandles , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) UserContext userContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < Boolean > requiresRegistration , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < PortletDescription > > offeredPortlets , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < ItemDescription > > userCategoryDescriptions , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < ExtensionDescription > > extensionDescriptions , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < ItemDescription > > customWindowStateDescriptions , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < ItemDescription > > customModeDescriptions , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < CookieProtocol > requiresInitCookie , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < ModelDescription > registrationPropertyDescription , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < String > > locales , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < ResourceList > resourceList , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < EventDescription > > eventDescriptions , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < ModelTypes > schemaType , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < String > > supportedOptions , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < ExportDescription > exportDescription , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < Boolean > mayReturnRegistrationState , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < Extension > > extensions ) throws InvalidRegistration , ModifyRegistrationRequired , OperationFailed , ResourceSuspended { super . getServiceDescription ( registrationContext , desiredLocales , portletHandles , userContext , requiresRegistration , offeredPortlets , userCategoryDescriptions , extensionDescriptions , customWindowStateDescriptions , customModeDescriptions , requiresInitCookie , registrationPropertyDescription , locales , resourceList , eventDescriptions , schemaType , supportedOptions , exportDescription , mayReturnRegistrationState , extensions ) ; supportedOptions . value = new ArrayList < String > ( <NUM_LIT:2> ) ; supportedOptions . value . add ( WSRP2Constants . OPTIONS_EXPORT ) ; supportedOptions . value . add ( WSRP2Constants . OPTIONS_IMPORT ) ; } } </s>
|
<s> package org . gatein . wsrp . test . protocol . v2 . behaviors ; import org . gatein . pc . api . Mode ; import org . gatein . pc . api . WindowState ; import org . gatein . wsrp . WSRPTypeFactory ; import org . gatein . wsrp . api . extensions . UnmarshalledExtension ; import org . gatein . wsrp . payload . PayloadUtils ; import org . gatein . wsrp . test . protocol . v2 . BehaviorRegistry ; import org . gatein . wsrp . test . protocol . v2 . MarkupBehavior ; import org . oasis . wsrp . v2 . AccessDenied ; import org . oasis . wsrp . v2 . Extension ; import org . oasis . wsrp . v2 . GetMarkup ; import org . oasis . wsrp . v2 . InconsistentParameters ; import org . oasis . wsrp . v2 . InteractionParams ; import org . oasis . wsrp . v2 . InvalidCookie ; import org . oasis . wsrp . v2 . InvalidHandle ; import org . oasis . wsrp . v2 . InvalidRegistration ; import org . oasis . wsrp . v2 . InvalidSession ; import org . oasis . wsrp . v2 . InvalidUserCategory ; import org . oasis . wsrp . v2 . MarkupParams ; import org . oasis . wsrp . v2 . MarkupResponse ; import org . oasis . wsrp . v2 . MissingParameters ; import org . oasis . wsrp . v2 . ModifyRegistrationRequired ; import org . oasis . wsrp . v2 . OperationFailed ; import org . oasis . wsrp . v2 . PortletContext ; import org . oasis . wsrp . v2 . PortletStateChangeRequired ; import org . oasis . wsrp . v2 . RegistrationContext ; import org . oasis . wsrp . v2 . ResourceSuspended ; import org . oasis . wsrp . v2 . RuntimeContext ; import org . oasis . wsrp . v2 . UnsupportedLocale ; import org . oasis . wsrp . v2 . UnsupportedMimeType ; import org . oasis . wsrp . v2 . UnsupportedMode ; import org . oasis . wsrp . v2 . UnsupportedWindowState ; import org . oasis . wsrp . v2 . UpdateResponse ; import org . oasis . wsrp . v2 . UserContext ; import org . w3c . dom . Element ; import org . w3c . dom . Node ; import javax . jws . WebParam ; import javax . xml . ws . Holder ; import java . util . List ; public class ExtensionMarkupBehavior extends MarkupBehavior { public static final String PORTLET_HANDLE = "<STR_LIT>" ; public static final String SIMPLE_SUCCESS = "<STR_LIT>" ; public static final String ELEMENT_SUCCESS = "<STR_LIT>" ; public static final String FAILURE = "<STR_LIT>" ; public static final String EXPECTED_REQUEST_EXTENSION_VALUE = "<STR_LIT:foo>" ; public static final String EXPECTED_RESPONSE_EXTENSION_VALUE = "<STR_LIT:bar>" ; private static Element ELEMENT_RESPONSE ; static { final String namespaceURI = "<STR_LIT>" ; ELEMENT_RESPONSE = PayloadUtils . createElement ( namespaceURI , "<STR_LIT>" ) ; Node state = ELEMENT_RESPONSE . getOwnerDocument ( ) . createElementNS ( namespaceURI , "<STR_LIT:state>" ) ; state = ELEMENT_RESPONSE . appendChild ( state ) ; state . setTextContent ( ExtensionMarkupBehavior . EXPECTED_RESPONSE_EXTENSION_VALUE ) ; } private static enum Status { simple ( SIMPLE_SUCCESS , EXPECTED_RESPONSE_EXTENSION_VALUE ) , element ( ELEMENT_SUCCESS , ELEMENT_RESPONSE ) , failure ( FAILURE , null ) ; private Status ( String markup , Object response ) { this . markup = markup ; this . response = response ; } private final String markup ; private final Object response ; } private Status status ; public ExtensionMarkupBehavior ( BehaviorRegistry registry ) { super ( registry ) ; registerHandle ( PORTLET_HANDLE ) ; } @ Override protected String getMarkupString ( Mode mode , WindowState windowState , String navigationalState , GetMarkup getMarkup ) throws UnsupportedWindowState , InvalidCookie , InvalidSession , AccessDenied , InconsistentParameters , InvalidHandle , UnsupportedLocale , UnsupportedMode , OperationFailed , MissingParameters , InvalidUserCategory , InvalidRegistration , UnsupportedMimeType { status = Status . failure ; getStatus ( getMarkup . getMarkupParams ( ) . getExtensions ( ) ) ; return status . markup ; } @ Override public void modifyResponseIfNeeded ( MarkupResponse markupResponse ) { final List < Extension > extensions = markupResponse . getExtensions ( ) ; addExtensions ( extensions ) ; } private void addExtensions ( List < Extension > extensions ) { if ( ! Status . failure . equals ( status ) ) { extensions . add ( WSRPTypeFactory . createExtension ( PayloadUtils . marshallExtension ( status . response ) ) ) ; } } @ Override public void performBlockingInteraction ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) PortletContext portletContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RuntimeContext runtimeContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) UserContext userContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) MarkupParams markupParams , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) InteractionParams interactionParams , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < UpdateResponse > 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 < Extension > > extensions ) throws AccessDenied , InconsistentParameters , InvalidCookie , InvalidHandle , InvalidRegistration , InvalidSession , InvalidUserCategory , MissingParameters , ModifyRegistrationRequired , OperationFailed , PortletStateChangeRequired , ResourceSuspended , UnsupportedLocale , UnsupportedMimeType , UnsupportedMode , UnsupportedWindowState { status = Status . failure ; getStatus ( interactionParams . getExtensions ( ) ) ; UpdateResponse ur = WSRPTypeFactory . createUpdateResponse ( ) ; updateResponse . value = ur ; final List < Extension > responseExtensions = ur . getExtensions ( ) ; addExtensions ( responseExtensions ) ; extensions . value = responseExtensions ; } private void getStatus ( List < Extension > requestExtensions ) { if ( ! requestExtensions . isEmpty ( ) ) { final Extension extension = requestExtensions . get ( <NUM_LIT:0> ) ; final UnmarshalledExtension unmarshalledExtension = PayloadUtils . unmarshallExtension ( extension . getAny ( ) ) ; if ( unmarshalledExtension . isElement ( ) ) { final Element element = ( Element ) unmarshalledExtension . getValue ( ) ; if ( EXPECTED_REQUEST_EXTENSION_VALUE . equals ( element . getTextContent ( ) ) ) { status = Status . element ; } } else { final String foo = ( String ) unmarshalledExtension . getValue ( ) ; if ( EXPECTED_REQUEST_EXTENSION_VALUE . equals ( foo ) ) { status = Status . simple ; } } } } } </s>
|
<s> package org . gatein . wsrp . test . protocol . v2 . behaviors ; import org . gatein . wsrp . test . protocol . v2 . ServiceDescriptionBehavior ; import org . oasis . wsrp . v2 . CookieProtocol ; import org . oasis . wsrp . v2 . EventDescription ; import org . oasis . wsrp . v2 . ExportDescription ; import org . oasis . wsrp . v2 . Extension ; import org . oasis . wsrp . v2 . ExtensionDescription ; import org . oasis . wsrp . v2 . InvalidRegistration ; import org . oasis . wsrp . v2 . ItemDescription ; import org . oasis . wsrp . v2 . ModelDescription ; import org . oasis . wsrp . v2 . ModelTypes ; import org . oasis . wsrp . v2 . ModifyRegistrationRequired ; import org . oasis . wsrp . v2 . OperationFailed ; import org . oasis . wsrp . v2 . PortletDescription ; import org . oasis . wsrp . v2 . RegistrationContext ; import org . oasis . wsrp . v2 . ResourceList ; import org . oasis . wsrp . v2 . ResourceSuspended ; import org . oasis . wsrp . v2 . UserContext ; import javax . jws . WebParam ; import javax . xml . ws . Holder ; import java . util . List ; public class GroupedPortletsServiceDescriptionBehavior extends ServiceDescriptionBehavior { public GroupedPortletsServiceDescriptionBehavior ( List < PortletDescription > offeredPortlets ) { this . offeredPortlets = offeredPortlets ; } @ Override public void getServiceDescription ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) List < String > desiredLocales , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) List < String > portletHandles , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) UserContext userContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < Boolean > requiresRegistration , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < PortletDescription > > offeredPortlets , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < ItemDescription > > userCategoryDescriptions , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < ExtensionDescription > > extensionDescriptions , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < ItemDescription > > customWindowStateDescriptions , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < ItemDescription > > customModeDescriptions , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < CookieProtocol > requiresInitCookie , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < ModelDescription > registrationPropertyDescription , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < String > > locales , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < ResourceList > resourceList , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < EventDescription > > eventDescriptions , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < ModelTypes > schemaType , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < String > > supportedOptions , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < ExportDescription > exportDescription , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < Boolean > mayReturnRegistrationState , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < Extension > > extensions ) throws InvalidRegistration , ModifyRegistrationRequired , OperationFailed , ResourceSuspended { super . getServiceDescription ( registrationContext , desiredLocales , portletHandles , userContext , requiresRegistration , offeredPortlets , userCategoryDescriptions , extensionDescriptions , customWindowStateDescriptions , customModeDescriptions , requiresInitCookie , registrationPropertyDescription , locales , resourceList , eventDescriptions , schemaType , supportedOptions , exportDescription , mayReturnRegistrationState , extensions ) ; List < PortletDescription > portletDescriptions = offeredPortlets . value ; for ( int i = <NUM_LIT:0> ; i < portletDescriptions . size ( ) ; i ++ ) { portletDescriptions . get ( i ) . setGroupID ( "<STR_LIT>" + i % <NUM_LIT:3> ) ; } } } </s>
|
<s> package org . gatein . wsrp . test . protocol . v2 . behaviors ; import org . gatein . wsrp . spec . v2 . WSRP2ExceptionFactory ; import org . gatein . wsrp . test . protocol . v2 . BehaviorRegistry ; import org . oasis . wsrp . v2 . AccessDenied ; import org . oasis . wsrp . v2 . Extension ; import org . oasis . wsrp . v2 . InconsistentParameters ; import org . oasis . wsrp . v2 . InvalidHandle ; import org . oasis . wsrp . v2 . InvalidRegistration ; import org . oasis . wsrp . v2 . InvalidUserCategory ; import org . oasis . wsrp . v2 . MissingParameters ; import org . oasis . wsrp . v2 . ModifyRegistrationRequired ; import org . oasis . wsrp . v2 . OperationFailed ; import org . oasis . wsrp . v2 . OperationNotSupported ; import org . oasis . wsrp . v2 . PortletContext ; import org . oasis . wsrp . v2 . PortletDescription ; import org . oasis . wsrp . v2 . RegistrationContext ; import org . oasis . wsrp . v2 . ResourceList ; import org . oasis . wsrp . v2 . ResourceSuspended ; import org . oasis . wsrp . v2 . UserContext ; import javax . jws . WebParam ; import javax . xml . ws . Holder ; import java . util . List ; public class DestroyClonesPortletManagementBehavior extends BasicPortletManagementBehavior { public DestroyClonesPortletManagementBehavior ( BehaviorRegistry registry ) { super ( registry ) ; } @ Override public void getPortletDescription ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) PortletContext portletContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) UserContext userContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) List < String > desiredLocales , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < PortletDescription > portletDescription , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < ResourceList > resourceList , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < Extension > > extensions ) throws AccessDenied , InconsistentParameters , InvalidHandle , InvalidRegistration , InvalidUserCategory , MissingParameters , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended { if ( getCallCount ( ) == <NUM_LIT:0> ) { incrementCallCount ( ) ; super . getPortletDescription ( registrationContext , portletContext , userContext , desiredLocales , portletDescription , resourceList , extensions ) ; } else { throw WSRP2ExceptionFactory . throwWSException ( InvalidHandle . class , "<STR_LIT>" + portletContext . getPortletHandle ( ) , null ) ; } } } </s>
|
<s> package org . gatein . wsrp . test . protocol . v2 . behaviors ; import org . gatein . wsrp . handler . RequestHeaderClientHandler ; import org . gatein . wsrp . test . handler . MockSOAPMessage ; import org . gatein . wsrp . test . handler . MockSOAPMessageContext ; import org . gatein . wsrp . test . protocol . v2 . BehaviorRegistry ; import org . oasis . wsrp . v2 . AccessDenied ; import org . oasis . wsrp . v2 . Extension ; import org . oasis . wsrp . v2 . InvalidRegistration ; import org . oasis . wsrp . v2 . ModifyRegistrationRequired ; import org . oasis . wsrp . v2 . OperationFailed ; import org . oasis . wsrp . v2 . OperationNotSupported ; import org . oasis . wsrp . v2 . RegistrationContext ; import org . oasis . wsrp . v2 . ResourceSuspended ; import org . oasis . wsrp . v2 . UserContext ; import javax . jws . WebParam ; import javax . xml . soap . MimeHeaders ; import javax . xml . ws . handler . soap . SOAPMessageContext ; import java . util . List ; public class PerUserInitCookieMarkupBehavior extends InitCookieMarkupBehavior { public static final String PER_USER_INIT_COOKIE_HANDLE = "<STR_LIT>" ; public PerUserInitCookieMarkupBehavior ( BehaviorRegistry registry ) { super ( registry ) ; } protected void initPortletHandle ( ) { portletHandle = PER_USER_INIT_COOKIE_HANDLE ; } @ Override public List < Extension > initCookie ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) UserContext userContext ) throws AccessDenied , InvalidRegistration , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended { MockSOAPMessage message = new MockSOAPMessage ( ) ; SOAPMessageContext msgContext = MockSOAPMessageContext . createMessageContext ( message , getClass ( ) . getClassLoader ( ) ) ; MimeHeaders headers = new MimeHeaders ( ) ; headers . setHeader ( "<STR_LIT>" , "<STR_LIT>" ) ; message . setMimeHeaders ( headers ) ; RequestHeaderClientHandler rhch = new RequestHeaderClientHandler ( ) ; rhch . handleResponse ( msgContext ) ; return super . initCookie ( registrationContext , userContext ) ; } } </s>
|
<s> package org . gatein . wsrp . test . protocol . v2 . behaviors ; import org . gatein . pc . api . Mode ; import org . gatein . pc . api . OpaqueStateString ; import org . gatein . pc . api . WindowState ; import org . gatein . wsrp . WSRPConstants ; import org . gatein . wsrp . WSRPTypeFactory ; import org . gatein . wsrp . test . protocol . v2 . BehaviorRegistry ; import org . gatein . wsrp . test . protocol . v2 . MarkupBehavior ; import org . oasis . wsrp . v2 . AccessDenied ; import org . oasis . wsrp . v2 . Extension ; import org . oasis . wsrp . v2 . GetMarkup ; import org . oasis . wsrp . v2 . InconsistentParameters ; import org . oasis . wsrp . v2 . InteractionParams ; import org . oasis . wsrp . v2 . InvalidCookie ; import org . oasis . wsrp . v2 . InvalidHandle ; import org . oasis . wsrp . v2 . InvalidRegistration ; import org . oasis . wsrp . v2 . InvalidSession ; import org . oasis . wsrp . v2 . InvalidUserCategory ; import org . oasis . wsrp . v2 . MarkupParams ; import org . oasis . wsrp . v2 . MarkupResponse ; import org . oasis . wsrp . v2 . MissingParameters ; import org . oasis . wsrp . v2 . ModifyRegistrationRequired ; import org . oasis . wsrp . v2 . OperationFailed ; import org . oasis . wsrp . v2 . PortletContext ; import org . oasis . wsrp . v2 . PortletStateChangeRequired ; import org . oasis . wsrp . v2 . RegistrationContext ; import org . oasis . wsrp . v2 . ResourceSuspended ; import org . oasis . wsrp . v2 . RuntimeContext ; import org . oasis . wsrp . v2 . UnsupportedLocale ; import org . oasis . wsrp . v2 . UnsupportedMimeType ; import org . oasis . wsrp . v2 . UnsupportedMode ; import org . oasis . wsrp . v2 . UnsupportedWindowState ; import org . oasis . wsrp . v2 . UpdateResponse ; import org . oasis . wsrp . v2 . UserContext ; import javax . jws . WebParam ; import javax . xml . ws . Holder ; import java . util . List ; public class BasicMarkupBehavior extends MarkupBehavior { public static final String PORTLET_HANDLE = "<STR_LIT>" ; public static final String NS = "<STR_LIT>" ; public BasicMarkupBehavior ( BehaviorRegistry registry ) { super ( registry ) ; registerHandle ( PORTLET_HANDLE ) ; } public String getMarkupString ( Mode mode , WindowState windowState , String navigationalState , GetMarkup getMarkup ) { StringBuffer markupString = new StringBuffer ( "<STR_LIT>" ) ; markupString . append ( mode ) . append ( "<STR_LIT::>" ) . append ( windowState ) ; if ( navigationalState != null ) { markupString . append ( "<STR_LIT::>" ) . append ( navigationalState ) ; } return markupString . toString ( ) ; } @ Override public void performBlockingInteraction ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) PortletContext portletContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RuntimeContext runtimeContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) UserContext userContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) MarkupParams markupParams , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) InteractionParams interactionParams , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < UpdateResponse > 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 < Extension > > extensions ) throws AccessDenied , InconsistentParameters , InvalidCookie , InvalidHandle , InvalidRegistration , InvalidSession , InvalidUserCategory , MissingParameters , ModifyRegistrationRequired , OperationFailed , PortletStateChangeRequired , ResourceSuspended , UnsupportedLocale , UnsupportedMimeType , UnsupportedMode , UnsupportedWindowState { UpdateResponse ur = WSRPTypeFactory . createUpdateResponse ( ) ; ur . setNavigationalContext ( WSRPTypeFactory . createNavigationalContextOrNull ( new OpaqueStateString ( NS ) , null ) ) ; updateResponse . value = ur ; extensions . value = ur . getExtensions ( ) ; } public void modifyResponseIfNeeded ( MarkupResponse markupResponse ) { markupResponse . getMarkupContext ( ) . setCacheControl ( WSRPTypeFactory . createCacheControl ( <NUM_LIT:15> , WSRPConstants . CACHE_PER_USER ) ) ; } } </s>
|
<s> package org . gatein . wsrp . test . protocol . v2 . behaviors ; import org . gatein . pc . api . Mode ; import org . gatein . pc . api . WindowState ; import org . gatein . wsrp . test . protocol . v2 . BehaviorRegistry ; import org . gatein . wsrp . test . protocol . v2 . MarkupBehavior ; import org . oasis . wsrp . v2 . GetMarkup ; public class EmptyMarkupBehavior extends MarkupBehavior { public static final String PORTLET_HANDLE = "<STR_LIT>" ; public EmptyMarkupBehavior ( BehaviorRegistry registry ) { super ( registry ) ; registerHandle ( PORTLET_HANDLE ) ; } public String getMarkupString ( Mode mode , WindowState windowState , String navigationalState , GetMarkup getMarkup ) { return "<STR_LIT>" ; } } </s>
|
<s> package org . gatein . wsrp . test . protocol . v2 . behaviors ; import org . gatein . common . NotYetImplemented ; import org . gatein . common . util . ParameterValidation ; import org . gatein . wsrp . WSRPTypeFactory ; import org . gatein . wsrp . spec . v2 . ErrorCodes ; import org . gatein . wsrp . spec . v2 . WSRP2ExceptionFactory ; import org . gatein . wsrp . test . protocol . v2 . BehaviorRegistry ; import org . gatein . wsrp . test . protocol . v2 . MarkupBehavior ; import org . gatein . wsrp . test . protocol . v2 . PortletManagementBehavior ; import org . oasis . wsrp . v2 . AccessDenied ; import org . oasis . wsrp . v2 . CopiedPortlet ; import org . oasis . wsrp . v2 . ExportByValueNotSupported ; import org . oasis . wsrp . v2 . ExportNoLongerValid ; import org . oasis . wsrp . v2 . ExportedPortlet ; import org . oasis . wsrp . v2 . Extension ; import org . oasis . wsrp . v2 . FailedPortlets ; import org . oasis . wsrp . v2 . ImportPortlet ; import org . oasis . wsrp . v2 . ImportPortletsFailed ; import org . oasis . wsrp . v2 . ImportedPortlet ; import org . oasis . wsrp . v2 . InconsistentParameters ; import org . oasis . wsrp . v2 . InvalidHandle ; import org . oasis . wsrp . v2 . InvalidRegistration ; import org . oasis . wsrp . v2 . InvalidUserCategory ; import org . oasis . wsrp . v2 . Lifetime ; import org . oasis . wsrp . v2 . MissingParameters ; import org . oasis . wsrp . v2 . ModelDescription ; import org . oasis . wsrp . v2 . ModifyRegistrationRequired ; import org . oasis . wsrp . v2 . OperationFailed ; import org . oasis . wsrp . v2 . OperationNotSupported ; import org . oasis . wsrp . v2 . PortletContext ; import org . oasis . wsrp . v2 . PortletDescription ; import org . oasis . wsrp . v2 . PortletLifetime ; import org . oasis . wsrp . v2 . Property ; import org . oasis . wsrp . v2 . PropertyList ; import org . oasis . wsrp . v2 . RegistrationContext ; import org . oasis . wsrp . v2 . ResetProperty ; import org . oasis . wsrp . v2 . ResourceList ; import org . oasis . wsrp . v2 . ResourceSuspended ; import org . oasis . wsrp . v2 . SetExportLifetime ; import org . oasis . wsrp . v2 . UserContext ; import javax . jws . WebParam ; import javax . xml . namespace . QName ; import javax . xml . ws . Holder ; import java . util . ArrayList ; import java . util . List ; public class BasicPortletManagementBehavior extends PortletManagementBehavior { private static final String CLONE_SUFFIX = "<STR_LIT>" ; public static final String PROPERTY_NAME = "<STR_LIT>" ; public static final String PROPERTY_VALUE = "<STR_LIT:value1>" ; public static final String PROPERTY_NEW_VALUE = "<STR_LIT>" ; public static final String CLONED_HANDLE = BasicMarkupBehavior . PORTLET_HANDLE + CLONE_SUFFIX ; public static final String CANNOT_BOTH_SET_AND_RESET_A_PROPERTY_AT_THE_SAME_TIME = "<STR_LIT>" ; private BehaviorRegistry registry ; private String propValue = PROPERTY_VALUE ; public BasicPortletManagementBehavior ( BehaviorRegistry registry ) { super ( ) ; this . registry = registry ; } @ Override public void getPortletPropertyDescription ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) PortletContext portletContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) UserContext userContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) List < String > desiredLocales , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < ModelDescription > modelDescription , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < ResourceList > resourceList , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < Extension > > extensions ) throws AccessDenied , InconsistentParameters , InvalidHandle , InvalidRegistration , InvalidUserCategory , MissingParameters , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended { throw new NotYetImplemented ( ) ; } @ Override public void getPortletDescription ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) PortletContext portletContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) UserContext userContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) List < String > desiredLocales , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < PortletDescription > portletDescription , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < ResourceList > resourceList , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < Extension > > extensions ) throws AccessDenied , InconsistentParameters , InvalidHandle , InvalidRegistration , InvalidUserCategory , MissingParameters , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended { super . getPortletDescription ( registrationContext , portletContext , userContext , desiredLocales , portletDescription , resourceList , extensions ) ; String handle = getHandleFrom ( portletContext , "<STR_LIT>" ) ; int index = handle . indexOf ( CLONE_SUFFIX ) ; if ( index != - <NUM_LIT:1> ) { handle = handle . substring ( <NUM_LIT:0> , index ) ; } MarkupBehavior markupBehaviorFor = registry . getMarkupBehaviorFor ( handle ) ; PortletDescription description = markupBehaviorFor . getPortletDescriptionFor ( handle ) ; if ( index != - <NUM_LIT:1> ) { description . setPortletHandle ( handle + CLONE_SUFFIX ) ; } portletDescription . value = description ; } @ Override public void clonePortlet ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) PortletContext portletContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) UserContext userContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Lifetime lifetime , @ 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 < Lifetime > scheduledDestruction , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < Extension > > extensions ) throws AccessDenied , InconsistentParameters , InvalidHandle , InvalidRegistration , InvalidUserCategory , MissingParameters , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended { String handle = getHandleFrom ( portletContext , "<STR_LIT>" ) ; if ( ! BasicMarkupBehavior . PORTLET_HANDLE . equals ( handle ) ) { throw WSRP2ExceptionFactory . throwWSException ( InvalidHandle . class , "<STR_LIT>" + BasicMarkupBehavior . PORTLET_HANDLE + "<STR_LIT:'>" , null ) ; } portletHandle . value = CLONED_HANDLE ; } @ Override public void destroyPortlets ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) List < String > portletHandles , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) UserContext userContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < FailedPortlets > > failedPortlets , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < Extension > > extensions ) throws InconsistentParameters , InvalidRegistration , MissingParameters , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended { super . destroyPortlets ( registrationContext , portletHandles , userContext , failedPortlets , extensions ) ; WSRP2ExceptionFactory . throwMissingParametersIfValueIsMissing ( portletHandles , "<STR_LIT>" , "<STR_LIT>" ) ; if ( portletHandles . isEmpty ( ) ) { WSRP2ExceptionFactory . throwMissingParametersIfValueIsMissing ( portletHandles , "<STR_LIT>" , "<STR_LIT>" ) ; } List < FailedPortlets > failedPortletsList = failedPortlets . value ; if ( failedPortletsList == null ) { failedPortletsList = new ArrayList < FailedPortlets > ( ) ; failedPortlets . value = failedPortletsList ; } for ( String handle : portletHandles ) { if ( ! CLONED_HANDLE . equals ( handle ) ) { ArrayList < String > failed = new ArrayList < String > ( ) ; failed . add ( handle ) ; failedPortletsList . add ( WSRPTypeFactory . createFailedPortlets ( failed , ErrorCodes . Codes . OPERATIONFAILED , "<STR_LIT>" + handle + "<STR_LIT>" ) ) ; } } } @ Override public void getPortletsLifetime ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) List < PortletContext > portletContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) UserContext userContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < PortletLifetime > > portletLifetime , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < FailedPortlets > > failedPortlets , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < ResourceList > resourceList , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < Extension > > extensions ) throws AccessDenied , InconsistentParameters , InvalidHandle , InvalidRegistration , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended { throw new NotYetImplemented ( ) ; } @ Override public void setPortletsLifetime ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) List < PortletContext > portletContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) UserContext userContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Lifetime lifetime , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < PortletLifetime > > updatedPortlet , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < FailedPortlets > > failedPortlets , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < ResourceList > resourceList , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < Extension > > extensions ) throws AccessDenied , InconsistentParameters , InvalidHandle , InvalidRegistration , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended { throw new NotYetImplemented ( ) ; } @ Override public void copyPortlets ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationContext toRegistrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) UserContext toUserContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationContext fromRegistrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) UserContext fromUserContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) List < PortletContext > fromPortletContexts , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Lifetime lifetime , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < CopiedPortlet > > copiedPortlets , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < FailedPortlets > > failedPortlets , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < ResourceList > resourceList , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < Extension > > extensions ) throws AccessDenied , InconsistentParameters , InvalidHandle , InvalidRegistration , InvalidUserCategory , MissingParameters , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended { throw new NotYetImplemented ( ) ; } @ Override public void exportPortlets ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) List < PortletContext > portletContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) UserContext userContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . INOUT ) Holder < Lifetime > lifetime , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Boolean exportByValueRequired , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < byte [ ] > exportContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < ExportedPortlet > > exportedPortlet , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < FailedPortlets > > failedPortlets , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < ResourceList > resourceList , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < Extension > > extensions ) throws AccessDenied , ExportByValueNotSupported , InconsistentParameters , InvalidHandle , InvalidRegistration , InvalidUserCategory , MissingParameters , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended { List < String > failedPortletHandles = new ArrayList < String > ( ) ; for ( PortletContext context : portletContext ) { String portletHandle = context . getPortletHandle ( ) ; if ( BasicMarkupBehavior . PORTLET_HANDLE . equals ( portletHandle ) ) { exportedPortlet . value = new ArrayList < ExportedPortlet > ( ) ; exportedPortlet . value . add ( WSRPTypeFactory . createExportedPortlet ( BasicMarkupBehavior . PORTLET_HANDLE , new byte [ ] { <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:4> } ) ) ; } else { failedPortletHandles . add ( portletHandle ) ; } } if ( ! failedPortletHandles . isEmpty ( ) ) { failedPortlets . value = new ArrayList < FailedPortlets > ( ) ; failedPortlets . value . add ( WSRPTypeFactory . createFailedPortlets ( failedPortletHandles , ErrorCodes . Codes . INVALIDHANDLE , "<STR_LIT>" ) ) ; } } @ Override public void importPortlets ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) byte [ ] importContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) List < ImportPortlet > importPortlet , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) UserContext userContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Lifetime lifetime , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < ImportedPortlet > > importedPortlets , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < ImportPortletsFailed > > importFailed , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < ResourceList > resourceList , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < Extension > > extensions ) throws AccessDenied , ExportNoLongerValid , InconsistentParameters , InvalidRegistration , InvalidUserCategory , MissingParameters , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended { throw new NotYetImplemented ( ) ; } @ Override public List < Extension > releaseExport ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) byte [ ] exportContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) UserContext userContext ) { throw new NotYetImplemented ( ) ; } @ Override public Lifetime setExportLifetime ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , partName = "<STR_LIT>" ) SetExportLifetime setExportLifetime ) throws AccessDenied , InvalidHandle , InvalidRegistration , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended { throw new NotYetImplemented ( ) ; } @ Override public void setPortletProperties ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) PortletContext portletContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) UserContext userContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) PropertyList 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 < Lifetime > scheduledDestruction , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < Extension > > extensions ) throws AccessDenied , InconsistentParameters , InvalidHandle , InvalidRegistration , InvalidUserCategory , MissingParameters , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended { String handle = getHandleFrom ( portletContext , "<STR_LIT>" ) ; if ( ! ( CLONED_HANDLE ) . equals ( handle ) ) { throw WSRP2ExceptionFactory . throwWSException ( OperationFailed . class , "<STR_LIT>" + handle + "<STR_LIT:'>" , null ) ; } List < Property > properties = propertyList . getProperties ( ) ; List < ResetProperty > resetProperties = propertyList . getResetProperties ( ) ; if ( ParameterValidation . existsAndIsNotEmpty ( properties ) && ParameterValidation . existsAndIsNotEmpty ( resetProperties ) ) { if ( properties . size ( ) != <NUM_LIT:1> && resetProperties . size ( ) != <NUM_LIT:1> ) { WSRP2ExceptionFactory . throwWSException ( InconsistentParameters . class , "<STR_LIT>" , null ) ; } if ( properties . get ( <NUM_LIT:0> ) . getName ( ) . equals ( resetProperties . get ( <NUM_LIT:0> ) . getName ( ) ) ) { WSRP2ExceptionFactory . throwWSException ( InconsistentParameters . class , CANNOT_BOTH_SET_AND_RESET_A_PROPERTY_AT_THE_SAME_TIME , null ) ; } } if ( ParameterValidation . existsAndIsNotEmpty ( properties ) ) { if ( properties . size ( ) != <NUM_LIT:1> ) { WSRP2ExceptionFactory . throwWSException ( InconsistentParameters . class , "<STR_LIT>" , null ) ; } Property property = properties . get ( <NUM_LIT:0> ) ; QName name = property . getName ( ) ; if ( name . getLocalPart ( ) . equals ( PROPERTY_NAME ) ) { propValue = property . getStringValue ( ) ; } else { WSRP2ExceptionFactory . throwWSException ( InconsistentParameters . class , "<STR_LIT>" + name + "<STR_LIT:'>" , null ) ; } } if ( ParameterValidation . existsAndIsNotEmpty ( resetProperties ) ) { if ( resetProperties . size ( ) != <NUM_LIT:1> ) { WSRP2ExceptionFactory . throwWSException ( InconsistentParameters . class , "<STR_LIT>" , null ) ; } ResetProperty resetProperty = resetProperties . get ( <NUM_LIT:0> ) ; QName name = resetProperty . getName ( ) ; if ( name . getLocalPart ( ) . equals ( PROPERTY_NAME ) ) { propValue = PROPERTY_VALUE ; } else { WSRP2ExceptionFactory . throwWSException ( InconsistentParameters . class , "<STR_LIT>" + name + "<STR_LIT:'>" , null ) ; } } portletHandle . value = handle ; } @ Override public void getPortletProperties ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) PortletContext portletContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) UserContext userContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) List < String > names , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < Property > > properties , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < ResetProperty > > resetProperties , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < Extension > > extensions ) throws AccessDenied , InconsistentParameters , InvalidHandle , InvalidRegistration , InvalidUserCategory , MissingParameters , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended { String handle = getHandleFrom ( portletContext , "<STR_LIT>" ) ; List < Property > propertyList = new ArrayList < Property > ( <NUM_LIT:1> ) ; if ( BasicMarkupBehavior . PORTLET_HANDLE . equals ( handle ) ) { propertyList . add ( WSRPTypeFactory . createProperty ( PROPERTY_NAME , "<STR_LIT:en>" , PROPERTY_VALUE ) ) ; } else if ( CLONED_HANDLE . equals ( handle ) ) { if ( propValue != null ) { propertyList . add ( WSRPTypeFactory . createProperty ( PROPERTY_NAME , "<STR_LIT:en>" , propValue ) ) ; } if ( callCount > <NUM_LIT:4> ) { throw new IllegalStateException ( "<STR_LIT>" ) ; } } else { WSRP2ExceptionFactory . throwWSException ( InvalidHandle . class , "<STR_LIT>" + handle + "<STR_LIT:'>" , null ) ; } incrementCallCount ( ) ; properties . value = propertyList ; } private String getHandleFrom ( PortletContext portletContext , String context ) throws MissingParameters , InvalidHandle { WSRP2ExceptionFactory . throwMissingParametersIfValueIsMissing ( portletContext , "<STR_LIT>" , context ) ; String handle = portletContext . getPortletHandle ( ) ; WSRP2ExceptionFactory . throwMissingParametersIfValueIsMissing ( handle , "<STR_LIT>" , "<STR_LIT>" ) ; if ( handle . length ( ) == <NUM_LIT:0> ) { throw WSRP2ExceptionFactory . throwWSException ( InvalidHandle . class , "<STR_LIT>" , null ) ; } return handle ; } } </s>
|
<s> package org . gatein . wsrp . test . protocol . v2 . behaviors ; import org . gatein . wsrp . spec . v2 . WSRP2ExceptionFactory ; import org . gatein . wsrp . test . protocol . v2 . BehaviorRegistry ; import org . oasis . wsrp . v2 . AccessDenied ; import org . oasis . wsrp . v2 . Extension ; import org . oasis . wsrp . v2 . InvalidRegistration ; import org . oasis . wsrp . v2 . ModifyRegistrationRequired ; import org . oasis . wsrp . v2 . OperationFailed ; import org . oasis . wsrp . v2 . OperationNotSupported ; import org . oasis . wsrp . v2 . RegistrationContext ; import org . oasis . wsrp . v2 . ResourceSuspended ; import org . oasis . wsrp . v2 . UserContext ; import javax . jws . WebParam ; import java . util . List ; public class PerGroupInitCookieMarkupBehavior extends InitCookieMarkupBehavior { public static final String PER_GROUP_INIT_COOKIE_HANDLE = "<STR_LIT>" ; public PerGroupInitCookieMarkupBehavior ( BehaviorRegistry registry ) { super ( registry ) ; } protected void initPortletHandle ( ) { portletHandle = PER_GROUP_INIT_COOKIE_HANDLE ; } @ Override public List < Extension > initCookie ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) UserContext userContext ) throws AccessDenied , InvalidRegistration , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended { List < Extension > extensions = super . initCookie ( registrationContext , userContext ) ; if ( initCookieCallCount > <NUM_LIT:3> ) { throw WSRP2ExceptionFactory . throwWSException ( OperationFailed . class , "<STR_LIT>" , new IllegalStateException ( "<STR_LIT>" ) ) ; } return extensions ; } } </s>
|
<s> package org . gatein . wsrp . test . protocol . v2 . behaviors ; import org . gatein . pc . api . Mode ; import org . gatein . pc . api . WindowState ; import org . gatein . wsrp . test . protocol . v2 . BehaviorRegistry ; import org . gatein . wsrp . test . protocol . v2 . MarkupBehavior ; import org . oasis . wsrp . v2 . GetMarkup ; public class ResourceMarkupBehavior extends MarkupBehavior { public static final String PORTLET_HANDLE = "<STR_LIT>" ; public ResourceMarkupBehavior ( BehaviorRegistry registry ) { super ( registry ) ; registerHandle ( PORTLET_HANDLE ) ; } protected String getMarkupString ( Mode mode , WindowState windowState , String navigationalState , GetMarkup getMarkup ) { return "<STR_LIT>" + "<STR_LIT>" ; } } </s>
|
<s> package org . gatein . wsrp . test . protocol . v2 . behaviors ; import org . gatein . pc . api . Mode ; import org . gatein . pc . api . WindowState ; import org . gatein . wsrp . test . protocol . v2 . BehaviorRegistry ; import org . gatein . wsrp . test . protocol . v2 . MarkupBehavior ; import org . oasis . wsrp . v2 . GetMarkup ; public class NullMarkupBehavior extends MarkupBehavior { public static final String PORTLET_HANDLE = "<STR_LIT>" ; public NullMarkupBehavior ( BehaviorRegistry registry ) { super ( registry ) ; registerHandle ( PORTLET_HANDLE ) ; } public String getMarkupString ( Mode mode , WindowState windowState , String navigationalState , GetMarkup getMarkup ) { return null ; } } </s>
|
<s> package org . gatein . wsrp . test . protocol . v2 . behaviors ; import org . gatein . pc . api . Mode ; import org . gatein . pc . api . OpaqueStateString ; import org . gatein . pc . api . WindowState ; import org . gatein . wsrp . WSRPTypeFactory ; import org . gatein . wsrp . test . protocol . v2 . BehaviorRegistry ; import org . gatein . wsrp . test . protocol . v2 . MarkupBehavior ; import org . oasis . wsrp . v2 . AccessDenied ; import org . oasis . wsrp . v2 . Extension ; import org . oasis . wsrp . v2 . GetMarkup ; import org . oasis . wsrp . v2 . InconsistentParameters ; import org . oasis . wsrp . v2 . InteractionParams ; import org . oasis . wsrp . v2 . InvalidCookie ; import org . oasis . wsrp . v2 . InvalidHandle ; import org . oasis . wsrp . v2 . InvalidRegistration ; import org . oasis . wsrp . v2 . InvalidSession ; import org . oasis . wsrp . v2 . InvalidUserCategory ; import org . oasis . wsrp . v2 . MarkupParams ; import org . oasis . wsrp . v2 . MarkupResponse ; import org . oasis . wsrp . v2 . MissingParameters ; import org . oasis . wsrp . v2 . ModifyRegistrationRequired ; import org . oasis . wsrp . v2 . OperationFailed ; import org . oasis . wsrp . v2 . PortletContext ; import org . oasis . wsrp . v2 . PortletStateChangeRequired ; import org . oasis . wsrp . v2 . RegistrationContext ; import org . oasis . wsrp . v2 . ResourceSuspended ; import org . oasis . wsrp . v2 . RuntimeContext ; import org . oasis . wsrp . v2 . SessionContext ; import org . oasis . wsrp . v2 . SessionParams ; import org . oasis . wsrp . v2 . UnsupportedLocale ; import org . oasis . wsrp . v2 . UnsupportedMimeType ; import org . oasis . wsrp . v2 . UnsupportedMode ; import org . oasis . wsrp . v2 . UnsupportedWindowState ; import org . oasis . wsrp . v2 . UpdateResponse ; import org . oasis . wsrp . v2 . UserContext ; import javax . jws . WebParam ; import javax . xml . ws . Holder ; import java . util . List ; public class SessionMarkupBehavior extends MarkupBehavior { public static final String PORTLET_HANDLE = "<STR_LIT>" ; public static final String SESSION_ID = "<STR_LIT>" ; public static final String NS = "<STR_LIT>" ; private int count = <NUM_LIT:0> ; private String sessionId ; public SessionMarkupBehavior ( BehaviorRegistry registry ) { super ( registry ) ; registerHandle ( PORTLET_HANDLE ) ; } public String getMarkupString ( Mode mode , WindowState windowState , String navigationalState , GetMarkup getMarkup ) { StringBuffer markupString = new StringBuffer ( "<STR_LIT>" ) ; SessionParams sessionParams = getMarkup . getRuntimeContext ( ) . getSessionParams ( ) ; if ( sessionParams != null ) { sessionId = sessionParams . getSessionID ( ) ; } else { sessionId = null ; } if ( SESSION_ID . equals ( sessionId ) ) { count ++ ; } markupString . append ( count ) . append ( "<STR_LIT::>" ) ; markupString . append ( mode ) . append ( "<STR_LIT::>" ) . append ( windowState ) ; if ( navigationalState != null ) { markupString . append ( "<STR_LIT::>" ) . append ( navigationalState ) ; } return markupString . toString ( ) ; } @ Override public void performBlockingInteraction ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) PortletContext portletContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RuntimeContext runtimeContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) UserContext userContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) MarkupParams markupParams , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) InteractionParams interactionParams , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < UpdateResponse > 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 < Extension > > extensions ) throws AccessDenied , InconsistentParameters , InvalidCookie , InvalidHandle , InvalidRegistration , InvalidSession , InvalidUserCategory , MissingParameters , ModifyRegistrationRequired , OperationFailed , PortletStateChangeRequired , ResourceSuspended , UnsupportedLocale , UnsupportedMimeType , UnsupportedMode , UnsupportedWindowState { UpdateResponse ur = WSRPTypeFactory . createUpdateResponse ( ) ; ur . setNavigationalContext ( WSRPTypeFactory . createNavigationalContextOrNull ( new OpaqueStateString ( NS ) , null ) ) ; updateResponse . value = ur ; extensions . value = ur . getExtensions ( ) ; } public void modifyResponseIfNeeded ( MarkupResponse markupResponse ) { if ( count == <NUM_LIT:0> || SESSION_ID . equals ( sessionId ) ) { SessionContext sessionContext = WSRPTypeFactory . createSessionContext ( SESSION_ID , <NUM_LIT:30> ) ; markupResponse . setSessionContext ( sessionContext ) ; } } protected String getSuffixFor ( String handle ) { return "<STR_LIT:2>" ; } } </s>
|
<s> package org . gatein . wsrp . test . protocol . v2 . behaviors ; import org . gatein . wsrp . spec . v2 . WSRP2ExceptionFactory ; import org . gatein . wsrp . test . protocol . v2 . BehaviorRegistry ; import org . oasis . wsrp . v2 . AccessDenied ; import org . oasis . wsrp . v2 . Extension ; import org . oasis . wsrp . v2 . InvalidRegistration ; import org . oasis . wsrp . v2 . ModifyRegistrationRequired ; import org . oasis . wsrp . v2 . OperationFailed ; import org . oasis . wsrp . v2 . OperationNotSupported ; import org . oasis . wsrp . v2 . RegistrationContext ; import org . oasis . wsrp . v2 . ResourceSuspended ; import org . oasis . wsrp . v2 . UserContext ; import javax . jws . WebParam ; import java . util . List ; public class InitCookieNotRequiredMarkupBehavior extends InitCookieMarkupBehavior { public static final String INIT_COOKIE_NOT_REQUIRED_HANDLE = "<STR_LIT>" ; public InitCookieNotRequiredMarkupBehavior ( BehaviorRegistry registry ) { super ( registry ) ; } protected void initPortletHandle ( ) { portletHandle = INIT_COOKIE_NOT_REQUIRED_HANDLE ; } @ Override protected String getMarkupString ( String handle ) { return handle ; } @ Override public List < Extension > initCookie ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) UserContext userContext ) throws AccessDenied , InvalidRegistration , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended { super . initCookie ( registrationContext , userContext ) ; throw WSRP2ExceptionFactory . throwWSException ( OperationFailed . class , "<STR_LIT>" , null ) ; } } </s>
|
<s> package org . gatein . wsrp . test . protocol . v2 . behaviors ; import org . gatein . pc . api . Mode ; import org . gatein . pc . api . WindowState ; import org . gatein . wsrp . spec . v2 . WSRP2ExceptionFactory ; import org . gatein . wsrp . test . protocol . v2 . BehaviorRegistry ; import org . gatein . wsrp . test . protocol . v2 . MarkupBehavior ; import org . oasis . wsrp . v2 . AccessDenied ; import org . oasis . wsrp . v2 . Extension ; import org . oasis . wsrp . v2 . GetMarkup ; import org . oasis . wsrp . v2 . InvalidCookie ; import org . oasis . wsrp . v2 . InvalidRegistration ; import org . oasis . wsrp . v2 . ModifyRegistrationRequired ; import org . oasis . wsrp . v2 . OperationFailed ; import org . oasis . wsrp . v2 . OperationNotSupported ; import org . oasis . wsrp . v2 . RegistrationContext ; import org . oasis . wsrp . v2 . ResourceSuspended ; import org . oasis . wsrp . v2 . UserContext ; import javax . jws . WebParam ; import java . util . List ; public abstract class InitCookieMarkupBehavior extends MarkupBehavior { protected String portletHandle ; protected int initCookieCallCount ; private boolean initCookieCalled = false ; public InitCookieMarkupBehavior ( BehaviorRegistry registry ) { super ( registry ) ; initPortletHandle ( ) ; registerHandle ( portletHandle ) ; } protected abstract void initPortletHandle ( ) ; protected String getMarkupString ( Mode mode , WindowState windowState , String navigationalState , GetMarkup getMarkup ) throws OperationFailed , InvalidCookie { if ( ! initCookieCalled ) { throw new IllegalStateException ( "<STR_LIT>" ) ; } String handle = getMarkup . getPortletContext ( ) . getPortletHandle ( ) ; if ( portletHandle . equals ( handle ) ) { return getMarkupString ( handle ) ; } throw WSRP2ExceptionFactory . throwWSException ( OperationFailed . class , "<STR_LIT>" , null ) ; } protected String getMarkupString ( String handle ) throws InvalidCookie , OperationFailed { switch ( callCount ++ ) { case <NUM_LIT:0> : throw WSRP2ExceptionFactory . throwWSException ( InvalidCookie . class , "<STR_LIT>" , null ) ; case <NUM_LIT:1> : return handle ; default : throw WSRP2ExceptionFactory . throwWSException ( OperationFailed . class , "<STR_LIT>" , null ) ; } } @ Override public List < Extension > initCookie ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) UserContext userContext ) throws AccessDenied , InvalidRegistration , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended { initCookieCalled = true ; initCookieCallCount ++ ; return null ; } public int getInitCookieCallCount ( ) { return initCookieCallCount ; } } </s>
|
<s> package org . gatein . wsrp . test . protocol . v2 . behaviors ; import org . gatein . wsrp . test . protocol . v2 . ServiceDescriptionBehavior ; import org . oasis . wsrp . v2 . PortletDescription ; public class BasicServiceDescriptionBehavior extends ServiceDescriptionBehavior { public BasicServiceDescriptionBehavior ( ) { PortletDescription pd1 = createPortletDescription ( BasicMarkupBehavior . PORTLET_HANDLE , "<STR_LIT>" ) ; PortletDescription pd2 = createPortletDescription ( SessionMarkupBehavior . PORTLET_HANDLE , "<STR_LIT:2>" ) ; offeredPortlets . add ( pd1 ) ; offeredPortlets . add ( pd2 ) ; } } </s>
|
<s> package org . gatein . wsrp . test . protocol . v2 ; import org . gatein . common . NotYetImplemented ; import org . gatein . common . util . Version ; import org . gatein . pc . api . Mode ; import org . gatein . pc . api . WindowState ; import org . gatein . wsrp . services . MarkupService ; import org . gatein . wsrp . services . PortletManagementService ; import org . gatein . wsrp . services . RegistrationService ; import org . gatein . wsrp . services . ServiceDescriptionService ; import org . gatein . wsrp . services . ServiceFactory ; import org . gatein . wsrp . services . v2 . V2MarkupService ; import org . gatein . wsrp . services . v2 . V2PortletManagementService ; import org . gatein . wsrp . services . v2 . V2RegistrationService ; import org . gatein . wsrp . services . v2 . V2ServiceDescriptionService ; import org . gatein . wsrp . test . support . RequestedMarkupBehavior ; import org . oasis . wsrp . v2 . AccessDenied ; import org . oasis . wsrp . v2 . GetMarkup ; import org . oasis . wsrp . v2 . InconsistentParameters ; import org . oasis . wsrp . v2 . InvalidCookie ; import org . oasis . wsrp . v2 . InvalidHandle ; import org . oasis . wsrp . v2 . InvalidRegistration ; import org . oasis . wsrp . v2 . InvalidSession ; import org . oasis . wsrp . v2 . InvalidUserCategory ; import org . oasis . wsrp . v2 . MissingParameters ; import org . oasis . wsrp . v2 . OperationFailed ; import org . oasis . wsrp . v2 . UnsupportedLocale ; import org . oasis . wsrp . v2 . UnsupportedMimeType ; import org . oasis . wsrp . v2 . UnsupportedMode ; import org . oasis . wsrp . v2 . UnsupportedWindowState ; import org . oasis . wsrp . v2 . WSRPV2MarkupPortType ; import org . oasis . wsrp . v2 . WSRPV2PortletManagementPortType ; import org . oasis . wsrp . v2 . WSRPV2RegistrationPortType ; import org . oasis . wsrp . v2 . WSRPV2ServiceDescriptionPortType ; public class BehaviorBackedServiceFactory implements ServiceFactory { private BehaviorRegistry registry ; private final static String MARKUP = "<STR_LIT>" ; private boolean initialized = false ; private String wsdl = DEFAULT_WSDL_URL ; public static final String DEFAULT_WSDL_URL = "<STR_LIT>" ; private int timeout = DEFAULT_TIMEOUT_MS ; private boolean failed = false ; public BehaviorBackedServiceFactory ( ) { this ( new BehaviorRegistry ( ) ) ; } public BehaviorBackedServiceFactory ( BehaviorRegistry registry ) { this . registry = registry ; registry . registerMarkupBehavior ( new SimpleMarkupBehavior ( ) ) ; } public < T > T getService ( Class < T > serviceClass ) throws Exception { if ( ! isAvailable ( ) && ! isFailed ( ) ) { start ( ) ; } if ( WSRPV2ServiceDescriptionPortType . class . isAssignableFrom ( serviceClass ) ) { return ( T ) registry . getServiceDescriptionBehavior ( ) ; } if ( WSRPV2MarkupPortType . class . isAssignableFrom ( serviceClass ) ) { String requestedMarkupBehavior = RequestedMarkupBehavior . getRequestedMarkupBehavior ( ) ; if ( requestedMarkupBehavior == null ) { requestedMarkupBehavior = MARKUP ; } return ( T ) registry . getMarkupBehaviorFor ( requestedMarkupBehavior ) ; } if ( WSRPV2PortletManagementPortType . class . isAssignableFrom ( serviceClass ) ) { return ( T ) registry . getPortletManagementBehavior ( ) ; } if ( WSRPV2RegistrationPortType . class . isAssignableFrom ( serviceClass ) ) { return ( T ) registry . getRegistrationBehavior ( ) ; } return null ; } public ServiceDescriptionService getServiceDescriptionService ( ) throws Exception { return new V2ServiceDescriptionService ( getService ( WSRPV2ServiceDescriptionPortType . class ) ) ; } public MarkupService getMarkupService ( ) throws Exception { return new V2MarkupService ( getService ( WSRPV2MarkupPortType . class ) ) ; } public PortletManagementService getPortletManagementService ( ) throws Exception { return new V2PortletManagementService ( getService ( WSRPV2PortletManagementPortType . class ) ) ; } public RegistrationService getRegistrationService ( ) throws Exception { return new V2RegistrationService ( getService ( WSRPV2RegistrationPortType . class ) ) ; } public Version getWSRPVersion ( ) { return ServiceFactory . WSRP2 ; } public boolean refresh ( boolean force ) throws Exception { if ( force || ( ! isAvailable ( ) && ! isFailed ( ) ) ) { start ( ) ; return true ; } return false ; } public BehaviorRegistry getRegistry ( ) { return registry ; } public void setRegistry ( BehaviorRegistry registry ) { this . registry = registry ; } public boolean isAvailable ( ) { return initialized ; } public boolean isFailed ( ) { return failed ; } public void setFailed ( boolean failed ) { this . failed = failed ; } public void setWSOperationTimeOut ( int msBeforeTimeOut ) { if ( msBeforeTimeOut < <NUM_LIT:0> ) { msBeforeTimeOut = DEFAULT_TIMEOUT_MS ; } timeout = msBeforeTimeOut ; } public int getWSOperationTimeOut ( ) { return timeout ; } public void create ( ) throws Exception { throw new NotYetImplemented ( ) ; } public void start ( ) throws Exception { if ( failed ) { throw new RuntimeException ( "<STR_LIT>" ) ; } initialized = true ; } public void stop ( ) { throw new NotYetImplemented ( ) ; } public void setWsdlDefinitionURL ( String wsdlDefinitionURL ) { wsdl = wsdlDefinitionURL ; } public String getWsdlDefinitionURL ( ) { return wsdl ; } public void destroy ( ) { throw new NotYetImplemented ( ) ; } private class SimpleMarkupBehavior extends MarkupBehavior { public SimpleMarkupBehavior ( ) { super ( BehaviorBackedServiceFactory . this . registry ) ; registerHandle ( MARKUP ) ; } @ Override protected String getMarkupString ( Mode mode , WindowState windowState , String navigationalState , GetMarkup getMarkup ) throws UnsupportedWindowState , InvalidCookie , InvalidSession , AccessDenied , InconsistentParameters , InvalidHandle , UnsupportedLocale , UnsupportedMode , OperationFailed , MissingParameters , InvalidUserCategory , InvalidRegistration , UnsupportedMimeType { return MARKUP ; } } public void enableWSS ( boolean enable ) { } public boolean isWSSEnabled ( ) { return false ; } public boolean isWSSAvailable ( ) { return false ; } } </s>
|
<s> package org . gatein . wsrp . test . protocol . v2 ; import org . gatein . common . NotYetImplemented ; import org . gatein . common . net . media . MediaType ; import org . gatein . pc . api . Mode ; import org . gatein . pc . api . WindowState ; import org . gatein . wsrp . WSRPTypeFactory ; import org . gatein . wsrp . WSRPUtils ; import org . oasis . wsrp . v2 . AccessDenied ; import org . oasis . wsrp . v2 . EventParams ; import org . oasis . wsrp . v2 . Extension ; import org . oasis . wsrp . v2 . GetMarkup ; import org . oasis . wsrp . v2 . HandleEventsFailed ; import org . oasis . wsrp . v2 . InconsistentParameters ; import org . oasis . wsrp . v2 . InteractionParams ; import org . oasis . wsrp . v2 . InvalidCookie ; import org . oasis . wsrp . v2 . InvalidHandle ; import org . oasis . wsrp . v2 . InvalidRegistration ; import org . oasis . wsrp . v2 . InvalidSession ; import org . oasis . wsrp . v2 . InvalidUserCategory ; import org . oasis . wsrp . v2 . MarkupContext ; import org . oasis . wsrp . v2 . MarkupParams ; import org . oasis . wsrp . v2 . MarkupResponse ; import org . oasis . wsrp . v2 . MissingParameters ; import org . oasis . wsrp . v2 . ModifyRegistrationRequired ; import org . oasis . wsrp . v2 . NavigationalContext ; import org . oasis . wsrp . v2 . OperationFailed ; import org . oasis . wsrp . v2 . OperationNotSupported ; import org . oasis . wsrp . v2 . PortletContext ; import org . oasis . wsrp . v2 . PortletDescription ; import org . oasis . wsrp . v2 . PortletStateChangeRequired ; import org . oasis . wsrp . v2 . RegistrationContext ; import org . oasis . wsrp . v2 . ResourceContext ; import org . oasis . wsrp . v2 . ResourceParams ; import org . oasis . wsrp . v2 . ResourceSuspended ; import org . oasis . wsrp . v2 . RuntimeContext ; import org . oasis . wsrp . v2 . SessionContext ; import org . oasis . wsrp . v2 . UnsupportedLocale ; import org . oasis . wsrp . v2 . UnsupportedMimeType ; import org . oasis . wsrp . v2 . UnsupportedMode ; import org . oasis . wsrp . v2 . UnsupportedWindowState ; import org . oasis . wsrp . v2 . UpdateResponse ; import org . oasis . wsrp . v2 . UserContext ; import org . oasis . wsrp . v2 . WSRPV2MarkupPortType ; import javax . jws . WebParam ; import javax . xml . ws . Holder ; import java . util . ArrayList ; import java . util . List ; public abstract class MarkupBehavior extends TestProducerBehavior implements WSRPV2MarkupPortType { private List < String > handles = new ArrayList < String > ( <NUM_LIT:3> ) ; private BehaviorRegistry registry ; protected MarkupBehavior ( BehaviorRegistry registry ) { this . registry = registry ; } protected abstract String getMarkupString ( Mode mode , WindowState windowState , String navigationalState , GetMarkup getMarkup ) throws UnsupportedWindowState , InvalidCookie , InvalidSession , AccessDenied , InconsistentParameters , InvalidHandle , UnsupportedLocale , UnsupportedMode , OperationFailed , MissingParameters , InvalidUserCategory , InvalidRegistration , UnsupportedMimeType ; public void modifyResponseIfNeeded ( MarkupResponse markupResponse ) { } public List < String > getSupportedHandles ( ) { return handles ; } public PortletDescription getPortletDescriptionFor ( String handle ) { if ( handles . contains ( handle ) ) { return createPortletDescription ( handle , getSuffixFor ( handle ) ) ; } throw new IllegalArgumentException ( "<STR_LIT>" + getClass ( ) . getName ( ) + "<STR_LIT>" + handle + "<STR_LIT:'>" ) ; } protected String getSuffixFor ( String handle ) { return "<STR_LIT>" ; } protected void registerHandle ( String handle ) { handles . add ( handle ) ; registry . getServiceDescriptionBehavior ( ) . addPortletDescription ( createPortletDescription ( handle , getSuffixFor ( handle ) ) ) ; } public void getResource ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . INOUT ) Holder < PortletContext > portletContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RuntimeContext runtimeContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) UserContext userContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) ResourceParams resourceParams , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < ResourceContext > resourceContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < SessionContext > sessionContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < Extension > > extensions ) throws AccessDenied , InconsistentParameters , InvalidCookie , InvalidHandle , InvalidRegistration , InvalidSession , InvalidUserCategory , MissingParameters , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended , UnsupportedLocale , UnsupportedMimeType , UnsupportedMode , UnsupportedWindowState { throw new NotYetImplemented ( ) ; } public void performBlockingInteraction ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) PortletContext portletContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RuntimeContext runtimeContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) UserContext userContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) MarkupParams markupParams , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) InteractionParams interactionParams , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < UpdateResponse > 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 < Extension > > extensions ) throws AccessDenied , InconsistentParameters , InvalidCookie , InvalidHandle , InvalidRegistration , InvalidSession , InvalidUserCategory , MissingParameters , ModifyRegistrationRequired , OperationFailed , PortletStateChangeRequired , ResourceSuspended , UnsupportedLocale , UnsupportedMimeType , UnsupportedMode , UnsupportedWindowState { } public void handleEvents ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) PortletContext portletContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RuntimeContext runtimeContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) UserContext userContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) MarkupParams markupParams , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) EventParams eventParams , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < UpdateResponse > updateResponse , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < HandleEventsFailed > > failedEvents , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < Extension > > extensions ) throws AccessDenied , InconsistentParameters , InvalidCookie , InvalidHandle , InvalidRegistration , InvalidSession , InvalidUserCategory , MissingParameters , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , PortletStateChangeRequired , ResourceSuspended , UnsupportedLocale , UnsupportedMimeType , UnsupportedMode , UnsupportedWindowState { throw new NotYetImplemented ( ) ; } public List < Extension > releaseSessions ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) List < String > sessionIDs , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) UserContext userContext ) throws AccessDenied , InvalidRegistration , MissingParameters , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended { throw new NotYetImplemented ( ) ; } public void getMarkup ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) PortletContext portletContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RuntimeContext runtimeContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) UserContext userContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) MarkupParams markupParams , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < MarkupContext > markupContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < SessionContext > sessionContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < Extension > > extensions ) throws AccessDenied , InconsistentParameters , InvalidCookie , InvalidHandle , InvalidRegistration , InvalidSession , InvalidUserCategory , MissingParameters , ModifyRegistrationRequired , OperationFailed , ResourceSuspended , UnsupportedLocale , UnsupportedMimeType , UnsupportedMode , UnsupportedWindowState { GetMarkup gm = WSRPTypeFactory . createGetMarkup ( registrationContext , portletContext , runtimeContext , userContext , markupParams ) ; NavigationalContext navigationalContext = markupParams . getNavigationalContext ( ) ; String markupString = getMarkupString ( WSRPUtils . getJSR168PortletModeFromWSRPName ( markupParams . getMode ( ) ) , WSRPUtils . getJSR168WindowStateFromWSRPName ( markupParams . getWindowState ( ) ) , navigationalContext != null ? navigationalContext . getOpaqueValue ( ) : null , gm ) ; markupContext . value = WSRPTypeFactory . createMarkupContext ( MediaType . TEXT_HTML . getValue ( ) , markupString , null , null ) ; markupContext . value . setRequiresRewriting ( Boolean . TRUE ) ; MarkupResponse markupResponse = WSRPTypeFactory . createMarkupResponse ( markupContext . value ) ; modifyResponseIfNeeded ( markupResponse ) ; markupContext . value = markupResponse . getMarkupContext ( ) ; sessionContext . value = markupResponse . getSessionContext ( ) ; extensions . value = markupResponse . getExtensions ( ) ; } public List < Extension > initCookie ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) UserContext userContext ) throws AccessDenied , InvalidRegistration , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended { return null ; } } </s>
|
<s> package org . gatein . wsrp . test . protocol . v2 ; import org . gatein . common . NotYetImplemented ; import org . oasis . wsrp . v2 . AccessDenied ; import org . oasis . wsrp . v2 . Extension ; import org . oasis . wsrp . v2 . GetRegistrationLifetime ; import org . oasis . wsrp . v2 . InvalidHandle ; import org . oasis . wsrp . v2 . InvalidRegistration ; import org . oasis . wsrp . v2 . Lifetime ; import org . oasis . wsrp . v2 . MissingParameters ; import org . oasis . wsrp . v2 . ModifyRegistrationRequired ; import org . oasis . wsrp . v2 . OperationFailed ; import org . oasis . wsrp . v2 . OperationNotSupported ; import org . oasis . wsrp . v2 . RegistrationContext ; import org . oasis . wsrp . v2 . RegistrationData ; import org . oasis . wsrp . v2 . ResourceSuspended ; import org . oasis . wsrp . v2 . SetRegistrationLifetime ; import org . oasis . wsrp . v2 . UserContext ; import org . oasis . wsrp . v2 . WSRPV2RegistrationPortType ; import javax . jws . WebParam ; import javax . xml . ws . Holder ; import java . util . List ; public class RegistrationBehavior extends TestProducerBehavior implements WSRPV2RegistrationPortType { public static final String REGISTRATION_HANDLE = "<STR_LIT>" ; public void register ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationData registrationData , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Lifetime lifetime , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) UserContext userContext , @ 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 < Lifetime > scheduledDestruction , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < Extension > > extensions , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < String > registrationHandle ) throws MissingParameters , OperationFailed , OperationNotSupported { incrementCallCount ( ) ; registrationHandle . value = REGISTRATION_HANDLE ; } public List < Extension > deregister ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) UserContext userContext ) throws InvalidRegistration , OperationFailed , OperationNotSupported , ResourceSuspended { incrementCallCount ( ) ; return null ; } public void modifyRegistration ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationData registrationData , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) UserContext userContext , @ 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 < Lifetime > scheduledDestruction , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < Extension > > extensions ) throws InvalidRegistration , MissingParameters , OperationFailed , OperationNotSupported , ResourceSuspended { incrementCallCount ( ) ; } public Lifetime getRegistrationLifetime ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , partName = "<STR_LIT>" ) GetRegistrationLifetime getRegistrationLifetime ) throws AccessDenied , InvalidHandle , InvalidRegistration , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended { throw new NotYetImplemented ( ) ; } public Lifetime setRegistrationLifetime ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , partName = "<STR_LIT>" ) SetRegistrationLifetime setRegistrationLifetime ) throws AccessDenied , InvalidHandle , InvalidRegistration , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended { throw new NotYetImplemented ( ) ; } } </s>
|
<s> package org . gatein . wsrp . test . protocol . v2 ; import org . gatein . wsrp . WSRPConstants ; import org . gatein . wsrp . WSRPTypeFactory ; import org . oasis . wsrp . v2 . CookieProtocol ; import org . oasis . wsrp . v2 . EventDescription ; import org . oasis . wsrp . v2 . ExportDescription ; import org . oasis . wsrp . v2 . Extension ; import org . oasis . wsrp . v2 . ExtensionDescription ; import org . oasis . wsrp . v2 . InvalidRegistration ; import org . oasis . wsrp . v2 . ItemDescription ; import org . oasis . wsrp . v2 . ModelDescription ; import org . oasis . wsrp . v2 . ModelTypes ; import org . oasis . wsrp . v2 . ModifyRegistrationRequired ; import org . oasis . wsrp . v2 . OperationFailed ; import org . oasis . wsrp . v2 . PortletDescription ; import org . oasis . wsrp . v2 . PropertyDescription ; import org . oasis . wsrp . v2 . RegistrationContext ; import org . oasis . wsrp . v2 . ResourceList ; import org . oasis . wsrp . v2 . ResourceSuspended ; import org . oasis . wsrp . v2 . ServiceDescription ; import org . oasis . wsrp . v2 . UserContext ; import org . oasis . wsrp . v2 . WSRPV2ServiceDescriptionPortType ; import javax . jws . WebParam ; import javax . xml . ws . Holder ; import java . util . ArrayList ; import java . util . HashSet ; import java . util . LinkedList ; import java . util . List ; import java . util . Set ; public class ServiceDescriptionBehavior extends TestProducerBehavior implements WSRPV2ServiceDescriptionPortType { protected ServiceDescription serviceDescription ; private static final ServiceDescription DEFAULT_SERVICE_DESCRIPTION = WSRPTypeFactory . createServiceDescription ( false ) ; public static final ServiceDescriptionBehavior DEFAULT = new ServiceDescriptionBehavior ( ) ; protected List < PortletDescription > offeredPortlets ; private boolean requiresRegistration ; private CookieProtocol cookieProtocol ; private ModelDescription registrationProperties ; public ServiceDescriptionBehavior ( ) { offeredPortlets = new LinkedList < PortletDescription > ( ) ; } public void setRequiresRegistration ( boolean requiresRegistration ) { this . requiresRegistration = requiresRegistration ; } public void setRequiresInitCookie ( CookieProtocol requiresInitCookie ) { this . cookieProtocol = requiresInitCookie ; } public void setServiceDescription ( boolean requiresRegistration , int numberOfProps ) { ServiceDescription sd = createServiceDescription ( requiresRegistration , numberOfProps ) ; offeredPortlets = sd . getOfferedPortlets ( ) ; this . requiresRegistration = sd . isRequiresRegistration ( ) ; registrationProperties = sd . getRegistrationPropertyDescription ( ) ; } public static ServiceDescription getDefaultServiceDescription ( ) { return DEFAULT_SERVICE_DESCRIPTION ; } public void addPortletDescription ( PortletDescription portletDescription ) { offeredPortlets . add ( portletDescription ) ; } public Set < String > getPortletHandles ( ) { Set < String > handles = new HashSet < String > ( offeredPortlets . size ( ) ) ; for ( PortletDescription description : offeredPortlets ) { handles . add ( description . getPortletHandle ( ) ) ; } return handles ; } public int getPortletNumber ( ) { return offeredPortlets . size ( ) ; } public static ServiceDescription createServiceDescription ( boolean requiresRegistration , int numberOfProperties ) { ServiceDescription sd = WSRPTypeFactory . createServiceDescription ( requiresRegistration ) ; if ( requiresRegistration ) { List < PropertyDescription > descriptions = new ArrayList < PropertyDescription > ( numberOfProperties ) ; for ( int i = <NUM_LIT:0> ; i < numberOfProperties ; i ++ ) { descriptions . add ( WSRPTypeFactory . createPropertyDescription ( "<STR_LIT>" + i , WSRPConstants . XSD_STRING ) ) ; } sd . setRegistrationPropertyDescription ( WSRPTypeFactory . createModelDescription ( descriptions ) ) ; } return sd ; } public void getServiceDescription ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) List < String > desiredLocales , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) List < String > portletHandles , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) UserContext userContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < Boolean > requiresRegistration , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < PortletDescription > > offeredPortlets , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < ItemDescription > > userCategoryDescriptions , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < ExtensionDescription > > extensionDescriptions , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < ItemDescription > > customWindowStateDescriptions , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < ItemDescription > > customModeDescriptions , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < CookieProtocol > requiresInitCookie , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < ModelDescription > registrationPropertyDescription , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < String > > locales , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < ResourceList > resourceList , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < EventDescription > > eventDescriptions , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < ModelTypes > schemaType , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < String > > supportedOptions , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < ExportDescription > exportDescription , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < Boolean > mayReturnRegistrationState , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < Extension > > extensions ) throws InvalidRegistration , ModifyRegistrationRequired , OperationFailed , ResourceSuspended { incrementCallCount ( ) ; offeredPortlets . value = this . offeredPortlets ; requiresRegistration . value = this . requiresRegistration ; requiresInitCookie . value = this . cookieProtocol ; registrationPropertyDescription . value = registrationProperties ; } } </s>
|
<s> package org . gatein . wsrp . test . protocol . v1 ; import org . gatein . wsrp . spec . v1 . WSRP1ExceptionFactory ; import org . oasis . wsrp . v1 . V1InvalidHandle ; import java . util . HashMap ; import java . util . Map ; public class BehaviorRegistry { private final Map < String , MarkupBehavior > behaviors = new HashMap < String , MarkupBehavior > ( ) ; private PortletManagementBehavior portletManagementBehavior ; private ServiceDescriptionBehavior serviceDescriptionBehavior ; private RegistrationBehavior registrationBehavior ; public ServiceDescriptionBehavior getServiceDescriptionBehavior ( ) { if ( serviceDescriptionBehavior == null ) { return ServiceDescriptionBehavior . DEFAULT ; } return serviceDescriptionBehavior ; } public void clear ( ) { behaviors . clear ( ) ; } public MarkupBehavior getMarkupBehaviorFor ( String handle ) throws V1InvalidHandle { if ( behaviors . containsKey ( handle ) ) { return behaviors . get ( handle ) ; } throw WSRP1ExceptionFactory . throwWSException ( V1InvalidHandle . class , "<STR_LIT>" + handle + "<STR_LIT:'>" , null ) ; } public void registerMarkupBehavior ( MarkupBehavior behavior ) { for ( String handle : behavior . getSupportedHandles ( ) ) { MarkupBehavior existing = behaviors . get ( handle ) ; if ( existing != null ) { throw new IllegalArgumentException ( "<STR_LIT>" + behavior . getClass ( ) . getName ( ) + "<STR_LIT>" + handle + "<STR_LIT>" + existing . getClass ( ) . getName ( ) ) ; } behaviors . put ( handle , behavior ) ; } } public PortletManagementBehavior getPortletManagementBehavior ( ) { return portletManagementBehavior ; } public void setPortletManagementBehavior ( PortletManagementBehavior portletManagementBehavior ) { this . portletManagementBehavior = portletManagementBehavior ; } public void setServiceDescriptionBehavior ( ServiceDescriptionBehavior serviceDescriptionBehavior ) { this . serviceDescriptionBehavior = serviceDescriptionBehavior ; } public RegistrationBehavior getRegistrationBehavior ( ) { return registrationBehavior ; } public void setRegistrationBehavior ( RegistrationBehavior registrationBehavior ) { this . registrationBehavior = registrationBehavior ; } } </s>
|
<s> package org . gatein . wsrp . test . protocol . v1 ; import org . gatein . wsrp . spec . v1 . WSRP1ExceptionFactory ; import org . oasis . wsrp . v1 . V1AccessDenied ; import org . oasis . wsrp . v1 . V1CookieProtocol ; import org . oasis . wsrp . v1 . V1DestroyFailed ; import org . oasis . wsrp . v1 . V1Extension ; import org . oasis . wsrp . v1 . V1InconsistentParameters ; import org . oasis . wsrp . v1 . V1InteractionParams ; import org . oasis . wsrp . v1 . V1InvalidCookie ; import org . oasis . wsrp . v1 . V1InvalidHandle ; import org . oasis . wsrp . v1 . V1InvalidRegistration ; import org . oasis . wsrp . v1 . V1InvalidSession ; import org . oasis . wsrp . v1 . V1InvalidUserCategory ; import org . oasis . wsrp . v1 . V1ItemDescription ; import org . oasis . wsrp . v1 . V1MarkupContext ; import org . oasis . wsrp . v1 . V1MarkupParams ; import org . oasis . wsrp . v1 . V1MissingParameters ; import org . oasis . wsrp . v1 . V1ModelDescription ; import org . oasis . wsrp . v1 . V1OperationFailed ; import org . oasis . wsrp . v1 . V1PortletContext ; import org . oasis . wsrp . v1 . V1PortletDescription ; import org . oasis . wsrp . v1 . V1PortletStateChangeRequired ; import org . oasis . wsrp . v1 . V1Property ; import org . oasis . wsrp . v1 . V1PropertyList ; import org . oasis . wsrp . v1 . V1RegistrationContext ; import org . oasis . wsrp . v1 . V1RegistrationData ; import org . oasis . wsrp . v1 . V1ResetProperty ; import org . oasis . wsrp . v1 . V1ResourceList ; import org . oasis . wsrp . v1 . V1RuntimeContext ; import org . oasis . wsrp . v1 . V1SessionContext ; import org . oasis . wsrp . v1 . V1UnsupportedLocale ; import org . oasis . wsrp . v1 . V1UnsupportedMimeType ; import org . oasis . wsrp . v1 . V1UnsupportedMode ; import org . oasis . wsrp . v1 . V1UnsupportedWindowState ; import org . oasis . wsrp . v1 . V1UpdateResponse ; import org . oasis . wsrp . v1 . V1UserContext ; import org . oasis . wsrp . v1 . WSRPV1MarkupPortType ; import org . oasis . wsrp . v1 . WSRPV1PortletManagementPortType ; import org . oasis . wsrp . v1 . WSRPV1RegistrationPortType ; import org . oasis . wsrp . v1 . WSRPV1ServiceDescriptionPortType ; import javax . jws . WebParam ; import javax . xml . ws . Holder ; import java . util . List ; public class TestWSRPProducerImpl implements TestWSRPProducer , WSRPV1MarkupPortType , WSRPV1PortletManagementPortType , WSRPV1RegistrationPortType , WSRPV1ServiceDescriptionPortType { private int sessionExpirationTime = <NUM_LIT> ; private V1CookieProtocol requiresInitCookie = V1CookieProtocol . NONE ; private BehaviorRegistry behaviorRegistry = new BehaviorRegistry ( ) ; public static final String USER_COOKIE = "<STR_LIT>" ; private String currentMarkupBehaviorHandle ; private boolean strict = true ; public TestWSRPProducerImpl ( ) { reset ( ) ; } public BehaviorRegistry getBehaviorRegistry ( ) { return behaviorRegistry ; } public void setCurrentMarkupBehaviorHandle ( String handle ) { currentMarkupBehaviorHandle = handle ; } public void reset ( ) { requiresInitCookie = null ; currentMarkupBehaviorHandle = null ; behaviorRegistry . clear ( ) ; } private MarkupBehavior getMarkupBehaviorFor ( String portletHandle ) throws V1InvalidHandle { return behaviorRegistry . getMarkupBehaviorFor ( portletHandle ) ; } private ServiceDescriptionBehavior getServiceDescriptionBehavior ( ) { return behaviorRegistry . getServiceDescriptionBehavior ( ) ; } public PortletManagementBehavior getPortletManagementBehavior ( ) { return behaviorRegistry . getPortletManagementBehavior ( ) ; } public void getServiceDescription ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) V1RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) List < String > desiredLocales , @ WebParam ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < Boolean > requiresRegistration , @ WebParam ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < List < V1PortletDescription > > offeredPortlets , @ WebParam ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < List < V1ItemDescription > > userCategoryDescriptions , @ WebParam ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < List < V1ItemDescription > > customUserProfileItemDescriptions , @ WebParam ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < List < V1ItemDescription > > customWindowStateDescriptions , @ WebParam ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < List < V1ItemDescription > > customModeDescriptions , @ WebParam ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < V1CookieProtocol > requiresInitCookie , @ WebParam ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < V1ModelDescription > registrationPropertyDescription , @ WebParam ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < List < String > > locales , @ WebParam ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < V1ResourceList > resourceList , @ WebParam ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < List < V1Extension > > extensions ) throws V1InvalidRegistration , V1OperationFailed { getServiceDescriptionBehavior ( ) . getServiceDescription ( registrationContext , desiredLocales , requiresRegistration , offeredPortlets , userCategoryDescriptions , customUserProfileItemDescriptions , customWindowStateDescriptions , customModeDescriptions , requiresInitCookie , registrationPropertyDescription , locales , resourceList , extensions ) ; } 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 ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < V1UpdateResponse > updateResponse , @ WebParam ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < String > redirectURL , @ WebParam ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < List < V1Extension > > extensions ) throws V1UnsupportedMimeType , V1UnsupportedMode , V1UnsupportedWindowState , V1InvalidCookie , V1InvalidSession , V1MissingParameters , V1UnsupportedLocale , V1InconsistentParameters , V1PortletStateChangeRequired , V1InvalidHandle , V1InvalidRegistration , V1InvalidUserCategory , V1AccessDenied , V1OperationFailed { getMarkupBehaviorFor ( portletContext . getPortletHandle ( ) ) . performBlockingInteraction ( registrationContext , portletContext , runtimeContext , userContext , markupParams , interactionParams , updateResponse , redirectURL , extensions ) ; } public List < V1Extension > releaseSessions ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) V1RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) List < String > sessionIDs ) throws V1MissingParameters , V1InvalidRegistration , V1AccessDenied , V1OperationFailed { return null ; } 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 ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < V1MarkupContext > markupContext , @ WebParam ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < V1SessionContext > sessionContext , @ WebParam ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < List < V1Extension > > extensions ) throws V1UnsupportedMimeType , V1UnsupportedMode , V1UnsupportedWindowState , V1InvalidCookie , V1InvalidSession , V1MissingParameters , V1UnsupportedLocale , V1InconsistentParameters , V1InvalidHandle , V1InvalidRegistration , V1InvalidUserCategory , V1AccessDenied , V1OperationFailed { getMarkupBehaviorFor ( portletContext . getPortletHandle ( ) ) . getMarkup ( registrationContext , portletContext , runtimeContext , userContext , markupParams , markupContext , sessionContext , extensions ) ; } public List < V1Extension > initCookie ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) V1RegistrationContext registrationContext ) throws V1InvalidRegistration , V1AccessDenied , V1OperationFailed { if ( requiresInitCookie == null || V1CookieProtocol . NONE . equals ( requiresInitCookie ) ) { throw WSRP1ExceptionFactory . throwWSException ( V1OperationFailed . class , "<STR_LIT>" , null ) ; } try { return getMarkupBehaviorFor ( currentMarkupBehaviorHandle ) . initCookie ( registrationContext ) ; } catch ( V1InvalidHandle invalidHandle ) { throw WSRP1ExceptionFactory . throwWSException ( V1OperationFailed . class , "<STR_LIT>" , invalidHandle ) ; } } 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 ( mode = WebParam . Mode . INOUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < List < V1Extension > > extensions , @ WebParam ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < String > registrationHandle , @ WebParam ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < byte [ ] > registrationState ) throws V1MissingParameters , V1OperationFailed { registrationHandle . value = "<STR_LIT>" ; } public void modifyRegistration ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) V1RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) V1RegistrationData registrationData , @ WebParam ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < byte [ ] > registrationState , @ WebParam ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < List < V1Extension > > extensions ) throws V1MissingParameters , V1InvalidRegistration , V1OperationFailed { } 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 { } 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 ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < V1ModelDescription > modelDescription , @ WebParam ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < V1ResourceList > resourceList , @ WebParam ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < List < V1Extension > > extensions ) throws V1MissingParameters , V1InconsistentParameters , V1InvalidHandle , V1InvalidRegistration , V1InvalidUserCategory , V1AccessDenied , V1OperationFailed { getPortletManagementBehavior ( ) . getPortletPropertyDescription ( registrationContext , portletContext , userContext , desiredLocales , modelDescription , resourceList , extensions ) ; } 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 ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < String > portletHandle , @ WebParam ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < byte [ ] > portletState , @ WebParam ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < List < V1Extension > > extensions ) throws V1MissingParameters , V1InconsistentParameters , V1InvalidHandle , V1InvalidRegistration , V1InvalidUserCategory , V1AccessDenied , V1OperationFailed { getPortletManagementBehavior ( ) . setPortletProperties ( registrationContext , portletContext , userContext , propertyList , portletHandle , portletState , extensions ) ; } 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 ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < String > portletHandle , @ WebParam ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < byte [ ] > portletState , @ WebParam ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < List < V1Extension > > extensions ) throws V1MissingParameters , V1InconsistentParameters , V1InvalidHandle , V1InvalidRegistration , V1InvalidUserCategory , V1AccessDenied , V1OperationFailed { getPortletManagementBehavior ( ) . clonePortlet ( registrationContext , portletContext , userContext , portletHandle , portletState , extensions ) ; } public void getPortletDescription ( @ WebParam ( name = "<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 ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < V1PortletDescription > portletDescription , @ WebParam ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < V1ResourceList > resourceList , @ WebParam ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < List < V1Extension > > extensions ) throws V1MissingParameters , V1InconsistentParameters , V1InvalidHandle , V1InvalidRegistration , V1InvalidUserCategory , V1AccessDenied , V1OperationFailed { getPortletManagementBehavior ( ) . getPortletDescription ( registrationContext , portletContext , userContext , desiredLocales , portletDescription , resourceList , extensions ) ; } 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 ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < List < V1Property > > properties , @ WebParam ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < List < V1ResetProperty > > resetProperties , @ WebParam ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < List < V1Extension > > extensions ) throws V1MissingParameters , V1InconsistentParameters , V1InvalidHandle , V1InvalidRegistration , V1InvalidUserCategory , V1AccessDenied , V1OperationFailed { getPortletManagementBehavior ( ) . getPortletProperties ( registrationContext , portletContext , userContext , names , properties , resetProperties , extensions ) ; } public void destroyPortlets ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) V1RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) List < String > portletHandles , @ WebParam ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < List < V1DestroyFailed > > destroyFailed , @ WebParam ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < List < V1Extension > > extensions ) throws V1MissingParameters , V1InconsistentParameters , V1InvalidRegistration , V1OperationFailed { getPortletManagementBehavior ( ) . destroyPortlets ( registrationContext , portletHandles , destroyFailed , extensions ) ; } public V1CookieProtocol getRequiresInitCookie ( ) { return requiresInitCookie ; } public void setRequiresInitCookie ( String cookieProtocolAsString ) { V1CookieProtocol protocol = V1CookieProtocol . fromValue ( cookieProtocolAsString ) ; this . requiresInitCookie = protocol ; getServiceDescriptionBehavior ( ) . setRequiresInitCookie ( requiresInitCookie ) ; } public int getSessionExpirationTime ( ) { return sessionExpirationTime ; } public void setSessionExpirationTime ( int sessionExpirationTime ) { this . sessionExpirationTime = sessionExpirationTime ; } public void usingStrictModeChangedTo ( boolean strictMode ) { strict = strictMode ; } } </s>
|
<s> package org . gatein . wsrp . test . protocol . v1 ; import org . oasis . wsrp . v1 . V1AccessDenied ; import org . oasis . wsrp . v1 . V1DestroyFailed ; import org . oasis . wsrp . v1 . V1Extension ; import org . oasis . wsrp . v1 . V1InconsistentParameters ; import org . oasis . wsrp . v1 . V1InvalidHandle ; import org . oasis . wsrp . v1 . V1InvalidRegistration ; import org . oasis . wsrp . v1 . 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 . V1PortletDescription ; import org . oasis . wsrp . v1 . V1Property ; import org . oasis . wsrp . v1 . V1PropertyList ; import org . oasis . wsrp . v1 . V1RegistrationContext ; import org . oasis . wsrp . v1 . V1ResetProperty ; import org . oasis . wsrp . v1 . V1ResourceList ; import org . oasis . wsrp . v1 . V1UserContext ; import org . oasis . wsrp . v1 . WSRPV1PortletManagementPortType ; import javax . jws . WebParam ; import javax . xml . ws . Holder ; import java . util . List ; public class PortletManagementBehavior extends TestProducerBehavior implements WSRPV1PortletManagementPortType { 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 { incrementCallCount ( ) ; } 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 { incrementCallCount ( ) ; } 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 { incrementCallCount ( ) ; } 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 { incrementCallCount ( ) ; } 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 { incrementCallCount ( ) ; } 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 { incrementCallCount ( ) ; } } </s>
|
<s> package org . gatein . wsrp . test . protocol . v1 . behaviors ; import org . gatein . wsrp . test . protocol . v1 . ServiceDescriptionBehavior ; import org . oasis . wsrp . v1 . V1PortletDescription ; public class BasicServiceDescriptionBehavior extends ServiceDescriptionBehavior { public BasicServiceDescriptionBehavior ( ) { V1PortletDescription pd1 = createPortletDescription ( BasicMarkupBehavior . PORTLET_HANDLE , "<STR_LIT>" ) ; V1PortletDescription pd2 = createPortletDescription ( SessionMarkupBehavior . PORTLET_HANDLE , "<STR_LIT:2>" ) ; offeredPortlets . add ( pd1 ) ; offeredPortlets . add ( pd2 ) ; } } </s>
|
<s> package org . gatein . wsrp . test . protocol . v1 . behaviors ; import org . gatein . pc . api . Mode ; import org . gatein . pc . api . WindowState ; import org . gatein . wsrp . spec . v1 . WSRP1TypeFactory ; import org . gatein . wsrp . test . protocol . v1 . BehaviorRegistry ; import org . gatein . wsrp . test . protocol . v1 . MarkupBehavior ; import org . oasis . wsrp . v1 . V1AccessDenied ; import org . oasis . wsrp . v1 . V1Extension ; import org . oasis . wsrp . v1 . V1GetMarkup ; import org . oasis . wsrp . v1 . V1InconsistentParameters ; import org . oasis . wsrp . v1 . V1InteractionParams ; import org . oasis . wsrp . v1 . V1InvalidCookie ; import org . oasis . wsrp . v1 . V1InvalidHandle ; import org . oasis . wsrp . v1 . V1InvalidRegistration ; import org . oasis . wsrp . v1 . V1InvalidSession ; import org . oasis . wsrp . v1 . V1InvalidUserCategory ; import org . oasis . wsrp . v1 . V1MarkupParams ; import org . oasis . wsrp . v1 . V1MarkupResponse ; import org . oasis . wsrp . v1 . V1MissingParameters ; import org . oasis . wsrp . v1 . V1OperationFailed ; import org . oasis . wsrp . v1 . V1PortletContext ; import org . oasis . wsrp . v1 . V1PortletStateChangeRequired ; import org . oasis . wsrp . v1 . V1RegistrationContext ; import org . oasis . wsrp . v1 . V1RuntimeContext ; import org . oasis . wsrp . v1 . V1SessionContext ; import org . oasis . wsrp . v1 . V1UnsupportedLocale ; import org . oasis . wsrp . v1 . V1UnsupportedMimeType ; import org . oasis . wsrp . v1 . V1UnsupportedMode ; import org . oasis . wsrp . v1 . V1UnsupportedWindowState ; import org . oasis . wsrp . v1 . V1UpdateResponse ; import org . oasis . wsrp . v1 . V1UserContext ; import javax . jws . WebParam ; import javax . xml . ws . Holder ; import java . util . List ; public class SessionMarkupBehavior extends MarkupBehavior { public static final String PORTLET_HANDLE = "<STR_LIT>" ; public static final String SESSION_ID = "<STR_LIT>" ; public static final String NS = "<STR_LIT>" ; private int count = <NUM_LIT:0> ; private String sessionId ; public SessionMarkupBehavior ( BehaviorRegistry registry ) { super ( registry ) ; registerHandle ( PORTLET_HANDLE ) ; } @ Override protected String getMarkupString ( Mode mode , WindowState windowState , String navigationalState , V1GetMarkup getMarkup ) throws V1UnsupportedWindowState , V1InvalidCookie , V1InvalidSession , V1AccessDenied , V1InconsistentParameters , V1InvalidHandle , V1UnsupportedLocale , V1UnsupportedMode , V1OperationFailed , V1MissingParameters , V1InvalidUserCategory , V1InvalidRegistration , V1UnsupportedMimeType { StringBuffer markupString = new StringBuffer ( "<STR_LIT>" ) ; sessionId = getMarkup . getRuntimeContext ( ) . getSessionID ( ) ; if ( SESSION_ID . equals ( sessionId ) ) { count ++ ; } markupString . append ( count ) . append ( "<STR_LIT::>" ) ; markupString . append ( mode ) . append ( "<STR_LIT::>" ) . append ( windowState ) ; if ( navigationalState != null ) { markupString . append ( "<STR_LIT::>" ) . append ( navigationalState ) ; } return markupString . toString ( ) ; } @ Override 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 ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < V1UpdateResponse > updateResponse , @ WebParam ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < String > redirectURL , @ WebParam ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < List < V1Extension > > extensions ) throws V1UnsupportedMimeType , V1UnsupportedMode , V1UnsupportedWindowState , V1InvalidCookie , V1InvalidSession , V1MissingParameters , V1UnsupportedLocale , V1InconsistentParameters , V1PortletStateChangeRequired , V1InvalidHandle , V1InvalidRegistration , V1InvalidUserCategory , V1AccessDenied , V1OperationFailed { V1UpdateResponse ur = WSRP1TypeFactory . createUpdateResponse ( ) ; ur . setNavigationalState ( NS ) ; updateResponse . value = ur ; } public void modifyResponseIfNeeded ( V1MarkupResponse markupResponse ) { if ( count == <NUM_LIT:0> || SESSION_ID . equals ( sessionId ) ) { V1SessionContext sessionContext = WSRP1TypeFactory . createSessionContext ( SESSION_ID , <NUM_LIT:30> ) ; markupResponse . setSessionContext ( sessionContext ) ; } } protected String getSuffixFor ( String handle ) { return "<STR_LIT:2>" ; } } </s>
|
<s> package org . gatein . wsrp . test . protocol . v1 . behaviors . interop ; import org . gatein . wsrp . test . protocol . v1 . ServiceDescriptionBehavior ; import org . oasis . wsrp . v1 . V1LocalizedString ; import org . oasis . wsrp . v1 . V1PortletDescription ; public class LiferayServiceDescriptionBehavior extends ServiceDescriptionBehavior { public LiferayServiceDescriptionBehavior ( ) { V1PortletDescription pd = createPortletDescription ( "<STR_LIT>" , null ) ; pd . getMarkupTypes ( ) . get ( <NUM_LIT:0> ) . getLocales ( ) . set ( <NUM_LIT:0> , "<STR_LIT>" ) ; V1LocalizedString locString = pd . getShortTitle ( ) ; pd . setGroupID ( "<STR_LIT>" ) ; String lang = "<STR_LIT>" ; locString . setLang ( lang ) ; locString . setValue ( "<STR_LIT>" ) ; locString = pd . getTitle ( ) ; locString . setLang ( lang ) ; locString . setValue ( "<STR_LIT>" ) ; V1PortletDescription pd2 = createPortletDescription ( "<STR_LIT>" , null ) ; pd . getMarkupTypes ( ) . get ( <NUM_LIT:0> ) . getLocales ( ) . set ( <NUM_LIT:0> , "<STR_LIT>" ) ; locString = pd . getShortTitle ( ) ; locString . setLang ( null ) ; offeredPortlets . add ( pd ) ; offeredPortlets . add ( pd2 ) ; } } </s>
|
<s> package org . gatein . wsrp . test . protocol . v1 . behaviors ; import org . gatein . wsrp . spec . v1 . WSRP1ExceptionFactory ; import org . gatein . wsrp . test . protocol . v1 . BehaviorRegistry ; import org . oasis . wsrp . v1 . V1AccessDenied ; import org . oasis . wsrp . v1 . V1Extension ; import org . oasis . wsrp . v1 . V1InvalidRegistration ; import org . oasis . wsrp . v1 . V1OperationFailed ; import org . oasis . wsrp . v1 . V1RegistrationContext ; import javax . jws . WebParam ; import java . util . List ; public class InitCookieNotRequiredMarkupBehavior extends InitCookieMarkupBehavior { public static final String INIT_COOKIE_NOT_REQUIRED_HANDLE = "<STR_LIT>" ; public InitCookieNotRequiredMarkupBehavior ( BehaviorRegistry registry ) { super ( registry ) ; } protected void initPortletHandle ( ) { portletHandle = INIT_COOKIE_NOT_REQUIRED_HANDLE ; } @ Override protected String getMarkupString ( String handle ) { return handle ; } @ Override public List < V1Extension > initCookie ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) V1RegistrationContext registrationContext ) throws V1InvalidRegistration , V1AccessDenied , V1OperationFailed { super . initCookie ( registrationContext ) ; throw WSRP1ExceptionFactory . throwWSException ( V1OperationFailed . class , "<STR_LIT>" , null ) ; } } </s>
|
<s> package org . gatein . wsrp . test . protocol . v1 . behaviors ; import org . gatein . pc . api . Mode ; import org . gatein . pc . api . WindowState ; import org . gatein . wsrp . spec . v1 . WSRP1ExceptionFactory ; import org . gatein . wsrp . test . protocol . v1 . BehaviorRegistry ; import org . gatein . wsrp . test . protocol . v1 . MarkupBehavior ; import org . oasis . wsrp . v1 . V1AccessDenied ; import org . oasis . wsrp . v1 . V1Extension ; import org . oasis . wsrp . v1 . V1GetMarkup ; import org . oasis . wsrp . v1 . V1InvalidCookie ; import org . oasis . wsrp . v1 . V1InvalidRegistration ; import org . oasis . wsrp . v1 . V1OperationFailed ; import org . oasis . wsrp . v1 . V1RegistrationContext ; import javax . jws . WebParam ; import java . util . List ; public abstract class InitCookieMarkupBehavior extends MarkupBehavior { protected String portletHandle ; protected int initCookieCallCount ; private boolean initCookieCalled ; public InitCookieMarkupBehavior ( BehaviorRegistry registry ) { super ( registry ) ; initPortletHandle ( ) ; registerHandle ( portletHandle ) ; } protected abstract void initPortletHandle ( ) ; protected String getMarkupString ( Mode mode , WindowState windowState , String navigationalState , V1GetMarkup getMarkup ) throws V1OperationFailed , V1InvalidCookie { if ( ! initCookieCalled ) { throw new IllegalStateException ( "<STR_LIT>" ) ; } String handle = getMarkup . getPortletContext ( ) . getPortletHandle ( ) ; if ( portletHandle . equals ( handle ) ) { return getMarkupString ( handle ) ; } throw WSRP1ExceptionFactory . throwWSException ( V1OperationFailed . class , "<STR_LIT>" , null ) ; } protected String getMarkupString ( String handle ) throws V1InvalidCookie , V1OperationFailed { switch ( callCount ++ ) { case <NUM_LIT:0> : throw WSRP1ExceptionFactory . throwWSException ( V1InvalidCookie . class , "<STR_LIT>" , null ) ; case <NUM_LIT:1> : return handle ; default : throw WSRP1ExceptionFactory . throwWSException ( V1OperationFailed . class , "<STR_LIT>" , null ) ; } } @ Override public List < V1Extension > initCookie ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) V1RegistrationContext registrationContext ) throws V1InvalidRegistration , V1AccessDenied , V1OperationFailed { initCookieCalled = true ; initCookieCallCount ++ ; return null ; } public int getInitCookieCallCount ( ) { return initCookieCallCount ; } } </s>
|
<s> package org . gatein . wsrp . test . protocol . v1 . behaviors ; import org . gatein . wsrp . test . protocol . v1 . ServiceDescriptionBehavior ; import org . oasis . wsrp . v1 . V1CookieProtocol ; import org . oasis . wsrp . v1 . V1Extension ; import org . oasis . wsrp . v1 . V1InvalidRegistration ; import org . oasis . wsrp . v1 . V1ItemDescription ; import org . oasis . wsrp . v1 . V1ModelDescription ; import org . oasis . wsrp . v1 . V1OperationFailed ; import org . oasis . wsrp . v1 . V1PortletDescription ; import org . oasis . wsrp . v1 . V1RegistrationContext ; import org . oasis . wsrp . v1 . V1ResourceList ; import javax . jws . WebParam ; import javax . xml . ws . Holder ; import java . util . List ; public class GroupedPortletsServiceDescriptionBehavior extends ServiceDescriptionBehavior { public GroupedPortletsServiceDescriptionBehavior ( List < V1PortletDescription > offeredPortlets ) { this . offeredPortlets = offeredPortlets ; } @ Override public void getServiceDescription ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) V1RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) List < String > desiredLocales , @ WebParam ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < Boolean > requiresRegistration , @ WebParam ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < List < V1PortletDescription > > offeredPortlets , @ WebParam ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < List < V1ItemDescription > > userCategoryDescriptions , @ WebParam ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < List < V1ItemDescription > > customUserProfileItemDescriptions , @ WebParam ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < List < V1ItemDescription > > customWindowStateDescriptions , @ WebParam ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < List < V1ItemDescription > > customModeDescriptions , @ WebParam ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < V1CookieProtocol > requiresInitCookie , @ WebParam ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < V1ModelDescription > registrationPropertyDescription , @ WebParam ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < List < String > > locales , @ WebParam ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < V1ResourceList > resourceList , @ WebParam ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < List < V1Extension > > extensions ) throws V1InvalidRegistration , V1OperationFailed { super . getServiceDescription ( registrationContext , desiredLocales , requiresRegistration , offeredPortlets , userCategoryDescriptions , customUserProfileItemDescriptions , customWindowStateDescriptions , customModeDescriptions , requiresInitCookie , registrationPropertyDescription , locales , resourceList , extensions ) ; List < V1PortletDescription > portletDescriptions = offeredPortlets . value ; for ( int i = <NUM_LIT:0> ; i < portletDescriptions . size ( ) ; i ++ ) { portletDescriptions . get ( i ) . setGroupID ( "<STR_LIT>" + i % <NUM_LIT:3> ) ; } } } </s>
|
<s> package org . gatein . wsrp . test . protocol . v1 . behaviors ; import org . gatein . pc . api . Mode ; import org . gatein . pc . api . WindowState ; import org . gatein . wsrp . test . protocol . v1 . BehaviorRegistry ; import org . gatein . wsrp . test . protocol . v1 . MarkupBehavior ; import org . oasis . wsrp . v1 . V1AccessDenied ; import org . oasis . wsrp . v1 . V1GetMarkup ; import org . oasis . wsrp . v1 . V1InconsistentParameters ; import org . oasis . wsrp . v1 . V1InvalidCookie ; import org . oasis . wsrp . v1 . V1InvalidHandle ; import org . oasis . wsrp . v1 . V1InvalidRegistration ; import org . oasis . wsrp . v1 . V1InvalidSession ; import org . oasis . wsrp . v1 . V1InvalidUserCategory ; import org . oasis . wsrp . v1 . V1MissingParameters ; import org . oasis . wsrp . v1 . V1OperationFailed ; import org . oasis . wsrp . v1 . V1UnsupportedLocale ; import org . oasis . wsrp . v1 . V1UnsupportedMimeType ; import org . oasis . wsrp . v1 . V1UnsupportedMode ; import org . oasis . wsrp . v1 . V1UnsupportedWindowState ; public class EmptyMarkupBehavior extends MarkupBehavior { public static final String PORTLET_HANDLE = "<STR_LIT>" ; public EmptyMarkupBehavior ( BehaviorRegistry registry ) { super ( registry ) ; registerHandle ( PORTLET_HANDLE ) ; } @ Override protected String getMarkupString ( Mode mode , WindowState windowState , String navigationalState , V1GetMarkup getMarkup ) throws V1UnsupportedWindowState , V1InvalidCookie , V1InvalidSession , V1AccessDenied , V1InconsistentParameters , V1InvalidHandle , V1UnsupportedLocale , V1UnsupportedMode , V1OperationFailed , V1MissingParameters , V1InvalidUserCategory , V1InvalidRegistration , V1UnsupportedMimeType { return "<STR_LIT>" ; } } </s>
|
<s> package org . gatein . wsrp . test . protocol . v1 . behaviors ; import org . gatein . wsrp . spec . v1 . WSRP1ExceptionFactory ; import org . gatein . wsrp . test . protocol . v1 . BehaviorRegistry ; import org . oasis . wsrp . v1 . V1AccessDenied ; import org . oasis . wsrp . v1 . V1Extension ; import org . oasis . wsrp . v1 . V1InconsistentParameters ; 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 . V1OperationFailed ; import org . oasis . wsrp . v1 . V1PortletContext ; import org . oasis . wsrp . v1 . V1PortletDescription ; import org . oasis . wsrp . v1 . V1RegistrationContext ; import org . oasis . wsrp . v1 . V1ResourceList ; import org . oasis . wsrp . v1 . V1UserContext ; import javax . jws . WebParam ; import javax . xml . ws . Holder ; import java . util . List ; public class DestroyClonesPortletManagementBehavior extends BasicPortletManagementBehavior { public DestroyClonesPortletManagementBehavior ( BehaviorRegistry registry ) { super ( registry ) ; } @ Override 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 ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < V1PortletDescription > portletDescription , @ WebParam ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < V1ResourceList > resourceList , @ WebParam ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < List < V1Extension > > extensions ) throws V1MissingParameters , V1InconsistentParameters , V1InvalidHandle , V1InvalidRegistration , V1InvalidUserCategory , V1AccessDenied , V1OperationFailed { if ( getCallCount ( ) == <NUM_LIT:0> ) { incrementCallCount ( ) ; super . getPortletDescription ( registrationContext , portletContext , userContext , desiredLocales , portletDescription , resourceList , extensions ) ; } else { throw WSRP1ExceptionFactory . throwWSException ( V1InvalidHandle . class , "<STR_LIT>" + portletContext . getPortletHandle ( ) , null ) ; } } } </s>
|
<s> package org . gatein . wsrp . test . protocol . v1 . behaviors ; import org . gatein . pc . api . Mode ; import org . gatein . pc . api . WindowState ; import org . gatein . wsrp . WSRPConstants ; import org . gatein . wsrp . spec . v1 . WSRP1TypeFactory ; import org . gatein . wsrp . test . protocol . v1 . BehaviorRegistry ; import org . gatein . wsrp . test . protocol . v1 . MarkupBehavior ; import org . oasis . wsrp . v1 . V1AccessDenied ; import org . oasis . wsrp . v1 . V1Extension ; import org . oasis . wsrp . v1 . V1GetMarkup ; import org . oasis . wsrp . v1 . V1InconsistentParameters ; import org . oasis . wsrp . v1 . V1InteractionParams ; import org . oasis . wsrp . v1 . V1InvalidCookie ; import org . oasis . wsrp . v1 . V1InvalidHandle ; import org . oasis . wsrp . v1 . V1InvalidRegistration ; import org . oasis . wsrp . v1 . V1InvalidSession ; import org . oasis . wsrp . v1 . V1InvalidUserCategory ; import org . oasis . wsrp . v1 . V1MarkupParams ; import org . oasis . wsrp . v1 . V1MarkupResponse ; import org . oasis . wsrp . v1 . V1MissingParameters ; import org . oasis . wsrp . v1 . V1OperationFailed ; import org . oasis . wsrp . v1 . V1PortletContext ; import org . oasis . wsrp . v1 . V1PortletStateChangeRequired ; import org . oasis . wsrp . v1 . V1RegistrationContext ; import org . oasis . wsrp . v1 . V1RuntimeContext ; import org . oasis . wsrp . v1 . V1UnsupportedLocale ; import org . oasis . wsrp . v1 . V1UnsupportedMimeType ; import org . oasis . wsrp . v1 . V1UnsupportedMode ; import org . oasis . wsrp . v1 . V1UnsupportedWindowState ; import org . oasis . wsrp . v1 . V1UpdateResponse ; import org . oasis . wsrp . v1 . V1UserContext ; import javax . jws . WebParam ; import javax . xml . ws . Holder ; import java . util . List ; public class BasicMarkupBehavior extends MarkupBehavior { public static final String PORTLET_HANDLE = "<STR_LIT>" ; public static final String NS = "<STR_LIT>" ; public BasicMarkupBehavior ( BehaviorRegistry registry ) { super ( registry ) ; registerHandle ( PORTLET_HANDLE ) ; } @ Override protected String getMarkupString ( Mode mode , WindowState windowState , String navigationalState , V1GetMarkup getMarkup ) throws V1UnsupportedWindowState , V1InvalidCookie , V1InvalidSession , V1AccessDenied , V1InconsistentParameters , V1InvalidHandle , V1UnsupportedLocale , V1UnsupportedMode , V1OperationFailed , V1MissingParameters , V1InvalidUserCategory , V1InvalidRegistration , V1UnsupportedMimeType { StringBuffer markupString = new StringBuffer ( "<STR_LIT>" ) ; markupString . append ( mode ) . append ( "<STR_LIT::>" ) . append ( windowState ) ; if ( navigationalState != null ) { markupString . append ( "<STR_LIT::>" ) . append ( navigationalState ) ; } return markupString . toString ( ) ; } @ Override 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 ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < V1UpdateResponse > updateResponse , @ WebParam ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < String > redirectURL , @ WebParam ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < List < V1Extension > > extensions ) throws V1UnsupportedMimeType , V1UnsupportedMode , V1UnsupportedWindowState , V1InvalidCookie , V1InvalidSession , V1MissingParameters , V1UnsupportedLocale , V1InconsistentParameters , V1PortletStateChangeRequired , V1InvalidHandle , V1InvalidRegistration , V1InvalidUserCategory , V1AccessDenied , V1OperationFailed { V1UpdateResponse ur = WSRP1TypeFactory . createUpdateResponse ( ) ; ur . setNavigationalState ( NS ) ; updateResponse . value = ur ; } public void modifyResponseIfNeeded ( V1MarkupResponse markupResponse ) { markupResponse . getMarkupContext ( ) . setCacheControl ( WSRP1TypeFactory . createCacheControl ( <NUM_LIT:15> , WSRPConstants . CACHE_PER_USER ) ) ; } } </s>
|
<s> package org . gatein . wsrp . test . protocol . v1 . behaviors ; import org . gatein . wsrp . handler . RequestHeaderClientHandler ; import org . gatein . wsrp . test . handler . MockSOAPMessage ; import org . gatein . wsrp . test . handler . MockSOAPMessageContext ; import org . gatein . wsrp . test . protocol . v1 . BehaviorRegistry ; import org . oasis . wsrp . v1 . V1AccessDenied ; import org . oasis . wsrp . v1 . V1Extension ; import org . oasis . wsrp . v1 . V1InvalidRegistration ; import org . oasis . wsrp . v1 . V1OperationFailed ; import org . oasis . wsrp . v1 . V1RegistrationContext ; import javax . xml . soap . MimeHeaders ; import javax . xml . ws . handler . soap . SOAPMessageContext ; import java . util . List ; public class PerUserInitCookieMarkupBehavior extends InitCookieMarkupBehavior { public static final String PER_USER_INIT_COOKIE_HANDLE = "<STR_LIT>" ; public PerUserInitCookieMarkupBehavior ( BehaviorRegistry registry ) { super ( registry ) ; } protected void initPortletHandle ( ) { portletHandle = PER_USER_INIT_COOKIE_HANDLE ; } @ Override public List < V1Extension > initCookie ( V1RegistrationContext registrationContext ) throws V1InvalidRegistration , V1AccessDenied , V1OperationFailed { MockSOAPMessage message = new MockSOAPMessage ( ) ; SOAPMessageContext msgContext = MockSOAPMessageContext . createMessageContext ( message , getClass ( ) . getClassLoader ( ) ) ; MimeHeaders headers = new MimeHeaders ( ) ; headers . setHeader ( "<STR_LIT>" , "<STR_LIT>" ) ; message . setMimeHeaders ( headers ) ; RequestHeaderClientHandler rhch = new RequestHeaderClientHandler ( ) ; rhch . handleResponse ( msgContext ) ; return super . initCookie ( registrationContext ) ; } } </s>
|
<s> package org . gatein . wsrp . test . protocol . v1 . behaviors ; import org . gatein . pc . api . Mode ; import org . gatein . pc . api . WindowState ; import org . gatein . wsrp . test . protocol . v1 . BehaviorRegistry ; import org . gatein . wsrp . test . protocol . v1 . MarkupBehavior ; import org . oasis . wsrp . v1 . V1AccessDenied ; import org . oasis . wsrp . v1 . V1GetMarkup ; import org . oasis . wsrp . v1 . V1InconsistentParameters ; import org . oasis . wsrp . v1 . V1InvalidCookie ; import org . oasis . wsrp . v1 . V1InvalidHandle ; import org . oasis . wsrp . v1 . V1InvalidRegistration ; import org . oasis . wsrp . v1 . V1InvalidSession ; import org . oasis . wsrp . v1 . V1InvalidUserCategory ; import org . oasis . wsrp . v1 . V1MissingParameters ; import org . oasis . wsrp . v1 . V1OperationFailed ; import org . oasis . wsrp . v1 . V1UnsupportedLocale ; import org . oasis . wsrp . v1 . V1UnsupportedMimeType ; import org . oasis . wsrp . v1 . V1UnsupportedMode ; import org . oasis . wsrp . v1 . V1UnsupportedWindowState ; public class NullMarkupBehavior extends MarkupBehavior { public static final String PORTLET_HANDLE = "<STR_LIT>" ; public NullMarkupBehavior ( BehaviorRegistry registry ) { super ( registry ) ; registerHandle ( PORTLET_HANDLE ) ; } @ Override protected String getMarkupString ( Mode mode , WindowState windowState , String navigationalState , V1GetMarkup getMarkup ) throws V1UnsupportedWindowState , V1InvalidCookie , V1InvalidSession , V1AccessDenied , V1InconsistentParameters , V1InvalidHandle , V1UnsupportedLocale , V1UnsupportedMode , V1OperationFailed , V1MissingParameters , V1InvalidUserCategory , V1InvalidRegistration , V1UnsupportedMimeType { return null ; } } </s>
|
<s> package org . gatein . wsrp . test . protocol . v1 . behaviors ; import org . gatein . pc . api . Mode ; import org . gatein . pc . api . WindowState ; import org . gatein . wsrp . test . protocol . v1 . BehaviorRegistry ; import org . gatein . wsrp . test . protocol . v1 . MarkupBehavior ; import org . oasis . wsrp . v1 . V1AccessDenied ; import org . oasis . wsrp . v1 . V1GetMarkup ; import org . oasis . wsrp . v1 . V1InconsistentParameters ; import org . oasis . wsrp . v1 . V1InvalidCookie ; import org . oasis . wsrp . v1 . V1InvalidHandle ; import org . oasis . wsrp . v1 . V1InvalidRegistration ; import org . oasis . wsrp . v1 . V1InvalidSession ; import org . oasis . wsrp . v1 . V1InvalidUserCategory ; import org . oasis . wsrp . v1 . V1MissingParameters ; import org . oasis . wsrp . v1 . V1OperationFailed ; import org . oasis . wsrp . v1 . V1UnsupportedLocale ; import org . oasis . wsrp . v1 . V1UnsupportedMimeType ; import org . oasis . wsrp . v1 . V1UnsupportedMode ; import org . oasis . wsrp . v1 . V1UnsupportedWindowState ; public class ResourceMarkupBehavior extends MarkupBehavior { public static final String PORTLET_HANDLE = "<STR_LIT>" ; public ResourceMarkupBehavior ( BehaviorRegistry registry ) { super ( registry ) ; registerHandle ( PORTLET_HANDLE ) ; } @ Override protected String getMarkupString ( Mode mode , WindowState windowState , String navigationalState , V1GetMarkup getMarkup ) throws V1UnsupportedWindowState , V1InvalidCookie , V1InvalidSession , V1AccessDenied , V1InconsistentParameters , V1InvalidHandle , V1UnsupportedLocale , V1UnsupportedMode , V1OperationFailed , V1MissingParameters , V1InvalidUserCategory , V1InvalidRegistration , V1UnsupportedMimeType { return "<STR_LIT>" + "<STR_LIT>" ; } } </s>
|
<s> package org . gatein . wsrp . test . protocol . v1 . behaviors ; import org . gatein . common . util . ParameterValidation ; import org . gatein . wsrp . spec . v1 . WSRP1ExceptionFactory ; import org . gatein . wsrp . spec . v1 . WSRP1TypeFactory ; import org . gatein . wsrp . test . protocol . v1 . BehaviorRegistry ; import org . gatein . wsrp . test . protocol . v1 . MarkupBehavior ; import org . gatein . wsrp . test . protocol . v1 . PortletManagementBehavior ; import org . oasis . wsrp . v1 . V1AccessDenied ; import org . oasis . wsrp . v1 . V1DestroyFailed ; import org . oasis . wsrp . v1 . V1Extension ; import org . oasis . wsrp . v1 . V1InconsistentParameters ; import org . oasis . wsrp . v1 . V1InvalidHandle ; import org . oasis . wsrp . v1 . V1InvalidRegistration ; import org . oasis . wsrp . v1 . V1InvalidUserCategory ; import org . oasis . wsrp . v1 . V1MissingParameters ; import org . oasis . wsrp . v1 . V1OperationFailed ; import org . oasis . wsrp . v1 . V1PortletContext ; import org . oasis . wsrp . v1 . V1PortletDescription ; import org . oasis . wsrp . v1 . V1Property ; import org . oasis . wsrp . v1 . V1PropertyList ; import org . oasis . wsrp . v1 . V1RegistrationContext ; import org . oasis . wsrp . v1 . V1ResetProperty ; import org . oasis . wsrp . v1 . V1ResourceList ; import org . oasis . wsrp . v1 . V1UserContext ; import javax . jws . WebParam ; import javax . xml . ws . Holder ; import java . util . ArrayList ; import java . util . List ; public class BasicPortletManagementBehavior extends PortletManagementBehavior { private static final String CLONE_SUFFIX = "<STR_LIT>" ; public static final String PROPERTY_NAME = "<STR_LIT>" ; public static final String PROPERTY_VALUE = "<STR_LIT:value1>" ; public static final String PROPERTY_NEW_VALUE = "<STR_LIT>" ; public static final String CLONED_HANDLE = BasicMarkupBehavior . PORTLET_HANDLE + CLONE_SUFFIX ; public static final String CANNOT_BOTH_SET_AND_RESET_A_PROPERTY_AT_THE_SAME_TIME = "<STR_LIT>" ; private BehaviorRegistry registry ; private String propValue = PROPERTY_VALUE ; public BasicPortletManagementBehavior ( BehaviorRegistry registry ) { super ( ) ; this . registry = registry ; } @ Override 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 ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < String > portletHandle , @ WebParam ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < byte [ ] > portletState , @ WebParam ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < List < V1Extension > > extensions ) throws V1MissingParameters , V1InconsistentParameters , V1InvalidHandle , V1InvalidRegistration , V1InvalidUserCategory , V1AccessDenied , V1OperationFailed { String handle = getHandleFrom ( portletContext , "<STR_LIT>" ) ; if ( ! BasicMarkupBehavior . PORTLET_HANDLE . equals ( handle ) ) { throw WSRP1ExceptionFactory . throwWSException ( V1OperationFailed . class , "<STR_LIT>" + handle + "<STR_LIT:'>" , null ) ; } portletHandle . value = CLONED_HANDLE ; } @ Override 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 ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < V1PortletDescription > portletDescription , @ WebParam ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < V1ResourceList > resourceList , @ WebParam ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < List < V1Extension > > extensions ) throws V1MissingParameters , V1InconsistentParameters , V1InvalidHandle , V1InvalidRegistration , V1InvalidUserCategory , V1AccessDenied , V1OperationFailed { super . getPortletDescription ( registrationContext , portletContext , userContext , desiredLocales , portletDescription , resourceList , extensions ) ; String handle = getHandleFrom ( portletContext , "<STR_LIT>" ) ; int index = handle . indexOf ( CLONE_SUFFIX ) ; if ( index != - <NUM_LIT:1> ) { handle = handle . substring ( <NUM_LIT:0> , index ) ; } MarkupBehavior markupBehaviorFor = registry . getMarkupBehaviorFor ( handle ) ; V1PortletDescription description = markupBehaviorFor . getPortletDescriptionFor ( handle ) ; if ( index != - <NUM_LIT:1> ) { description . setPortletHandle ( handle + CLONE_SUFFIX ) ; } portletDescription . value = description ; } @ Override 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 ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < List < V1Property > > properties , @ WebParam ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < List < V1ResetProperty > > resetProperties , @ WebParam ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < List < V1Extension > > extensions ) throws V1MissingParameters , V1InconsistentParameters , V1InvalidHandle , V1InvalidRegistration , V1InvalidUserCategory , V1AccessDenied , V1OperationFailed { String handle = getHandleFrom ( portletContext , "<STR_LIT>" ) ; List < V1Property > propertyList = new ArrayList < V1Property > ( <NUM_LIT:1> ) ; if ( BasicMarkupBehavior . PORTLET_HANDLE . equals ( handle ) ) { propertyList . add ( WSRP1TypeFactory . createProperty ( PROPERTY_NAME , "<STR_LIT:en>" , PROPERTY_VALUE ) ) ; } else if ( CLONED_HANDLE . equals ( handle ) ) { if ( propValue != null ) { propertyList . add ( WSRP1TypeFactory . createProperty ( PROPERTY_NAME , "<STR_LIT:en>" , propValue ) ) ; } if ( callCount > <NUM_LIT:4> ) { throw new IllegalStateException ( "<STR_LIT>" ) ; } } else { WSRP1ExceptionFactory . throwWSException ( V1InvalidHandle . class , "<STR_LIT>" + handle + "<STR_LIT:'>" , null ) ; } incrementCallCount ( ) ; properties . value = propertyList ; } @ Override 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 ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < String > portletHandle , @ WebParam ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < byte [ ] > portletState , @ WebParam ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < List < V1Extension > > extensions ) throws V1MissingParameters , V1InconsistentParameters , V1InvalidHandle , V1InvalidRegistration , V1InvalidUserCategory , V1AccessDenied , V1OperationFailed { String handle = getHandleFrom ( portletContext , "<STR_LIT>" ) ; if ( ! ( CLONED_HANDLE ) . equals ( handle ) ) { throw WSRP1ExceptionFactory . throwWSException ( V1OperationFailed . class , "<STR_LIT>" + handle + "<STR_LIT:'>" , null ) ; } List < V1Property > properties = propertyList . getProperties ( ) ; List < V1ResetProperty > resetProperties = propertyList . getResetProperties ( ) ; if ( ParameterValidation . existsAndIsNotEmpty ( properties ) && ParameterValidation . existsAndIsNotEmpty ( resetProperties ) ) { if ( properties . size ( ) != <NUM_LIT:1> && resetProperties . size ( ) != <NUM_LIT:1> ) { WSRP1ExceptionFactory . throwWSException ( V1InconsistentParameters . class , "<STR_LIT>" , null ) ; } if ( properties . get ( <NUM_LIT:0> ) . getName ( ) . equals ( resetProperties . get ( <NUM_LIT:0> ) . getName ( ) ) ) { WSRP1ExceptionFactory . throwWSException ( V1InconsistentParameters . class , CANNOT_BOTH_SET_AND_RESET_A_PROPERTY_AT_THE_SAME_TIME , null ) ; } } if ( ParameterValidation . existsAndIsNotEmpty ( properties ) ) { if ( properties . size ( ) != <NUM_LIT:1> ) { WSRP1ExceptionFactory . throwWSException ( V1InconsistentParameters . class , "<STR_LIT>" , null ) ; } V1Property property = properties . get ( <NUM_LIT:0> ) ; String name = property . getName ( ) ; if ( name . equals ( PROPERTY_NAME ) ) { propValue = property . getStringValue ( ) ; } else { WSRP1ExceptionFactory . throwWSException ( V1InconsistentParameters . class , "<STR_LIT>" + name + "<STR_LIT:'>" , null ) ; } } if ( ParameterValidation . existsAndIsNotEmpty ( resetProperties ) ) { if ( resetProperties . size ( ) != <NUM_LIT:1> ) { WSRP1ExceptionFactory . throwWSException ( V1InconsistentParameters . class , "<STR_LIT>" , null ) ; } V1ResetProperty resetProperty = resetProperties . get ( <NUM_LIT:0> ) ; String name = resetProperty . getName ( ) ; if ( name . equals ( PROPERTY_NAME ) ) { propValue = PROPERTY_VALUE ; } else { WSRP1ExceptionFactory . throwWSException ( V1InconsistentParameters . class , "<STR_LIT>" + name + "<STR_LIT:'>" , null ) ; } } portletHandle . value = handle ; } private String getHandleFrom ( V1PortletContext portletContext , String context ) throws V1MissingParameters , V1InvalidHandle { WSRP1ExceptionFactory . throwMissingParametersIfValueIsMissing ( portletContext , "<STR_LIT>" , context ) ; String handle = portletContext . getPortletHandle ( ) ; WSRP1ExceptionFactory . throwMissingParametersIfValueIsMissing ( handle , "<STR_LIT>" , "<STR_LIT>" ) ; if ( handle . length ( ) == <NUM_LIT:0> ) { throw WSRP1ExceptionFactory . throwWSException ( V1InvalidHandle . class , "<STR_LIT>" , null ) ; } return handle ; } @ Override public void destroyPortlets ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) V1RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) List < String > portletHandles , @ WebParam ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < List < V1DestroyFailed > > destroyFailed , @ WebParam ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < List < V1Extension > > extensions ) throws V1MissingParameters , V1InconsistentParameters , V1InvalidRegistration , V1OperationFailed { super . destroyPortlets ( registrationContext , portletHandles , destroyFailed , extensions ) ; WSRP1ExceptionFactory . throwMissingParametersIfValueIsMissing ( portletHandles , "<STR_LIT>" , "<STR_LIT>" ) ; if ( portletHandles . isEmpty ( ) ) { WSRP1ExceptionFactory . throwMissingParametersIfValueIsMissing ( portletHandles , "<STR_LIT>" , "<STR_LIT>" ) ; } List < V1DestroyFailed > list = destroyFailed . value ; if ( list == null ) { list = new ArrayList < V1DestroyFailed > ( ) ; destroyFailed . value = list ; } for ( String handle : portletHandles ) { if ( ! CLONED_HANDLE . equals ( handle ) ) { list . add ( WSRP1TypeFactory . createDestroyFailed ( handle , "<STR_LIT>" + handle + "<STR_LIT>" ) ) ; } } } } </s>
|
<s> package org . gatein . wsrp . test . protocol . v1 . behaviors ; import org . gatein . wsrp . spec . v1 . WSRP1ExceptionFactory ; import org . gatein . wsrp . test . protocol . v1 . BehaviorRegistry ; import org . oasis . wsrp . v1 . V1AccessDenied ; import org . oasis . wsrp . v1 . V1Extension ; import org . oasis . wsrp . v1 . V1InvalidRegistration ; import org . oasis . wsrp . v1 . V1OperationFailed ; import org . oasis . wsrp . v1 . V1RegistrationContext ; import javax . jws . WebParam ; import java . util . List ; public class PerGroupInitCookieMarkupBehavior extends InitCookieMarkupBehavior { public static final String PER_GROUP_INIT_COOKIE_HANDLE = "<STR_LIT>" ; public PerGroupInitCookieMarkupBehavior ( BehaviorRegistry registry ) { super ( registry ) ; } protected void initPortletHandle ( ) { portletHandle = PER_GROUP_INIT_COOKIE_HANDLE ; } @ Override public List < V1Extension > initCookie ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) V1RegistrationContext registrationContext ) throws V1InvalidRegistration , V1AccessDenied , V1OperationFailed { List < V1Extension > extensions = super . initCookie ( registrationContext ) ; if ( initCookieCallCount > <NUM_LIT:3> ) { throw WSRP1ExceptionFactory . throwWSException ( V1OperationFailed . class , "<STR_LIT>" , new IllegalStateException ( "<STR_LIT>" ) ) ; } return extensions ; } } </s>
|
<s> package org . gatein . wsrp . test . protocol . v1 ; import org . gatein . common . NotYetImplemented ; import org . gatein . common . util . Version ; import org . gatein . pc . api . Mode ; import org . gatein . pc . api . WindowState ; import org . gatein . wsrp . services . MarkupService ; import org . gatein . wsrp . services . PortletManagementService ; import org . gatein . wsrp . services . RegistrationService ; import org . gatein . wsrp . services . ServiceDescriptionService ; import org . gatein . wsrp . services . ServiceFactory ; import org . gatein . wsrp . services . v1 . V1MarkupService ; import org . gatein . wsrp . services . v1 . V1PortletManagementService ; import org . gatein . wsrp . services . v1 . V1RegistrationService ; import org . gatein . wsrp . services . v1 . V1ServiceDescriptionService ; import org . gatein . wsrp . test . support . RequestedMarkupBehavior ; import org . oasis . wsrp . v1 . V1AccessDenied ; import org . oasis . wsrp . v1 . V1GetMarkup ; import org . oasis . wsrp . v1 . V1InconsistentParameters ; import org . oasis . wsrp . v1 . V1InvalidCookie ; import org . oasis . wsrp . v1 . V1InvalidHandle ; import org . oasis . wsrp . v1 . V1InvalidRegistration ; import org . oasis . wsrp . v1 . V1InvalidSession ; import org . oasis . wsrp . v1 . V1InvalidUserCategory ; import org . oasis . wsrp . v1 . V1MissingParameters ; import org . oasis . wsrp . v1 . V1OperationFailed ; import org . oasis . wsrp . v1 . V1UnsupportedLocale ; import org . oasis . wsrp . v1 . V1UnsupportedMimeType ; import org . oasis . wsrp . v1 . V1UnsupportedMode ; import org . oasis . wsrp . v1 . V1UnsupportedWindowState ; import org . oasis . wsrp . v1 . WSRPV1MarkupPortType ; import org . oasis . wsrp . v1 . WSRPV1PortletManagementPortType ; import org . oasis . wsrp . v1 . WSRPV1RegistrationPortType ; import org . oasis . wsrp . v1 . WSRPV1ServiceDescriptionPortType ; public class BehaviorBackedServiceFactory implements ServiceFactory { private BehaviorRegistry registry ; private final static String MARKUP = "<STR_LIT>" ; private boolean initialized = false ; private String wsdl = DEFAULT_WSDL_URL ; public static final String DEFAULT_WSDL_URL = "<STR_LIT>" ; private int timeout ; public BehaviorBackedServiceFactory ( ) { this ( new BehaviorRegistry ( ) ) ; } public BehaviorBackedServiceFactory ( BehaviorRegistry registry ) { this . registry = registry ; registry . registerMarkupBehavior ( new SimpleMarkupBehavior ( ) ) ; } public < T > T getService ( Class < T > serviceClass ) throws Exception { if ( ! isAvailable ( ) && ! isFailed ( ) ) { start ( ) ; } if ( WSRPV1ServiceDescriptionPortType . class . isAssignableFrom ( serviceClass ) ) { return ( T ) registry . getServiceDescriptionBehavior ( ) ; } if ( WSRPV1MarkupPortType . class . isAssignableFrom ( serviceClass ) ) { String requestedMarkupBehavior = RequestedMarkupBehavior . getRequestedMarkupBehavior ( ) ; if ( requestedMarkupBehavior == null ) { requestedMarkupBehavior = MARKUP ; } return ( T ) registry . getMarkupBehaviorFor ( requestedMarkupBehavior ) ; } if ( WSRPV1PortletManagementPortType . class . isAssignableFrom ( serviceClass ) ) { return ( T ) registry . getPortletManagementBehavior ( ) ; } if ( WSRPV1RegistrationPortType . class . isAssignableFrom ( serviceClass ) ) { return ( T ) registry . getRegistrationBehavior ( ) ; } return null ; } public BehaviorRegistry getRegistry ( ) { return registry ; } public void setRegistry ( BehaviorRegistry registry ) { this . registry = registry ; } public boolean isAvailable ( ) { return initialized ; } public boolean isFailed ( ) { return false ; } public void setFailed ( boolean failed ) { } public void setWSOperationTimeOut ( int msBeforeTimeOut ) { if ( msBeforeTimeOut < <NUM_LIT:0> ) { msBeforeTimeOut = DEFAULT_TIMEOUT_MS ; } timeout = msBeforeTimeOut ; } public int getWSOperationTimeOut ( ) { return timeout ; } public ServiceDescriptionService getServiceDescriptionService ( ) throws Exception { return new V1ServiceDescriptionService ( getService ( WSRPV1ServiceDescriptionPortType . class ) ) ; } public MarkupService getMarkupService ( ) throws Exception { return new V1MarkupService ( getService ( WSRPV1MarkupPortType . class ) ) ; } public PortletManagementService getPortletManagementService ( ) throws Exception { return new V1PortletManagementService ( getService ( WSRPV1PortletManagementPortType . class ) ) ; } public RegistrationService getRegistrationService ( ) throws Exception { return new V1RegistrationService ( getService ( WSRPV1RegistrationPortType . class ) ) ; } public Version getWSRPVersion ( ) { return ServiceFactory . WSRP1 ; } public boolean refresh ( boolean force ) throws Exception { if ( force || ( ! isAvailable ( ) && ! isFailed ( ) ) ) { start ( ) ; return true ; } return false ; } public void create ( ) throws Exception { throw new NotYetImplemented ( ) ; } public void start ( ) throws Exception { initialized = true ; } public void stop ( ) { throw new NotYetImplemented ( ) ; } public void setWsdlDefinitionURL ( String wsdlDefinitionURL ) { wsdl = wsdlDefinitionURL ; } public String getWsdlDefinitionURL ( ) { return wsdl ; } public void destroy ( ) { throw new NotYetImplemented ( ) ; } private class SimpleMarkupBehavior extends MarkupBehavior { public SimpleMarkupBehavior ( ) { super ( BehaviorBackedServiceFactory . this . registry ) ; registerHandle ( MARKUP ) ; } @ Override protected String getMarkupString ( Mode mode , WindowState windowState , String navigationalState , V1GetMarkup getMarkup ) throws V1UnsupportedWindowState , V1InvalidCookie , V1InvalidSession , V1AccessDenied , V1InconsistentParameters , V1InvalidHandle , V1UnsupportedLocale , V1UnsupportedMode , V1OperationFailed , V1MissingParameters , V1InvalidUserCategory , V1InvalidRegistration , V1UnsupportedMimeType { return MARKUP ; } } public void enableWSS ( boolean enable ) { } public boolean isWSSEnabled ( ) { return false ; } public boolean isWSSAvailable ( ) { return false ; } } </s>
|
<s> package org . gatein . wsrp . test . protocol . v1 ; import org . gatein . common . net . media . MediaType ; import org . gatein . wsrp . WSRPConstants ; import org . gatein . wsrp . spec . v1 . WSRP1TypeFactory ; import org . oasis . wsrp . v1 . V1LocalizedString ; import org . oasis . wsrp . v1 . V1MarkupType ; import org . oasis . wsrp . v1 . V1PortletDescription ; public abstract class TestProducerBehavior { protected int callCount ; public static final String SAMPLE_DESCRIPTION = "<STR_LIT>" ; public static final String SAMPLE_SHORTTITLE = "<STR_LIT>" ; public static final String SAMPLE_TITLE = "<STR_LIT>" ; public static final String SAMPLE_DISPLAYNAME = "<STR_LIT>" ; public static final String SAMPLE_KEYWORD = "<STR_LIT>" ; public void incrementCallCount ( ) { callCount ++ ; } public int getCallCount ( ) { return callCount ; } public V1PortletDescription createPortletDescription ( String portletHandle , String suffix ) { V1PortletDescription portletDesc = new V1PortletDescription ( ) ; portletDesc . setPortletHandle ( portletHandle ) ; V1MarkupType markupType = new V1MarkupType ( ) ; markupType . setMimeType ( MediaType . TEXT_HTML . getValue ( ) ) ; markupType . getModes ( ) . add ( WSRPConstants . VIEW_MODE ) ; markupType . getWindowStates ( ) . add ( WSRPConstants . NORMAL_WINDOW_STATE ) ; markupType . getLocales ( ) . addAll ( WSRPConstants . getDefaultLocales ( ) ) ; portletDesc . getMarkupTypes ( ) . add ( markupType ) ; String suffixString = suffix == null ? "<STR_LIT>" : suffix ; portletDesc . setDescription ( createLocalizedString ( SAMPLE_DESCRIPTION + suffixString ) ) ; portletDesc . setTitle ( createLocalizedString ( SAMPLE_TITLE + suffixString ) ) ; portletDesc . setShortTitle ( createLocalizedString ( SAMPLE_SHORTTITLE + suffixString ) ) ; portletDesc . setDisplayName ( createLocalizedString ( SAMPLE_DISPLAYNAME + suffixString ) ) ; portletDesc . getKeywords ( ) . add ( createLocalizedString ( SAMPLE_KEYWORD + suffixString ) ) ; return portletDesc ; } public static V1LocalizedString createLocalizedString ( String value ) { return WSRP1TypeFactory . createLocalizedString ( value ) ; } public static String extractString ( org . gatein . common . i18n . LocalizedString ls ) { return ls . getPreferredOrBestLocalizedMappingFor ( new String [ ] { "<STR_LIT:en>" } ) . getString ( ) ; } } </s>
|
<s> package org . gatein . wsrp . test . protocol . v1 ; import org . oasis . wsrp . v1 . V1Extension ; import org . oasis . wsrp . v1 . V1InvalidRegistration ; import org . oasis . wsrp . v1 . V1MissingParameters ; import org . oasis . wsrp . v1 . V1OperationFailed ; import org . oasis . wsrp . v1 . V1Property ; import org . oasis . wsrp . v1 . V1RegistrationContext ; import org . oasis . wsrp . v1 . V1RegistrationData ; import org . oasis . wsrp . v1 . WSRPV1RegistrationPortType ; import javax . jws . WebParam ; import javax . xml . ws . Holder ; import java . util . List ; public class RegistrationBehavior extends TestProducerBehavior implements WSRPV1RegistrationPortType { public static final String REGISTRATION_HANDLE = "<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 { incrementCallCount ( ) ; registrationHandle . value = REGISTRATION_HANDLE ; } 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 { incrementCallCount ( ) ; } 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 { incrementCallCount ( ) ; } } </s>
|
<s> package org . gatein . wsrp . test . protocol . v1 ; import org . gatein . common . net . media . MediaType ; import org . gatein . pc . api . Mode ; import org . gatein . pc . api . WindowState ; import org . gatein . wsrp . WSRPUtils ; import org . gatein . wsrp . spec . v1 . WSRP1TypeFactory ; import org . oasis . wsrp . v1 . V1AccessDenied ; import org . oasis . wsrp . v1 . V1Extension ; import org . oasis . wsrp . v1 . V1GetMarkup ; import org . oasis . wsrp . v1 . V1InconsistentParameters ; import org . oasis . wsrp . v1 . V1InteractionParams ; import org . oasis . wsrp . v1 . V1InvalidCookie ; import org . oasis . wsrp . v1 . V1InvalidHandle ; import org . oasis . wsrp . v1 . V1InvalidRegistration ; import org . oasis . wsrp . v1 . V1InvalidSession ; import org . oasis . wsrp . v1 . V1InvalidUserCategory ; import org . oasis . wsrp . v1 . V1MarkupContext ; import org . oasis . wsrp . v1 . V1MarkupParams ; import org . oasis . wsrp . v1 . V1MarkupResponse ; import org . oasis . wsrp . v1 . V1MissingParameters ; import org . oasis . wsrp . v1 . V1OperationFailed ; import org . oasis . wsrp . v1 . V1PortletContext ; import org . oasis . wsrp . v1 . V1PortletDescription ; import org . oasis . wsrp . v1 . V1PortletStateChangeRequired ; import org . oasis . wsrp . v1 . V1RegistrationContext ; import org . oasis . wsrp . v1 . V1RuntimeContext ; import org . oasis . wsrp . v1 . V1SessionContext ; import org . oasis . wsrp . v1 . V1UnsupportedLocale ; import org . oasis . wsrp . v1 . V1UnsupportedMimeType ; import org . oasis . wsrp . v1 . V1UnsupportedMode ; import org . oasis . wsrp . v1 . V1UnsupportedWindowState ; import org . oasis . wsrp . v1 . V1UpdateResponse ; import org . oasis . wsrp . v1 . V1UserContext ; import org . oasis . wsrp . v1 . WSRPV1MarkupPortType ; import javax . jws . WebParam ; import javax . xml . ws . Holder ; import java . util . ArrayList ; import java . util . List ; public abstract class MarkupBehavior extends TestProducerBehavior implements WSRPV1MarkupPortType { private List < String > handles = new ArrayList < String > ( <NUM_LIT:3> ) ; private BehaviorRegistry registry ; protected MarkupBehavior ( BehaviorRegistry registry ) { this . registry = registry ; } protected abstract String getMarkupString ( Mode mode , WindowState windowState , String navigationalState , V1GetMarkup getMarkup ) throws V1UnsupportedWindowState , V1InvalidCookie , V1InvalidSession , V1AccessDenied , V1InconsistentParameters , V1InvalidHandle , V1UnsupportedLocale , V1UnsupportedMode , V1OperationFailed , V1MissingParameters , V1InvalidUserCategory , V1InvalidRegistration , V1UnsupportedMimeType ; public void modifyResponseIfNeeded ( V1MarkupResponse markupResponse ) { } public List < String > getSupportedHandles ( ) { return handles ; } public V1PortletDescription getPortletDescriptionFor ( String handle ) { if ( handles . contains ( handle ) ) { return createPortletDescription ( handle , getSuffixFor ( handle ) ) ; } throw new IllegalArgumentException ( "<STR_LIT>" + getClass ( ) . getName ( ) + "<STR_LIT>" + handle + "<STR_LIT:'>" ) ; } protected String getSuffixFor ( String handle ) { return "<STR_LIT>" ; } protected void registerHandle ( String handle ) { handles . add ( handle ) ; V1PortletDescription portletDescription = createPortletDescription ( handle , getSuffixFor ( handle ) ) ; registry . getServiceDescriptionBehavior ( ) . addPortletDescription ( portletDescription ) ; } 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 ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < V1UpdateResponse > updateResponse , @ WebParam ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < String > redirectURL , @ WebParam ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < List < V1Extension > > extensions ) throws V1UnsupportedMimeType , V1UnsupportedMode , V1UnsupportedWindowState , V1InvalidCookie , V1InvalidSession , V1MissingParameters , V1UnsupportedLocale , V1InconsistentParameters , V1PortletStateChangeRequired , V1InvalidHandle , V1InvalidRegistration , V1InvalidUserCategory , V1AccessDenied , V1OperationFailed { } public List < V1Extension > releaseSessions ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) V1RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) List < String > sessionIDs ) throws V1MissingParameters , V1InvalidRegistration , V1AccessDenied , V1OperationFailed { return null ; } 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 ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < V1MarkupContext > markupContext , @ WebParam ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < V1SessionContext > sessionContext , @ WebParam ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < List < V1Extension > > extensions ) throws V1UnsupportedMimeType , V1UnsupportedMode , V1UnsupportedWindowState , V1InvalidCookie , V1InvalidSession , V1MissingParameters , V1UnsupportedLocale , V1InconsistentParameters , V1InvalidHandle , V1InvalidRegistration , V1InvalidUserCategory , V1AccessDenied , V1OperationFailed { V1GetMarkup gm = new V1GetMarkup ( ) ; gm . setMarkupParams ( markupParams ) ; gm . setPortletContext ( portletContext ) ; gm . setRegistrationContext ( registrationContext ) ; gm . setRuntimeContext ( runtimeContext ) ; gm . setUserContext ( userContext ) ; String markupString = getMarkupString ( WSRPUtils . getJSR168PortletModeFromWSRPName ( markupParams . getMode ( ) ) , WSRPUtils . getJSR168WindowStateFromWSRPName ( markupParams . getWindowState ( ) ) , markupParams . getNavigationalState ( ) , gm ) ; markupContext . value = WSRP1TypeFactory . createMarkupContext ( MediaType . TEXT_HTML . getValue ( ) , markupString , null , null ) ; markupContext . value . setRequiresUrlRewriting ( Boolean . TRUE ) ; V1MarkupResponse markupResponse = WSRP1TypeFactory . createMarkupResponse ( markupContext . value ) ; modifyResponseIfNeeded ( markupResponse ) ; sessionContext . value = markupResponse . getSessionContext ( ) ; } public List < V1Extension > initCookie ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) V1RegistrationContext registrationContext ) throws V1InvalidRegistration , V1AccessDenied , V1OperationFailed { return null ; } } </s>
|
<s> package org . gatein . wsrp . test . protocol . v1 ; public interface TestWSRPProducer { void reset ( ) ; BehaviorRegistry getBehaviorRegistry ( ) ; void setCurrentMarkupBehaviorHandle ( String handle ) ; void setRequiresInitCookie ( String cookieProtocolAsString ) ; void usingStrictModeChangedTo ( boolean strictMode ) ; } </s>
|
<s> package org . gatein . wsrp . test . protocol . v1 ; import org . gatein . wsrp . WSRPConstants ; import org . gatein . wsrp . spec . v1 . WSRP1TypeFactory ; import org . oasis . wsrp . v1 . V1CookieProtocol ; import org . oasis . wsrp . v1 . V1Extension ; import org . oasis . wsrp . v1 . V1InvalidRegistration ; import org . oasis . wsrp . v1 . V1ItemDescription ; import org . oasis . wsrp . v1 . V1ModelDescription ; import org . oasis . wsrp . v1 . V1OperationFailed ; import org . oasis . wsrp . v1 . V1PortletDescription ; import org . oasis . wsrp . v1 . V1PropertyDescription ; import org . oasis . wsrp . v1 . V1RegistrationContext ; import org . oasis . wsrp . v1 . V1ResourceList ; import org . oasis . wsrp . v1 . V1ServiceDescription ; import org . oasis . wsrp . v1 . WSRPV1ServiceDescriptionPortType ; import javax . jws . WebParam ; import javax . xml . ws . Holder ; import java . util . ArrayList ; import java . util . HashSet ; import java . util . LinkedList ; import java . util . List ; import java . util . Set ; public class ServiceDescriptionBehavior extends TestProducerBehavior implements WSRPV1ServiceDescriptionPortType { protected V1ServiceDescription serviceDescription ; private static final V1ServiceDescription DEFAULT_SERVICE_DESCRIPTION = WSRP1TypeFactory . createServiceDescription ( false ) ; public static final ServiceDescriptionBehavior DEFAULT = new ServiceDescriptionBehavior ( ) ; protected List < V1PortletDescription > offeredPortlets ; private boolean requiresRegistration ; private V1CookieProtocol cookieProtocol ; private V1ModelDescription registrationProperties ; public ServiceDescriptionBehavior ( ) { offeredPortlets = new LinkedList < V1PortletDescription > ( ) ; } public void setRequiresRegistration ( boolean requiresRegistration ) { this . requiresRegistration = requiresRegistration ; } public void setRequiresInitCookie ( V1CookieProtocol requiresInitCookie ) { this . cookieProtocol = requiresInitCookie ; } public void setServiceDescription ( boolean requiresRegistration , int numberOfProps ) { V1ServiceDescription sd = createServiceDescription ( requiresRegistration , numberOfProps ) ; offeredPortlets = sd . getOfferedPortlets ( ) ; this . requiresRegistration = sd . isRequiresRegistration ( ) ; registrationProperties = sd . getRegistrationPropertyDescription ( ) ; } public static V1ServiceDescription getDefaultServiceDescription ( ) { return DEFAULT_SERVICE_DESCRIPTION ; } public void addPortletDescription ( V1PortletDescription portletDescription ) { offeredPortlets . add ( portletDescription ) ; } public Set < String > getPortletHandles ( ) { Set < String > handles = new HashSet < String > ( offeredPortlets . size ( ) ) ; for ( V1PortletDescription description : offeredPortlets ) { handles . add ( description . getPortletHandle ( ) ) ; } return handles ; } public int getPortletNumber ( ) { return offeredPortlets . size ( ) ; } public static V1ServiceDescription createServiceDescription ( boolean requiresRegistration , int numberOfProperties ) { V1ServiceDescription sd = WSRP1TypeFactory . createServiceDescription ( requiresRegistration ) ; if ( requiresRegistration ) { List < V1PropertyDescription > descriptions = new ArrayList < V1PropertyDescription > ( numberOfProperties ) ; for ( int i = <NUM_LIT:0> ; i < numberOfProperties ; i ++ ) { descriptions . add ( WSRP1TypeFactory . createPropertyDescription ( "<STR_LIT>" + i , WSRPConstants . XSD_STRING ) ) ; } sd . setRegistrationPropertyDescription ( WSRP1TypeFactory . createModelDescription ( descriptions ) ) ; } return sd ; } public void getServiceDescription ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) V1RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) List < String > desiredLocales , @ WebParam ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < Boolean > requiresRegistration , @ WebParam ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < List < V1PortletDescription > > offeredPortlets , @ WebParam ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < List < V1ItemDescription > > userCategoryDescriptions , @ WebParam ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < List < V1ItemDescription > > customUserProfileItemDescriptions , @ WebParam ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < List < V1ItemDescription > > customWindowStateDescriptions , @ WebParam ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < List < V1ItemDescription > > customModeDescriptions , @ WebParam ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < V1CookieProtocol > requiresInitCookie , @ WebParam ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < V1ModelDescription > registrationPropertyDescription , @ WebParam ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < List < String > > locales , @ WebParam ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < V1ResourceList > resourceList , @ WebParam ( mode = WebParam . Mode . OUT , name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Holder < List < V1Extension > > extensions ) throws V1InvalidRegistration , V1OperationFailed { incrementCallCount ( ) ; offeredPortlets . value = this . offeredPortlets ; requiresRegistration . value = this . requiresRegistration ; requiresInitCookie . value = this . cookieProtocol ; registrationPropertyDescription . value = registrationProperties ; } } </s>
|
<s> package org . gatein . wsrp . consumer ; import junit . framework . TestCase ; import org . gatein . pc . api . InvokerUnavailableException ; import org . gatein . wsrp . services . ServiceFactory ; import org . gatein . wsrp . test . protocol . v2 . BehaviorBackedServiceFactory ; public class EndpointConfigurationInfoTestCase extends TestCase { private EndpointConfigurationInfo info ; private String url = "<STR_LIT>" ; protected void setUp ( ) throws Exception { info = new EndpointConfigurationInfo ( new BehaviorBackedServiceFactory ( ) ) ; } public void testSetWSDLURL ( ) throws InvokerUnavailableException { String bea = "<STR_LIT>" ; info . setWsdlDefinitionURL ( bea ) ; assertEquals ( bea , info . getWsdlDefinitionURL ( ) ) ; } public void testSetWSDLURLDoesNotTriggerWSDLRetrieval ( ) { info . setWsdlDefinitionURL ( url ) ; assertEquals ( url , info . getWsdlDefinitionURL ( ) ) ; } public void testRefreshWSDL ( ) throws Exception { assertTrue ( info . isRefreshNeeded ( ) ) ; assertFalse ( info . isAvailable ( ) ) ; String bea = "<STR_LIT>" ; info . setWsdlDefinitionURL ( bea ) ; assertTrue ( info . refresh ( ) ) ; assertFalse ( info . isRefreshNeeded ( ) ) ; assertTrue ( info . isAvailable ( ) ) ; } public void testGetRemoteHost ( ) { String bea = "<STR_LIT>" ; info . setWsdlDefinitionURL ( bea ) ; assertEquals ( "<STR_LIT>" , info . getRemoteHostAddress ( ) ) ; } public void testGetServiceFactory ( ) throws Exception { assertTrue ( info . isRefreshNeeded ( ) ) ; assertFalse ( info . isAvailable ( ) ) ; ServiceFactory factory = info . getServiceFactory ( ) ; assertNotNull ( factory ) ; assertFalse ( info . isRefreshNeeded ( ) ) ; assertTrue ( info . isAvailable ( ) ) ; assertTrue ( factory . isAvailable ( ) ) ; } } </s>
|
<s> package org . gatein . wsrp . consumer . services ; import junit . framework . TestCase ; import org . gatein . wsrp . services . SOAPServiceFactory ; import org . oasis . wsrp . v1 . WSRPV1MarkupPortType ; import org . oasis . wsrp . v1 . WSRPV1PortletManagementPortType ; import org . oasis . wsrp . v1 . WSRPV1RegistrationPortType ; import org . oasis . wsrp . v1 . WSRPV1ServiceDescriptionPortType ; import org . oasis . wsrp . v2 . WSRPV2MarkupPortType ; import org . oasis . wsrp . v2 . WSRPV2PortletManagementPortType ; import org . oasis . wsrp . v2 . WSRPV2RegistrationPortType ; import org . oasis . wsrp . v2 . WSRPV2ServiceDescriptionPortType ; import javax . wsdl . WSDLException ; import java . net . URL ; public class SOAPServiceFactoryTestCase extends TestCase { private SOAPServiceFactory factory ; public static final Class [ ] WSRP2_PORT_TYPES = new Class [ ] { WSRPV2MarkupPortType . class , WSRPV2ServiceDescriptionPortType . class , WSRPV2PortletManagementPortType . class , WSRPV2RegistrationPortType . class } ; public static final Class [ ] WSRP1_PORT_TYPES = new Class [ ] { WSRPV1MarkupPortType . class , WSRPV1ServiceDescriptionPortType . class , WSRPV1PortletManagementPortType . class , WSRPV1RegistrationPortType . class } ; @ Override protected void setUp ( ) throws Exception { factory = new SOAPServiceFactory ( ) ; } private String getWSDLURL ( String fileName ) { URL url = Thread . currentThread ( ) . getContextClassLoader ( ) . getResource ( fileName ) ; return url . toExternalForm ( ) ; } public void testMissingMandatoryPort ( ) throws Exception { factory . setWsdlDefinitionURL ( getWSDLURL ( "<STR_LIT>" ) ) ; try { checkPorts ( WSRP2_PORT_TYPES ) ; fail ( ) ; } catch ( IllegalArgumentException e ) { } } public void testV2ServiceWithExtraPorts ( ) throws Exception { factory . setWsdlDefinitionURL ( getWSDLURL ( "<STR_LIT>" ) ) ; checkPorts ( WSRP2_PORT_TYPES ) ; } public void testWebsphere ( ) throws Exception { factory . setWsdlDefinitionURL ( getWSDLURL ( "<STR_LIT>" ) ) ; checkPorts ( WSRPV2MarkupPortType . class , WSRPV2ServiceDescriptionPortType . class , WSRPV2PortletManagementPortType . class ) ; } public void testSimpleV2Service ( ) throws Exception { factory . setWsdlDefinitionURL ( getWSDLURL ( "<STR_LIT>" ) ) ; checkPorts ( WSRP2_PORT_TYPES ) ; } public void testSimpleV1Service ( ) throws Exception { factory . setWsdlDefinitionURL ( getWSDLURL ( "<STR_LIT>" ) ) ; checkPorts ( WSRP1_PORT_TYPES ) ; } public void testBothServices ( ) throws Exception { factory . setWsdlDefinitionURL ( getWSDLURL ( "<STR_LIT>" ) ) ; checkPorts ( WSRP2_PORT_TYPES ) ; } public void testDefaultDotNetWSDLCompositeService ( ) throws Exception { factory . setWsdlDefinitionURL ( getWSDLURL ( "<STR_LIT>" ) ) ; try { checkPorts ( WSRP2_PORT_TYPES ) ; fail ( ) ; } catch ( Exception e ) { assertTrue ( e instanceof WSDLException ) ; WSDLException wsdlEx = ( WSDLException ) e ; assertEquals ( WSDLException . OTHER_ERROR , wsdlEx . getFaultCode ( ) ) ; } } private void checkPorts ( Class ... ports ) throws Exception { for ( Class portClass : ports ) { assertNotNull ( factory . getService ( portClass ) ) ; } } } </s>
|
<s> package org . gatein . wsrp . consumer . handlers ; import junit . framework . TestCase ; import org . gatein . pc . api . PortletContext ; import org . gatein . pc . api . PortletInvokerException ; import org . gatein . pc . api . URLFormat ; import org . gatein . pc . api . invocation . PortletInvocation ; import org . gatein . pc . api . invocation . response . ContentResponse ; import org . gatein . pc . api . invocation . response . PortletInvocationResponse ; import org . gatein . wsrp . WSRPResourceURL ; import org . gatein . wsrp . WSRPRewritingConstants ; import org . gatein . wsrp . WSRPTypeFactory ; import org . gatein . wsrp . test . ExtendedAssert ; import org . gatein . wsrp . test . support . MockWSRPConsumer ; import org . gatein . wsrp . test . support . TestPortletInvocationContext ; import org . gatein . wsrp . test . support . TestRenderInvocation ; import org . gatein . wsrp . test . support . TestResourceInvocation ; import org . gatein . wsrp . test . support . TestWindowContext ; import org . oasis . wsrp . v2 . MarkupContext ; import org . oasis . wsrp . v2 . MimeResponse ; import org . oasis . wsrp . v2 . ResourceContext ; import java . io . UnsupportedEncodingException ; import java . net . URL ; public class MimeResponseHandlerTestCase extends TestCase { public static final String NAMESPACE = "<STR_LIT>" ; public static final String PORTLETID = "<STR_LIT>" ; public static final MockWSRPConsumer CONSUMER = new MockWSRPConsumer ( "<STR_LIT:foo>" ) ; public static final PortletContext PORTLET_CONTEXT = PortletContext . createPortletContext ( PORTLETID , false ) ; public static final TestPortletInvocationContext CONTEXT = new TestPortletInvocationContext ( ) ; public static final URLFormat FORMAT = new URLFormat ( false , false , true , true ) ; @ Override protected void setUp ( ) throws Exception { CONSUMER . setUsingWSRP2 ( true ) ; } public void testProcessMarkupV1 ( ) { CONSUMER . setUsingWSRP2 ( false ) ; String markup ; String expected ; markup = "<STR_LIT>" + "<STR_LIT>" ; expected = "<STR_LIT>" + "<STR_LIT>" ; processMarkupAndCheck ( markup , expected ) ; markup = "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" ; expected = "<STR_LIT>" + NAMESPACE + "<STR_LIT>" + "<STR_LIT>" ; processMarkupAndCheck ( markup , expected ) ; } public void testProcessMarkupV2 ( ) { String markup ; String expected ; markup = "<STR_LIT>" + "<STR_LIT>" ; expected = "<STR_LIT>" + "<STR_LIT>" ; processMarkupAndCheck ( markup , expected ) ; markup = "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" ; expected = "<STR_LIT>" + NAMESPACE + "<STR_LIT>" + "<STR_LIT>" ; processMarkupAndCheck ( markup , expected ) ; } public void testURLEscaping ( ) throws Exception { String markup ; String expected ; String resourceID = WSRPResourceURL . encodeResource ( null , new URL ( "<STR_LIT>" ) , false ) ; markup = "<STR_LIT>" ; expected = "<STR_LIT>" + resourceID + "<STR_LIT>" ; processMarkupAndCheck ( markup , expected ) ; markup = "<STR_LIT>" ; expected = "<STR_LIT>" + resourceID + "<STR_LIT>" ; processMarkupAndCheck ( markup , expected ) ; markup = "<STR_LIT>" ; expected = "<STR_LIT>" + resourceID + "<STR_LIT>" ; processMarkupAndCheck ( markup , expected ) ; } public void testRegularURLIsNotAffected ( ) { String markup ; markup = "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" ; processMarkupAndCheck ( markup , markup ) ; } public void testRewritingRequiredWithBinaryContent ( ) throws UnsupportedEncodingException , PortletInvokerException { String expected = "<STR_LIT>" + "<STR_LIT:.>" + TestWindowContext . NAMESPACE + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT:}>" ; byte [ ] expectedBinary = expected . getBytes ( "<STR_LIT:UTF-8>" ) ; String original = "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT:}>" ; byte [ ] originalBinary = original . getBytes ( "<STR_LIT:UTF-8>" ) ; processBinaryAndCheck ( expectedBinary , new RenderHandler ( CONSUMER ) , new TestRenderInvocation ( CONTEXT ) , WSRPTypeFactory . createMimeResponse ( "<STR_LIT>" , null , originalBinary , MarkupContext . class ) ) ; processBinaryAndCheck ( expectedBinary , new ResourceHandler ( CONSUMER ) , new TestResourceInvocation ( CONTEXT ) , WSRPTypeFactory . createMimeResponse ( "<STR_LIT>" , null , originalBinary , ResourceContext . class ) ) ; original = "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT:}>" ; originalBinary = original . getBytes ( "<STR_LIT:UTF-8>" ) ; expected = "<STR_LIT>" + "<STR_LIT>" + TestWindowContext . NAMESPACE + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT:}>" ; expectedBinary = expected . getBytes ( "<STR_LIT:UTF-8>" ) ; processBinaryAndCheck ( expectedBinary , new RenderHandler ( CONSUMER ) , new TestRenderInvocation ( CONTEXT ) , WSRPTypeFactory . createMimeResponse ( "<STR_LIT>" , null , originalBinary , MarkupContext . class ) ) ; processBinaryAndCheck ( expectedBinary , new ResourceHandler ( CONSUMER ) , new TestResourceInvocation ( CONTEXT ) , WSRPTypeFactory . createMimeResponse ( "<STR_LIT>" , null , originalBinary , ResourceContext . class ) ) ; } private void processBinaryAndCheck ( byte [ ] expectedBinary , final MimeResponseHandler handler , final PortletInvocation invocation , final MimeResponse mimeResponse ) throws PortletInvokerException { mimeResponse . setRequiresRewriting ( true ) ; PortletInvocationResponse response = handler . rewriteResponseIfNeeded ( mimeResponse , invocation ) ; assertTrue ( response instanceof ContentResponse ) ; ContentResponse contentResponse = ( ContentResponse ) response ; ExtendedAssert . assertEquals ( expectedBinary , contentResponse . getBytes ( ) ) ; } private void processMarkupAndCheck ( String markup , String expected ) { String result = MimeResponseHandler . processMarkup ( markup , NAMESPACE , CONTEXT , PORTLET_CONTEXT , FORMAT , CONSUMER ) ; assertEquals ( expected , result ) ; } private String getResourceURL ( String encodedURL , boolean requiresRewrite ) { String result = WSRPRewritingConstants . FAKE_RESOURCE_URL . replace ( WSRPRewritingConstants . WSRP_URL , encodedURL ) ; result = result . replace ( WSRPRewritingConstants . WSRP_REQUIRES_REWRITE , Boolean . toString ( requiresRewrite ) ) ; return result ; } } </s>
|
<s> package org . gatein . wsrp . consumer ; import junit . framework . TestCase ; import org . gatein . pc . api . Portlet ; import org . gatein . pc . api . PortletInvokerException ; import org . gatein . wsrp . spec . v2 . WSRP2Constants ; import org . gatein . wsrp . spec . v2 . WSRP2ExceptionFactory ; import org . gatein . wsrp . test . protocol . v2 . BehaviorBackedServiceFactory ; import org . gatein . wsrp . test . protocol . v2 . PortletManagementBehavior ; import org . gatein . wsrp . test . protocol . v2 . RegistrationBehavior ; import org . gatein . wsrp . test . protocol . v2 . ServiceDescriptionBehavior ; import org . gatein . wsrp . test . protocol . v2 . behaviors . GroupedPortletsServiceDescriptionBehavior ; import org . gatein . wsrp . test . protocol . v2 . behaviors . SupportedOptionsServiceDescriptionBehavior ; import org . gatein . wsrp . test . support . MockConsumerRegistry ; import org . oasis . wsrp . v2 . AccessDenied ; import org . oasis . wsrp . v2 . CookieProtocol ; import org . oasis . wsrp . v2 . Extension ; import org . oasis . wsrp . v2 . InconsistentParameters ; import org . oasis . wsrp . v2 . InvalidHandle ; import org . oasis . wsrp . v2 . InvalidRegistration ; import org . oasis . wsrp . v2 . InvalidUserCategory ; import org . oasis . wsrp . v2 . Lifetime ; import org . oasis . wsrp . v2 . MissingParameters ; import org . oasis . wsrp . v2 . ModifyRegistrationRequired ; import org . oasis . wsrp . v2 . OperationFailed ; import org . oasis . wsrp . v2 . OperationNotSupported ; import org . oasis . wsrp . v2 . PortletContext ; import org . oasis . wsrp . v2 . PortletDescription ; import org . oasis . wsrp . v2 . Property ; import org . oasis . wsrp . v2 . RegistrationContext ; import org . oasis . wsrp . v2 . RegistrationData ; import org . oasis . wsrp . v2 . ResourceList ; import org . oasis . wsrp . v2 . ResourceSuspended ; import org . oasis . wsrp . v2 . UserContext ; import javax . jws . WebParam ; import javax . xml . namespace . QName ; import javax . xml . ws . Holder ; import java . util . ArrayList ; import java . util . Collection ; import java . util . List ; public class ProducerInfoTestCase extends TestCase { private ProducerInfo info ; private BehaviorBackedServiceFactory serviceFactory ; protected void setUp ( ) throws Exception { info = new ProducerInfo ( new MockConsumerRegistry ( ) ) ; info . setId ( "<STR_LIT:test>" ) ; info . setKey ( "<STR_LIT:key>" ) ; serviceFactory = new BehaviorBackedServiceFactory ( ) ; EndpointConfigurationInfo eci = new EndpointConfigurationInfo ( serviceFactory ) ; info . setEndpointConfigurationInfo ( eci ) ; } public void testSettersWithoutModificationShouldNotChangeLastModified ( ) { final long initial = info . getLastModified ( ) ; info . setActive ( info . isActive ( ) ) ; assertEquals ( initial , info . getLastModified ( ) ) ; info . setActiveAndSave ( info . isActive ( ) ) ; assertEquals ( initial , info . getLastModified ( ) ) ; info . setExpirationCacheSeconds ( info . getExpirationCacheSeconds ( ) ) ; assertEquals ( initial , info . getLastModified ( ) ) ; info . setId ( info . getId ( ) ) ; assertEquals ( initial , info . getLastModified ( ) ) ; info . setModifyRegistrationRequired ( info . isModifyRegistrationRequired ( ) ) ; assertEquals ( initial , info . getLastModified ( ) ) ; } public void testSettersWithModificationShouldChangeLastModified ( ) throws InterruptedException { long initial = info . getLastModified ( ) ; Thread . sleep ( <NUM_LIT:10> ) ; info . setActive ( ! info . isActive ( ) ) ; initial = info . getLastModified ( ) ; Thread . sleep ( <NUM_LIT:10> ) ; info . setActiveAndSave ( ! info . isActive ( ) ) ; assertTrue ( initial != info . getLastModified ( ) ) ; initial = info . getLastModified ( ) ; Thread . sleep ( <NUM_LIT:10> ) ; info . setExpirationCacheSeconds ( info . getExpirationCacheSeconds ( ) + <NUM_LIT:1> ) ; assertTrue ( initial != info . getLastModified ( ) ) ; initial = info . getLastModified ( ) ; Thread . sleep ( <NUM_LIT:10> ) ; info . setId ( info . getId ( ) + "<STR_LIT>" ) ; assertTrue ( initial != info . getLastModified ( ) ) ; initial = info . getLastModified ( ) ; Thread . sleep ( <NUM_LIT:10> ) ; info . setModifyRegistrationRequired ( ! info . isModifyRegistrationRequired ( ) ) ; assertTrue ( initial != info . getLastModified ( ) ) ; } public void testSetKeyDoesNotChangeLastModified ( ) { long initial = info . getLastModified ( ) ; info . setKey ( info . getKey ( ) ) ; assertEquals ( initial , info . getLastModified ( ) ) ; initial = info . getLastModified ( ) ; info . setKey ( info . getKey ( ) + "<STR_LIT>" ) ; assertEquals ( initial , info . getLastModified ( ) ) ; } public void testSetRegistrationInfo ( ) { RegistrationInfo regInfo = new RegistrationInfo ( info ) ; assertEquals ( regInfo , info . getRegistrationInfo ( ) ) ; assertEquals ( info , regInfo . getParent ( ) ) ; RegistrationInfo regInfo2 = new RegistrationInfo ( ) ; assertEquals ( regInfo , info . getRegistrationInfo ( ) ) ; assertNull ( regInfo2 . getParent ( ) ) ; info . setRegistrationInfo ( regInfo2 ) ; assertEquals ( regInfo2 , info . getRegistrationInfo ( ) ) ; assertEquals ( info , regInfo2 . getParent ( ) ) ; } public void testRefreshDidNotHappenIfFailure ( ) throws PortletInvokerException { serviceFactory . setFailed ( true ) ; final boolean refresh = info . refresh ( false ) ; assertFalse ( refresh ) ; } public void testSetNullRegistrationInfo ( ) { try { info . setRegistrationInfo ( null ) ; fail ( "<STR_LIT>" ) ; } catch ( IllegalArgumentException expected ) { } } public void testSetEndpointConfigurationInfo ( ) { EndpointConfigurationInfo endInfo = new EndpointConfigurationInfo ( ) ; info . setEndpointConfigurationInfo ( endInfo ) ; assertEquals ( endInfo , info . getEndpointConfigurationInfo ( ) ) ; } public void testSetNullEndpointConfigurationInfo ( ) { try { info . setEndpointConfigurationInfo ( null ) ; fail ( "<STR_LIT>" ) ; } catch ( IllegalArgumentException expected ) { } } public void testSetNullCache ( ) throws PortletInvokerException { ServiceDescriptionBehavior behavior = new ServiceDescriptionBehavior ( ) ; serviceFactory . getRegistry ( ) . setServiceDescriptionBehavior ( behavior ) ; assertEquals ( ProducerInfo . DEFAULT_CACHE_VALUE , info . getExpirationCacheSeconds ( ) ) ; info . setExpirationCacheSeconds ( null ) ; assertNull ( info . getExpirationCacheSeconds ( ) ) ; assertTrue ( info . isRefreshNeeded ( false ) ) ; assertFalse ( info . isRegistrationChecked ( ) ) ; assertTrue ( info . refresh ( false ) ) ; assertFalse ( info . isRefreshNeeded ( false ) ) ; assertTrue ( info . isRegistrationChecked ( ) ) ; assertTrue ( info . refresh ( false ) ) ; assertFalse ( info . isRefreshNeeded ( false ) ) ; assertTrue ( info . isRegistrationChecked ( ) ) ; assertEquals ( <NUM_LIT:2> , behavior . getCallCount ( ) ) ; } public void testSetNegativeCache ( ) throws PortletInvokerException { ServiceDescriptionBehavior behavior = new ServiceDescriptionBehavior ( ) ; serviceFactory . getRegistry ( ) . setServiceDescriptionBehavior ( behavior ) ; assertEquals ( ProducerInfo . DEFAULT_CACHE_VALUE , info . getExpirationCacheSeconds ( ) ) ; info . setExpirationCacheSeconds ( - <NUM_LIT:100> ) ; assertEquals ( new Integer ( - <NUM_LIT:100> ) , info . getExpirationCacheSeconds ( ) ) ; assertTrue ( info . isRefreshNeeded ( false ) ) ; assertFalse ( info . isRegistrationChecked ( ) ) ; assertTrue ( info . refresh ( false ) ) ; assertFalse ( info . isRefreshNeeded ( false ) ) ; assertTrue ( info . isRegistrationChecked ( ) ) ; assertTrue ( info . refresh ( false ) ) ; assertFalse ( info . isRefreshNeeded ( false ) ) ; assertTrue ( info . isRegistrationChecked ( ) ) ; assertEquals ( <NUM_LIT:2> , behavior . getCallCount ( ) ) ; } public void testSetZeroCache ( ) throws PortletInvokerException { ServiceDescriptionBehavior behavior = new ServiceDescriptionBehavior ( ) ; serviceFactory . getRegistry ( ) . setServiceDescriptionBehavior ( behavior ) ; assertEquals ( ProducerInfo . DEFAULT_CACHE_VALUE , info . getExpirationCacheSeconds ( ) ) ; info . setExpirationCacheSeconds ( <NUM_LIT:0> ) ; assertEquals ( new Integer ( <NUM_LIT:0> ) , info . getExpirationCacheSeconds ( ) ) ; assertTrue ( info . isRefreshNeeded ( false ) ) ; assertFalse ( info . isRegistrationChecked ( ) ) ; assertTrue ( info . refresh ( false ) ) ; assertFalse ( info . isRefreshNeeded ( false ) ) ; assertTrue ( info . isRegistrationChecked ( ) ) ; assertTrue ( info . refresh ( false ) ) ; assertFalse ( info . isRefreshNeeded ( false ) ) ; assertTrue ( info . isRegistrationChecked ( ) ) ; assertEquals ( <NUM_LIT:2> , behavior . getCallCount ( ) ) ; } public void testCacheTransitions ( ) throws Exception { ServiceDescriptionBehavior behavior = new ServiceDescriptionBehavior ( ) ; serviceFactory . getRegistry ( ) . setServiceDescriptionBehavior ( behavior ) ; assertEquals ( ProducerInfo . DEFAULT_CACHE_VALUE , info . getExpirationCacheSeconds ( ) ) ; info . setExpirationCacheSeconds ( null ) ; assertNull ( info . getExpirationCacheSeconds ( ) ) ; assertTrue ( info . isRefreshNeeded ( false ) ) ; assertFalse ( info . isRegistrationChecked ( ) ) ; assertTrue ( info . refresh ( false ) ) ; assertFalse ( info . isRefreshNeeded ( false ) ) ; assertTrue ( info . isRegistrationChecked ( ) ) ; assertTrue ( info . refresh ( false ) ) ; assertFalse ( info . isRefreshNeeded ( false ) ) ; assertTrue ( info . isRegistrationChecked ( ) ) ; assertEquals ( <NUM_LIT:2> , behavior . getCallCount ( ) ) ; Thread . sleep ( <NUM_LIT:10> ) ; info . setExpirationCacheSeconds ( <NUM_LIT:1> ) ; assertEquals ( new Integer ( <NUM_LIT:1> ) , info . getExpirationCacheSeconds ( ) ) ; assertFalse ( "<STR_LIT>" , info . refresh ( false ) ) ; assertFalse ( info . isRefreshNeeded ( false ) ) ; assertTrue ( info . isRegistrationChecked ( ) ) ; assertEquals ( <NUM_LIT:2> , behavior . getCallCount ( ) ) ; Thread . sleep ( <NUM_LIT> ) ; assertFalse ( "<STR_LIT>" , info . isRefreshNeeded ( false ) ) ; assertTrue ( "<STR_LIT>" , info . isRefreshNeeded ( true ) ) ; assertTrue ( info . refresh ( false ) ) ; assertFalse ( "<STR_LIT>" , info . isRefreshNeeded ( true ) ) ; assertTrue ( info . isRegistrationChecked ( ) ) ; assertFalse ( info . refresh ( false ) ) ; assertTrue ( info . refresh ( true ) ) ; assertFalse ( info . isRefreshNeeded ( false ) ) ; assertTrue ( info . isRegistrationChecked ( ) ) ; assertEquals ( <NUM_LIT:4> , behavior . getCallCount ( ) ) ; Thread . sleep ( <NUM_LIT:10> ) ; info . setExpirationCacheSeconds ( <NUM_LIT:0> ) ; assertEquals ( new Integer ( <NUM_LIT:0> ) , info . getExpirationCacheSeconds ( ) ) ; assertTrue ( info . refresh ( false ) ) ; assertTrue ( info . refresh ( false ) ) ; assertFalse ( "<STR_LIT>" , info . isRefreshNeeded ( false ) ) ; assertTrue ( info . isRefreshNeeded ( true ) ) ; assertTrue ( info . isRegistrationChecked ( ) ) ; assertEquals ( <NUM_LIT:6> , behavior . getCallCount ( ) ) ; } public void testGetPortlet ( ) throws Exception { ServiceDescriptionBehavior behavior = new ServiceDescriptionBehavior ( ) ; behavior . addPortletDescription ( behavior . createPortletDescription ( "<STR_LIT:test>" , null ) ) ; serviceFactory . getRegistry ( ) . setServiceDescriptionBehavior ( behavior ) ; info . setExpirationCacheSeconds ( <NUM_LIT:1000> ) ; org . gatein . pc . api . PortletContext portletContext = org . gatein . pc . api . PortletContext . createPortletContext ( "<STR_LIT:test>" , false ) ; Portlet portlet = info . getPortlet ( portletContext ) ; assertNotNull ( portlet ) ; assertEquals ( portletContext , portlet . getContext ( ) ) ; assertEquals ( <NUM_LIT:1> , behavior . getCallCount ( ) ) ; portletContext = org . gatein . pc . api . PortletContext . createPortletContext ( TestPortletManagementBehavior . HANDLE_FOR_GET_DESCRIPTION , false ) ; TestPortletManagementBehavior pmBehavior = new TestPortletManagementBehavior ( ) ; serviceFactory . getRegistry ( ) . setPortletManagementBehavior ( pmBehavior ) ; portlet = info . getPortlet ( portletContext ) ; assertEquals ( <NUM_LIT:1> , pmBehavior . getCallCount ( ) ) ; assertNotNull ( portlet ) ; assertEquals ( portletContext , portlet . getContext ( ) ) ; serviceFactory . getRegistry ( ) . setPortletManagementBehavior ( null ) ; final String handle = "<STR_LIT>" ; behavior . addPortletDescription ( behavior . createPortletDescription ( handle , null ) ) ; portletContext = org . gatein . pc . api . PortletContext . createPortletContext ( handle , false ) ; portlet = info . getPortlet ( portletContext ) ; assertEquals ( <NUM_LIT:2> , behavior . getCallCount ( ) ) ; assertNotNull ( portlet ) ; assertEquals ( portletContext , portlet . getContext ( ) ) ; } public void testRefreshAndRegistration ( ) throws Exception { assertFalse ( info . isRegistered ( ) ) ; RegistrationInfo regInfo = info . getRegistrationInfo ( ) ; assertTrue ( regInfo . isUndetermined ( ) ) ; ServiceDescriptionBehavior sd = new ServiceDescriptionBehavior ( ) ; sd . setRequiresRegistration ( true ) ; serviceFactory . getRegistry ( ) . setServiceDescriptionBehavior ( sd ) ; RegistrationBehavior regBehavior = new RegistrationBehavior ( ) ; serviceFactory . getRegistry ( ) . setRegistrationBehavior ( regBehavior ) ; assertTrue ( info . refresh ( false ) ) ; assertEquals ( <NUM_LIT:1> , regBehavior . getCallCount ( ) ) ; assertTrue ( info . isRegistered ( ) ) ; assertNotNull ( info . getRegistrationInfo ( ) ) ; assertEquals ( RegistrationBehavior . REGISTRATION_HANDLE , info . getRegistrationContext ( ) . getRegistrationHandle ( ) ) ; assertTrue ( info . refresh ( true ) ) ; assertEquals ( <NUM_LIT:1> , regBehavior . getCallCount ( ) ) ; } public void testGetRegistrationContext ( ) throws Exception { assertFalse ( info . isRegistered ( ) ) ; RegistrationInfo regInfo = info . getRegistrationInfo ( ) ; assertTrue ( regInfo . isUndetermined ( ) ) ; ServiceDescriptionBehavior sd = new ServiceDescriptionBehavior ( ) ; sd . setRequiresRegistration ( true ) ; serviceFactory . getRegistry ( ) . setServiceDescriptionBehavior ( sd ) ; RegistrationBehavior regBehavior = new RegistrationBehavior ( ) ; serviceFactory . getRegistry ( ) . setRegistrationBehavior ( regBehavior ) ; RegistrationContext registrationContext = info . getRegistrationContext ( ) ; assertNotNull ( registrationContext ) ; assertEquals ( RegistrationBehavior . REGISTRATION_HANDLE , registrationContext . getRegistrationHandle ( ) ) ; assertEquals ( "<STR_LIT>" , <NUM_LIT:1> , regBehavior . getCallCount ( ) ) ; assertEquals ( "<STR_LIT>" , <NUM_LIT:2> , sd . getCallCount ( ) ) ; } public void testRegister ( ) throws Exception { ServiceDescriptionBehavior sd = new ServiceDescriptionBehavior ( ) ; sd . setServiceDescription ( true , <NUM_LIT:1> ) ; serviceFactory . getRegistry ( ) . setServiceDescriptionBehavior ( sd ) ; RegistrationBehavior regBehavior = new TestRegistrationBehavior ( ) ; serviceFactory . getRegistry ( ) . setRegistrationBehavior ( regBehavior ) ; try { info . register ( ) ; fail ( "<STR_LIT>" ) ; } catch ( PortletInvokerException expected ) { } RegistrationInfo regInfo = info . getRegistrationInfo ( ) ; regInfo . setRegistrationPropertyValue ( TestRegistrationBehavior . PROP_NAME , TestRegistrationBehavior . ORIGINAL_VALUE ) ; info . register ( ) ; RegistrationContext registrationContext = info . getRegistrationContext ( ) ; assertNotNull ( registrationContext ) ; assertEquals ( RegistrationBehavior . REGISTRATION_HANDLE , registrationContext . getRegistrationHandle ( ) ) ; assertTrue ( info . isRegistered ( ) ) ; assertTrue ( info . isRegistrationChecked ( ) ) ; assertTrue ( info . isRegistrationRequired ( ) ) ; } public void testDeregister ( ) throws Exception { try { info . deregister ( ) ; fail ( "<STR_LIT>" ) ; } catch ( IllegalStateException expected ) { } register ( ) ; info . deregister ( ) ; assertNull ( info . getRegistrationContext ( ) ) ; assertFalse ( info . isRegistered ( ) ) ; assertTrue ( info . isRegistrationRequired ( ) ) ; assertTrue ( info . isRegistrationChecked ( ) ) ; } private void register ( ) throws PortletInvokerException { ServiceDescriptionBehavior sd = new ServiceDescriptionBehavior ( ) ; sd . setServiceDescription ( true , <NUM_LIT:1> ) ; serviceFactory . getRegistry ( ) . setServiceDescriptionBehavior ( sd ) ; RegistrationBehavior regBehavior = new TestRegistrationBehavior ( ) ; serviceFactory . getRegistry ( ) . setRegistrationBehavior ( regBehavior ) ; info . refresh ( false ) ; RegistrationInfo regInfo = info . getRegistrationInfo ( ) ; regInfo . setRegistrationPropertyValue ( TestRegistrationBehavior . PROP_NAME , TestRegistrationBehavior . ORIGINAL_VALUE ) ; info . register ( ) ; } public void testModifyRegistration ( ) throws Exception { try { info . modifyRegistration ( ) ; fail ( "<STR_LIT>" ) ; } catch ( IllegalStateException expected ) { } register ( ) ; RegistrationInfo regInfo = info . getRegistrationInfo ( ) ; regInfo . setRegistrationPropertyValue ( TestRegistrationBehavior . PROP_NAME , "<STR_LIT>" ) ; assertTrue ( info . isRefreshNeeded ( false ) ) ; assertTrue ( info . isRegistered ( ) ) ; assertTrue ( info . isModifyRegistrationRequired ( ) ) ; RegistrationProperty prop = regInfo . getRegistrationProperty ( TestRegistrationBehavior . PROP_NAME ) ; assertNull ( prop . isInvalid ( ) ) ; try { info . modifyRegistration ( ) ; fail ( "<STR_LIT>" ) ; } catch ( PortletInvokerException expected ) { } regInfo . setRegistrationPropertyValue ( TestRegistrationBehavior . PROP_NAME , TestRegistrationBehavior . MODIFIED_VALUE ) ; assertTrue ( info . isRefreshNeeded ( false ) ) ; assertNull ( prop . isInvalid ( ) ) ; assertTrue ( info . isModifyRegistrationRequired ( ) ) ; info . modifyRegistration ( ) ; assertTrue ( info . isRefreshNeeded ( true ) ) ; assertFalse ( info . isRefreshNeeded ( false ) ) ; assertTrue ( info . refresh ( false ) ) ; assertFalse ( info . isModifyRegistrationRequired ( ) ) ; Boolean invalid = prop . isInvalid ( ) ; assertNotNull ( invalid ) ; assertFalse ( invalid ) ; } public void testGetInfoForEvent ( ) { assertNull ( info . getInfoForEvent ( null ) ) ; } public void testRequiresInitCookieIsProperlySet ( ) throws PortletInvokerException { ServiceDescriptionBehavior sdb = new GroupedPortletsServiceDescriptionBehavior ( new ArrayList < PortletDescription > ( <NUM_LIT:3> ) ) ; sdb . setRequiresInitCookie ( CookieProtocol . PER_GROUP ) ; serviceFactory . getRegistry ( ) . setServiceDescriptionBehavior ( sdb ) ; info . refresh ( false ) ; assertEquals ( CookieProtocol . PER_GROUP , info . getRequiresInitCookie ( ) ) ; } public void testSupportedOptions ( ) throws PortletInvokerException { ServiceDescriptionBehavior sdb = new SupportedOptionsServiceDescriptionBehavior ( ) ; serviceFactory . getRegistry ( ) . setServiceDescriptionBehavior ( sdb ) ; info . refresh ( false ) ; final Collection < String > supportedOptions = info . getSupportedOptions ( ) ; assertEquals ( <NUM_LIT:2> , supportedOptions . size ( ) ) ; assertTrue ( supportedOptions . contains ( WSRP2Constants . OPTIONS_EXPORT ) ) ; assertTrue ( supportedOptions . contains ( WSRP2Constants . OPTIONS_IMPORT ) ) ; } private static class TestPortletManagementBehavior extends PortletManagementBehavior { public static final String HANDLE_FOR_GET_DESCRIPTION = "<STR_LIT>" ; @ Override public void getPortletDescription ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) PortletContext portletContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) UserContext userContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) List < String > desiredLocales , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < PortletDescription > portletDescription , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < ResourceList > resourceList , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < Extension > > extensions ) throws AccessDenied , InconsistentParameters , InvalidHandle , InvalidRegistration , InvalidUserCategory , MissingParameters , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended { super . getPortletDescription ( registrationContext , portletContext , userContext , desiredLocales , portletDescription , resourceList , extensions ) ; portletDescription . value = createPortletDescription ( HANDLE_FOR_GET_DESCRIPTION , null ) ; } } private static class TestRegistrationBehavior extends RegistrationBehavior { private static final QName PROP_NAME = QName . valueOf ( "<STR_LIT>" ) ; private static final String MODIFIED_VALUE = "<STR_LIT>" ; private static final String ORIGINAL_VALUE = "<STR_LIT:value>" ; @ Override public void register ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationData registrationData , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) Lifetime lifetime , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) UserContext userContext , @ 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 < Lifetime > scheduledDestruction , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < Extension > > extensions , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < String > registrationHandle ) throws MissingParameters , OperationFailed , OperationNotSupported { Property prop = checkRegistrationData ( registrationData . getRegistrationProperties ( ) ) ; String value = prop . getStringValue ( ) ; if ( ORIGINAL_VALUE . equals ( value ) && PROP_NAME . equals ( prop . getName ( ) ) ) { super . register ( registrationData , lifetime , userContext , registrationState , scheduledDestruction , extensions , registrationHandle ) ; return ; } throw WSRP2ExceptionFactory . throwWSException ( OperationFailed . class , value + "<STR_LIT>" + PROP_NAME , null ) ; } @ Override public void modifyRegistration ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) RegistrationData registrationData , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) UserContext userContext , @ 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 < Lifetime > scheduledDestruction , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < Extension > > extensions ) throws InvalidRegistration , MissingParameters , OperationFailed , OperationNotSupported , ResourceSuspended { incrementCallCount ( ) ; WSRP2ExceptionFactory . throwMissingParametersIfValueIsMissing ( registrationContext , "<STR_LIT>" , null ) ; if ( ! RegistrationBehavior . REGISTRATION_HANDLE . equals ( registrationContext . getRegistrationHandle ( ) ) ) { WSRP2ExceptionFactory . throwWSException ( InvalidRegistration . class , "<STR_LIT>" , null ) ; } WSRP2ExceptionFactory . throwMissingParametersIfValueIsMissing ( registrationData , "<STR_LIT>" , null ) ; Property prop = checkRegistrationData ( registrationData . getRegistrationProperties ( ) ) ; String value = prop . getStringValue ( ) ; if ( MODIFIED_VALUE . equals ( value ) && PROP_NAME . equals ( prop . getName ( ) ) ) { return ; } throw WSRP2ExceptionFactory . throwWSException ( OperationFailed . class , value + "<STR_LIT>" + PROP_NAME , null ) ; } private Property checkRegistrationData ( List < Property > registrationProperties ) throws OperationFailed { WSRP2ExceptionFactory . throwOperationFailedIfValueIsMissing ( registrationProperties , "<STR_LIT>" ) ; Property prop = registrationProperties . get ( <NUM_LIT:0> ) ; WSRP2ExceptionFactory . throwOperationFailedIfValueIsMissing ( prop , "<STR_LIT>" ) ; return prop ; } } } </s>
|
<s> package org . gatein . wsrp . consumer . registry ; import junit . framework . TestCase ; import org . gatein . wsrp . WSRPConsumer ; import org . gatein . wsrp . consumer . ConsumerException ; import org . gatein . wsrp . consumer . EndpointConfigurationInfo ; import org . gatein . wsrp . consumer . ProducerInfo ; import org . gatein . wsrp . consumer . RegistrationInfo ; import org . mockito . Mockito ; import java . util . Collection ; import java . util . Collections ; public class ConsumerRegistryTestCase extends TestCase { protected AbstractConsumerRegistry registry ; @ Override protected void setUp ( ) throws Exception { registry = new InMemoryConsumerRegistry ( ) ; } public void testCreateAndGet ( ) { String id = "<STR_LIT:test>" ; WSRPConsumer consumer = registry . createConsumer ( id , null , null ) ; assertNotNull ( consumer ) ; assertEquals ( id , consumer . getProducerId ( ) ) ; ProducerInfo info = consumer . getProducerInfo ( ) ; assertNotNull ( info ) ; assertNotNull ( info . getKey ( ) ) ; assertEquals ( consumer . getProducerId ( ) , info . getId ( ) ) ; EndpointConfigurationInfo endpoint = info . getEndpointConfigurationInfo ( ) ; assertNotNull ( endpoint ) ; RegistrationInfo regInfo = info . getRegistrationInfo ( ) ; assertTrue ( regInfo . isUndetermined ( ) ) ; assertEquals ( registry , info . getRegistry ( ) ) ; assertTrue ( registry . containsConsumer ( id ) ) ; WSRPConsumer fromRegistry = registry . getConsumer ( id ) ; assertNotNull ( fromRegistry ) ; assertEquals ( consumer . getProducerId ( ) , fromRegistry . getProducerId ( ) ) ; ProducerInfo fromRegistryInfo = fromRegistry . getProducerInfo ( ) ; assertNotNull ( fromRegistryInfo ) ; assertEquals ( fromRegistry . getProducerId ( ) , fromRegistryInfo . getId ( ) ) ; assertNotNull ( fromRegistryInfo . getEndpointConfigurationInfo ( ) ) ; assertTrue ( fromRegistryInfo . getRegistrationInfo ( ) . isUndetermined ( ) ) ; assertEquals ( registry , fromRegistryInfo . getRegistry ( ) ) ; assertEquals ( info . getId ( ) , fromRegistryInfo . getId ( ) ) ; assertEquals ( info . getEndpointConfigurationInfo ( ) , fromRegistryInfo . getEndpointConfigurationInfo ( ) ) ; assertEquals ( info . getRegistrationInfo ( ) , fromRegistryInfo . getRegistrationInfo ( ) ) ; Collection consumers = registry . getConfiguredConsumers ( ) ; assertNotNull ( consumers ) ; assertEquals ( <NUM_LIT:1> , consumers . size ( ) ) ; assertTrue ( consumers . contains ( consumer ) ) ; final Collection < String > ids = registry . getConfiguredConsumersIds ( ) ; assertNotNull ( ids ) ; assertEquals ( <NUM_LIT:1> , ids . size ( ) ) ; assertTrue ( ids . contains ( id ) ) ; assertEquals ( <NUM_LIT:1> , registry . getConfiguredConsumerNumber ( ) ) ; } public void testGetConsumer ( ) { assertNull ( registry . getConsumer ( "<STR_LIT>" ) ) ; } public void testDoubleRegistrationOfConsumerWithSameId ( ) { String id = "<STR_LIT:foo>" ; registry . createConsumer ( id , null , null ) ; try { registry . createConsumer ( id , null , null ) ; fail ( "<STR_LIT>" ) ; } catch ( ConsumerException expected ) { } } public void testDelete ( ) { String id = "<STR_LIT:id>" ; WSRPConsumer consumer = registry . createConsumer ( id , null , null ) ; assertEquals ( consumer , registry . getConsumer ( id ) ) ; assertTrue ( registry . containsConsumer ( id ) ) ; assertEquals ( <NUM_LIT:1> , registry . getConfiguredConsumerNumber ( ) ) ; registry . destroyConsumer ( id ) ; assertFalse ( registry . containsConsumer ( id ) ) ; assertNull ( registry . getConsumer ( id ) ) ; assertEquals ( <NUM_LIT:0> , registry . getConfiguredConsumerNumber ( ) ) ; } public void testUpdateProducerInfo ( ) { String id = "<STR_LIT:foo>" ; WSRPConsumer consumer = registry . createConsumer ( id , null , null ) ; ProducerInfo info = consumer . getProducerInfo ( ) ; String previousId = registry . updateProducerInfo ( info ) ; assertNull ( previousId ) ; info . setId ( "<STR_LIT:bar>" ) ; previousId = registry . updateProducerInfo ( info ) ; assertEquals ( "<STR_LIT:foo>" , previousId ) ; assertNull ( registry . getConsumer ( id ) ) ; assertFalse ( registry . containsConsumer ( id ) ) ; assertEquals ( info , consumer . getProducerInfo ( ) ) ; assertEquals ( consumer , registry . getConsumer ( "<STR_LIT:bar>" ) ) ; assertTrue ( registry . containsConsumer ( "<STR_LIT:bar>" ) ) ; assertEquals ( <NUM_LIT:1> , registry . getConfiguredConsumerNumber ( ) ) ; } public void testStoppingShouldNotStartConsumers ( ) throws Exception { ProducerInfo info = Mockito . mock ( ProducerInfo . class ) ; Mockito . stub ( info . isActive ( ) ) . toReturn ( true ) ; Mockito . stub ( info . getId ( ) ) . toReturn ( "<STR_LIT:foo>" ) ; Mockito . stub ( info . getKey ( ) ) . toReturn ( "<STR_LIT>" ) ; EndpointConfigurationInfo endpoint = Mockito . mock ( EndpointConfigurationInfo . class ) ; Mockito . stub ( info . getEndpointConfigurationInfo ( ) ) . toReturn ( endpoint ) ; registry . save ( info , "<STR_LIT>" ) ; WSRPConsumer original = registry . createConsumerFrom ( info , true ) ; assertEquals ( original , registry . getFederatingPortletInvoker ( ) . getFederatedInvoker ( "<STR_LIT:foo>" ) . getPortletInvoker ( ) ) ; WSRPConsumer consumer = Mockito . spy ( original ) ; AbstractConsumerRegistry registrySpy = Mockito . spy ( registry ) ; Mockito . doReturn ( consumer ) . when ( registrySpy ) . getConsumer ( "<STR_LIT:foo>" ) ; Mockito . doReturn ( Collections . singletonList ( consumer ) ) . when ( registrySpy ) . getConsumers ( false ) ; WSRPConsumer foo = registrySpy . getConsumer ( "<STR_LIT:foo>" ) ; assertTrue ( foo . getProducerInfo ( ) . isActive ( ) ) ; assertEquals ( consumer , foo ) ; consumer . stop ( ) ; registrySpy . stop ( ) ; Mockito . verify ( consumer , Mockito . times ( <NUM_LIT:0> ) ) . start ( ) ; assertEquals ( null , registrySpy . getFederatingPortletInvoker ( ) . getFederatedInvoker ( "<STR_LIT:foo>" ) ) ; } public void testReloadConsumers ( ) { WSRPConsumer consumer1 = registry . createConsumer ( "<STR_LIT>" , null , null ) ; WSRPConsumer consumer2 = registry . createConsumer ( "<STR_LIT>" , null , null ) ; assertEquals ( <NUM_LIT:2> , registry . getConfiguredConsumersIds ( ) . size ( ) ) ; assertEquals ( consumer1 , registry . getConsumer ( consumer1 . getProducerId ( ) ) ) ; assertEquals ( consumer2 , registry . getConsumer ( consumer2 . getProducerId ( ) ) ) ; registry . reloadConsumers ( ) ; assertEquals ( <NUM_LIT:2> , registry . getConfiguredConsumersIds ( ) . size ( ) ) ; assertEquals ( consumer1 , registry . getConsumer ( consumer1 . getProducerId ( ) ) ) ; assertEquals ( consumer2 , registry . getConsumer ( consumer2 . getProducerId ( ) ) ) ; } public void testCacheSimple ( ) { WSRPConsumer consumer1 = registry . createConsumer ( "<STR_LIT>" , null , null ) ; assertTrue ( registry . containsConsumer ( consumer1 . getProducerId ( ) ) ) ; assertEquals ( consumer1 , registry . consumerCache . getConsumer ( consumer1 . getProducerId ( ) ) ) ; final ProducerInfo info = consumer1 . getProducerInfo ( ) ; info . setId ( "<STR_LIT:foo>" ) ; registry . updateProducerInfo ( info ) ; assertEquals ( consumer1 , registry . getConsumer ( "<STR_LIT:foo>" ) ) ; registry . destroyConsumer ( "<STR_LIT:foo>" ) ; assertFalse ( registry . containsConsumer ( "<STR_LIT:foo>" ) ) ; } public void testCacheModifyingProducerInfo ( ) { WSRPConsumer consumer1 = registry . createConsumer ( "<STR_LIT>" , null , null ) ; assertTrue ( registry . containsConsumer ( consumer1 . getProducerId ( ) ) ) ; final ProducerInfo info = consumer1 . getProducerInfo ( ) ; info . setId ( "<STR_LIT:foo>" ) ; registry . update ( info ) ; assertEquals ( consumer1 , registry . getConsumer ( "<STR_LIT:foo>" ) ) ; } } </s>
|
<s> package org . gatein . wsrp . consumer ; import junit . framework . TestCase ; import org . apache . commons . httpclient . Cookie ; import org . gatein . wsrp . WSRPConstants ; import org . gatein . wsrp . WSRPTypeFactory ; import org . gatein . wsrp . consumer . handlers . ProducerSessionInformation ; public class ProducerSessionInformationTestCase extends TestCase { ProducerSessionInformation info ; private static final int SLEEP_TIME = <NUM_LIT> ; protected void setUp ( ) throws Exception { info = new ProducerSessionInformation ( ) ; } public void testUserCookie ( ) throws Exception { assertNull ( info . getUserCookie ( ) ) ; Cookie [ ] cookies = new Cookie [ ] { createCookie ( "<STR_LIT:name>" , "<STR_LIT:value>" , <NUM_LIT:1> ) } ; info . setUserCookie ( cookies ) ; assertEquals ( "<STR_LIT>" , info . getUserCookie ( ) ) ; Thread . sleep ( SLEEP_TIME ) ; assertNull ( info . getUserCookie ( ) ) ; cookies = new Cookie [ ] { createCookie ( "<STR_LIT>" , "<STR_LIT:value1>" , <NUM_LIT:1> ) , createCookie ( "<STR_LIT>" , "<STR_LIT>" , <NUM_LIT:3> ) } ; info . setUserCookie ( cookies ) ; assertEquals ( "<STR_LIT>" , info . getUserCookie ( ) ) ; Thread . sleep ( SLEEP_TIME ) ; assertEquals ( "<STR_LIT>" , info . getUserCookie ( ) ) ; try { info . setUserCookie ( null ) ; fail ( "<STR_LIT>" ) ; } catch ( IllegalArgumentException e ) { } } public void testGroupCookies ( ) throws Exception { String groupId = "<STR_LIT>" ; try { info . setGroupCookieFor ( groupId , new Cookie [ ] { createCookie ( "<STR_LIT>" , "<STR_LIT:value1>" , <NUM_LIT:1> ) , createCookie ( "<STR_LIT>" , "<STR_LIT>" , - <NUM_LIT:1> ) } ) ; fail ( "<STR_LIT>" ) ; } catch ( IllegalStateException e ) { } info . setPerGroupCookies ( true ) ; info . setGroupCookieFor ( groupId , new Cookie [ ] { createCookie ( "<STR_LIT>" , "<STR_LIT:value1>" , <NUM_LIT:1> ) , createCookie ( "<STR_LIT>" , "<STR_LIT>" , WSRPConstants . SESSION_NEVER_EXPIRES ) } ) ; assertEquals ( "<STR_LIT>" , info . getGroupCookieFor ( groupId ) ) ; Thread . sleep ( SLEEP_TIME ) ; assertEquals ( "<STR_LIT>" , info . getGroupCookieFor ( groupId ) ) ; info . clearGroupCookies ( ) ; assertNull ( info . getGroupCookieFor ( groupId ) ) ; } public void testSessionForPortlet ( ) throws Exception { String handle = "<STR_LIT>" ; String handle2 = "<STR_LIT>" ; String sid = "<STR_LIT:id>" ; String sid2 = "<STR_LIT>" ; assertNull ( info . getSessionIdForPortlet ( handle ) ) ; assertEquals ( <NUM_LIT:0> , info . getNumberOfSessions ( ) ) ; addSession ( handle , sid , <NUM_LIT:1> ) ; addSession ( handle2 , sid2 , <NUM_LIT:3> ) ; assertNull ( info . getSessionIdForPortlet ( "<STR_LIT:unknown>" ) ) ; assertEquals ( sid , info . getSessionIdForPortlet ( handle ) ) ; assertEquals ( <NUM_LIT:2> , info . getNumberOfSessions ( ) ) ; Thread . sleep ( SLEEP_TIME ) ; assertNull ( info . getSessionIdForPortlet ( handle ) ) ; assertEquals ( sid2 , info . getSessionIdForPortlet ( handle2 ) ) ; assertEquals ( <NUM_LIT:1> , info . getNumberOfSessions ( ) ) ; info . removeSessionForPortlet ( handle2 ) ; assertEquals ( <NUM_LIT:0> , info . getNumberOfSessions ( ) ) ; } public void testReplaceUserCookies ( ) throws Exception { info . setUserCookie ( new Cookie [ ] { createCookie ( "<STR_LIT:name>" , "<STR_LIT:value>" , <NUM_LIT:1> ) } ) ; info . replaceUserCookiesWith ( null ) ; assertEquals ( "<STR_LIT>" , info . getUserCookie ( ) ) ; ProducerSessionInformation other = new ProducerSessionInformation ( ) ; info . replaceUserCookiesWith ( other ) ; assertEquals ( "<STR_LIT>" , info . getUserCookie ( ) ) ; other . setUserCookie ( new Cookie [ ] { createCookie ( "<STR_LIT>" , "<STR_LIT>" , <NUM_LIT:1> ) } ) ; info . replaceUserCookiesWith ( other ) ; assertEquals ( "<STR_LIT>" , info . getUserCookie ( ) ) ; Thread . sleep ( SLEEP_TIME ) ; info . replaceUserCookiesWith ( other ) ; assertNull ( info . getUserCookie ( ) ) ; } public void testReleaseSessions ( ) { addSession ( "<STR_LIT>" , "<STR_LIT:id>" , <NUM_LIT:1> ) ; addSession ( "<STR_LIT>" , "<STR_LIT>" , <NUM_LIT:1> ) ; addSession ( "<STR_LIT>" , "<STR_LIT>" , <NUM_LIT:1> ) ; assertEquals ( <NUM_LIT:3> , info . getNumberOfSessions ( ) ) ; info . removeSessions ( ) ; assertEquals ( <NUM_LIT:0> , info . getNumberOfSessions ( ) ) ; addSession ( "<STR_LIT>" , "<STR_LIT:id>" , <NUM_LIT:1> ) ; addSession ( "<STR_LIT>" , "<STR_LIT>" , <NUM_LIT:2> ) ; info . removeSession ( "<STR_LIT>" ) ; assertEquals ( <NUM_LIT:1> , info . getNumberOfSessions ( ) ) ; assertNull ( info . getSessionIdForPortlet ( "<STR_LIT>" ) ) ; assertEquals ( "<STR_LIT:id>" , info . getSessionIdForPortlet ( "<STR_LIT>" ) ) ; info . removeSessionForPortlet ( "<STR_LIT>" ) ; assertEquals ( <NUM_LIT:0> , info . getNumberOfSessions ( ) ) ; assertNull ( info . getSessionIdForPortlet ( "<STR_LIT>" ) ) ; try { info . removeSessionForPortlet ( "<STR_LIT>" ) ; fail ( "<STR_LIT>" ) ; } catch ( IllegalArgumentException expected ) { } } public void testSetParentSessionId ( ) { assertNull ( info . getParentSessionId ( ) ) ; String id = "<STR_LIT>" ; info . setParentSessionId ( id ) ; assertEquals ( id , info . getParentSessionId ( ) ) ; info . setParentSessionId ( id ) ; try { info . setParentSessionId ( "<STR_LIT>" ) ; fail ( "<STR_LIT>" ) ; } catch ( IllegalStateException expected ) { } } private Cookie createCookie ( String name , String value , int secondsBeforeExpiration ) { return new Cookie ( "<STR_LIT>" , name , value , "<STR_LIT:path>" , secondsBeforeExpiration , false ) ; } private void addSession ( String handle , String sid , int expires ) { info . addSessionForPortlet ( handle , WSRPTypeFactory . createSessionContext ( sid , expires ) ) ; } } </s>
|
<s> package org . gatein . wsrp . consumer ; import junit . framework . TestCase ; import javax . xml . namespace . QName ; public class RegistrationPropertyTestCase extends TestCase { private RegistrationProperty prop ; private Listener listener = new Listener ( ) ; private static final String VALUE = "<STR_LIT:value>" ; private static final String NEW_VALUE = "<STR_LIT>" ; private class Listener implements RegistrationProperty . PropertyChangeListener { boolean called ; public void propertyValueChanged ( RegistrationProperty property , RegistrationProperty . Status previousStatus , Object oldValue , Object newValue ) { called = ( prop == property ) && VALUE . equals ( oldValue ) && NEW_VALUE . equals ( newValue ) ; } } protected void setUp ( ) throws Exception { prop = new RegistrationProperty ( "<STR_LIT:name>" , VALUE , "<STR_LIT:en>" , listener ) ; } public void testConstructor ( ) { try { new RegistrationProperty ( ( String ) null , VALUE , "<STR_LIT:en>" , listener ) ; fail ( "<STR_LIT>" ) ; } catch ( Exception e ) { } try { new RegistrationProperty ( "<STR_LIT:name>" , null , "<STR_LIT:en>" , listener ) ; } catch ( Exception e ) { fail ( "<STR_LIT>" ) ; } try { new RegistrationProperty ( "<STR_LIT:name>" , VALUE , null , listener ) ; fail ( "<STR_LIT>" ) ; } catch ( Exception e ) { } try { new RegistrationProperty ( "<STR_LIT:name>" , VALUE , "<STR_LIT:en>" , null ) ; fail ( "<STR_LIT>" ) ; } catch ( Exception e ) { } } public void testSetNullValue ( ) { forceValid ( ) ; prop . setValue ( null ) ; assertNull ( prop . getValue ( ) ) ; assertTrue ( prop . isInvalid ( ) ) ; assertTrue ( prop . isDeterminedInvalid ( ) ) ; assertEquals ( RegistrationProperty . Status . MISSING_VALUE , prop . getStatus ( ) ) ; } public void testGetters ( ) { assertEquals ( QName . valueOf ( "<STR_LIT:name>" ) , prop . getName ( ) ) ; assertEquals ( "<STR_LIT:value>" , prop . getValue ( ) ) ; assertEquals ( "<STR_LIT:en>" , prop . getLang ( ) ) ; assertNull ( prop . isInvalid ( ) ) ; assertFalse ( prop . isDeterminedInvalid ( ) ) ; assertNull ( prop . getDescription ( ) ) ; assertEquals ( RegistrationProperty . Status . UNCHECKED_VALUE , prop . getStatus ( ) ) ; } public void testSetValue ( ) { forceValid ( ) ; prop . setValue ( VALUE ) ; assertEquals ( Boolean . FALSE , prop . isInvalid ( ) ) ; assertEquals ( RegistrationProperty . Status . VALID , prop . getStatus ( ) ) ; prop . setValue ( NEW_VALUE ) ; assertEquals ( NEW_VALUE , prop . getValue ( ) ) ; assertNull ( prop . isInvalid ( ) ) ; assertEquals ( RegistrationProperty . Status . UNCHECKED_VALUE , prop . getStatus ( ) ) ; } private void forceValid ( ) { prop . setStatus ( RegistrationProperty . Status . VALID ) ; } public void testPropertyChangedEvent ( ) { prop . setValue ( VALUE ) ; assertFalse ( listener . called ) ; prop . setValue ( NEW_VALUE ) ; assertTrue ( listener . called ) ; } } </s>
|
<s> package org . gatein . wsrp . consumer ; import junit . framework . TestCase ; import org . gatein . wsrp . WSRPConstants ; import org . gatein . wsrp . WSRPTypeFactory ; import org . gatein . wsrp . test . protocol . v2 . ServiceDescriptionBehavior ; import org . oasis . wsrp . v2 . Property ; import org . oasis . wsrp . v2 . RegistrationContext ; import org . oasis . wsrp . v2 . RegistrationData ; import org . oasis . wsrp . v2 . ServiceDescription ; import javax . xml . namespace . QName ; import java . util . List ; import java . util . Map ; import java . util . Set ; public class RegistrationInfoTestCase extends TestCase { private RegistrationInfo info ; private static final String producerId = "<STR_LIT:test>" ; private static final RegistrationContext FAKE_REGISTRATION_CONTEXT = WSRPTypeFactory . createRegistrationContext ( "<STR_LIT>" ) ; protected void setUp ( ) throws Exception { ProducerInfo pi = new ProducerInfo ( null ) ; info = pi . getRegistrationInfo ( ) ; } public void testInitialState ( ) { assertTrue ( info . getRegistrationProperties ( ) . isEmpty ( ) ) ; assertTrue ( info . getRegistrationPropertyNames ( ) . isEmpty ( ) ) ; assertNull ( info . getRegistrationContext ( ) ) ; assertNotNull ( info . getRegistrationData ( ) ) ; assertNull ( info . getRegistrationHandle ( ) ) ; assertNull ( info . getRegistrationState ( ) ) ; assertTrue ( info . isRefreshNeeded ( ) ) ; assertNull ( info . isConsistentWithProducerExpectations ( ) ) ; assertNull ( info . isRegistrationRequired ( ) ) ; assertNull ( info . isRegistrationValid ( ) ) ; assertFalse ( info . isRegistered ( ) ) ; assertFalse ( info . isModifiedSinceLastRefresh ( ) ) ; assertFalse ( info . isModifyRegistrationNeeded ( ) ) ; try { info . isRegistrationDeterminedNotRequired ( ) ; fail ( "<STR_LIT>" ) ; } catch ( IllegalStateException expected ) { } try { info . isRegistrationDeterminedRequired ( ) ; fail ( "<STR_LIT>" ) ; } catch ( IllegalStateException expected ) { } } public void testRegistration ( ) { register ( ) ; assertEquals ( FAKE_REGISTRATION_CONTEXT . getRegistrationHandle ( ) , info . getRegistrationHandle ( ) ) ; assertEquals ( FAKE_REGISTRATION_CONTEXT . getRegistrationState ( ) , info . getRegistrationState ( ) ) ; assertTrue ( info . isRegistered ( ) ) ; assertFalse ( info . isModifiedSinceLastRefresh ( ) ) ; assertFalse ( info . isModifyRegistrationNeeded ( ) ) ; assertTrue ( info . isConsistentWithProducerExpectations ( ) ) ; assertFalse ( info . isRefreshNeeded ( ) ) ; assertTrue ( info . isRegistrationRequired ( ) ) ; assertTrue ( info . isRegistrationValid ( ) ) ; assertFalse ( info . isRegistrationDeterminedNotRequired ( ) ) ; assertTrue ( info . isRegistrationDeterminedRequired ( ) ) ; assertFalse ( info . isUndetermined ( ) ) ; } public void testIsModifyRegistrationNeeded ( ) { String key = "<STR_LIT:foo>" ; assertFalse ( info . isRegistered ( ) ) ; info . setRegistrationPropertyValue ( key , "<STR_LIT:bar>" ) ; assertFalse ( info . isModifyRegistrationNeeded ( ) ) ; register ( ) ; info . setRegistrationPropertyValue ( key , "<STR_LIT:bar>" ) ; assertFalse ( info . isModifiedSinceLastRefresh ( ) ) ; assertFalse ( info . isModifyRegistrationNeeded ( ) ) ; info . setRegistrationPropertyValue ( key , "<STR_LIT>" ) ; assertTrue ( info . isModifiedSinceLastRefresh ( ) ) ; assertTrue ( info . isModifyRegistrationNeeded ( ) ) ; } private void register ( ) { info . setRegistrationContext ( FAKE_REGISTRATION_CONTEXT ) ; info . setConsumerName ( WSRPConstants . DEFAULT_CONSUMER_NAME ) ; } public void testSimpleSetGetRegistrationProperty ( ) { QName key = QName . valueOf ( "<STR_LIT>" ) ; info . setRegistrationPropertyValue ( key , "<STR_LIT:bar>" ) ; assertNull ( info . isConsistentWithProducerExpectations ( ) ) ; assertTrue ( info . isModifiedSinceLastRefresh ( ) ) ; assertFalse ( info . isModifyRegistrationNeeded ( ) ) ; Map properties = info . getRegistrationProperties ( ) ; assertFalse ( properties . isEmpty ( ) ) ; Set names = info . getRegistrationPropertyNames ( ) ; assertFalse ( names . isEmpty ( ) ) ; assertTrue ( properties . containsKey ( key ) ) ; assertTrue ( names . contains ( key ) ) ; Object prop = properties . get ( key ) ; assertNotNull ( prop ) ; RegistrationProperty registrationProperty = info . getRegistrationProperty ( key ) ; assertEquals ( prop , registrationProperty ) ; assertEquals ( "<STR_LIT:bar>" , registrationProperty . getValue ( ) ) ; } public void testRegistrationPropertiesAndRefresh ( ) { info . setRegistrationPropertyValue ( "<STR_LIT>" , "<STR_LIT>" ) ; RefreshResult result = info . refresh ( createServiceDescription ( true , <NUM_LIT:1> ) , producerId , true , false , false ) ; RegistrationProperty prop = info . getRegistrationProperty ( "<STR_LIT>" ) ; assertNull ( prop . isInvalid ( ) ) ; assertFalse ( result . hasIssues ( ) ) ; assertFalse ( info . isModifiedSinceLastRefresh ( ) ) ; assertFalse ( info . isModifyRegistrationNeeded ( ) ) ; assertTrue ( info . isConsistentWithProducerExpectations ( ) ) ; prop . setStatus ( RegistrationProperty . Status . VALID ) ; info . setRegistrationPropertyValue ( "<STR_LIT>" , "<STR_LIT:value1>" ) ; assertTrue ( info . isRefreshNeeded ( ) ) ; assertNull ( "<STR_LIT>" , prop . isInvalid ( ) ) ; assertEquals ( "<STR_LIT>" , RegistrationProperty . Status . UNCHECKED_VALUE , prop . getStatus ( ) ) ; assertTrue ( info . isModifiedSinceLastRefresh ( ) ) ; assertTrue ( info . isModifyRegistrationNeeded ( ) ) ; } public void testRefreshNoRegistration ( ) { ServiceDescription sd = createServiceDescription ( false , <NUM_LIT:0> ) ; RefreshResult result = info . refresh ( sd , producerId , true , false , false ) ; assertNotNull ( result ) ; assertFalse ( result . hasIssues ( ) ) ; assertTrue ( info . isConsistentWithProducerExpectations ( ) ) ; assertFalse ( info . isRegistrationRequired ( ) ) ; assertTrue ( info . isRegistrationDeterminedNotRequired ( ) ) ; assertFalse ( info . isRegistrationDeterminedRequired ( ) ) ; assertTrue ( info . isRegistrationValid ( ) ) ; assertFalse ( info . isModifyRegistrationNeeded ( ) ) ; result = info . refresh ( sd , producerId , false , false , false ) ; assertNotNull ( result ) ; assertFalse ( result . hasIssues ( ) ) ; assertTrue ( info . isConsistentWithProducerExpectations ( ) ) ; assertFalse ( info . isRegistrationRequired ( ) ) ; assertTrue ( info . isRegistrationDeterminedNotRequired ( ) ) ; assertFalse ( info . isRegistrationDeterminedRequired ( ) ) ; assertTrue ( info . isRegistrationValid ( ) ) ; assertFalse ( info . isModifyRegistrationNeeded ( ) ) ; } public void testRefreshRegistrationDefaultRegistrationNoLocalInfo ( ) { assertNull ( info . isRegistrationRequired ( ) ) ; assertNull ( info . isRegistrationValid ( ) ) ; RegistrationInfo . RegistrationRefreshResult result = info . refresh ( createServiceDescription ( true , <NUM_LIT:0> ) , producerId , true , false , false ) ; assertNotNull ( result ) ; assertFalse ( result . hasIssues ( ) ) ; assertTrue ( info . isRegistrationRequired ( ) ) ; assertTrue ( info . isRegistrationDeterminedRequired ( ) ) ; assertFalse ( info . isRegistrationDeterminedNotRequired ( ) ) ; assertFalse ( info . isRegistrationValid ( ) ) ; } public void testRefreshRegistrationDefaultRegistrationExtraLocalInfo ( ) { info . setRegistrationPropertyValue ( "<STR_LIT:foo>" , "<STR_LIT:bar>" ) ; RegistrationInfo . RegistrationRefreshResult result = info . refresh ( createServiceDescription ( true , <NUM_LIT:0> ) , producerId , false , false , true ) ; assertNotNull ( result ) ; assertTrue ( result . hasIssues ( ) ) ; assertEquals ( RefreshResult . Status . FAILURE , result . getStatus ( ) ) ; assertEquals ( <NUM_LIT:1> , info . getRegistrationProperties ( ) . size ( ) ) ; assertEquals ( <NUM_LIT:1> , result . getRegistrationProperties ( ) . size ( ) ) ; assertFalse ( info . isModifyRegistrationNeeded ( ) ) ; checkProperties ( result ) ; } private void checkProperties ( RegistrationInfo . RegistrationRefreshResult result ) { Map < QName , RegistrationProperty > regProps = result . getRegistrationProperties ( ) ; assertNotNull ( regProps ) ; RegistrationProperty prop = regProps . get ( QName . valueOf ( "<STR_LIT:foo>" ) ) ; assertNotNull ( prop ) ; assertEquals ( "<STR_LIT:bar>" , prop . getValue ( ) ) ; assertTrue ( prop . isInvalid ( ) ) ; assertEquals ( RegistrationProperty . Status . INEXISTENT , prop . getStatus ( ) ) ; } public void testRefreshRegistrationDefaultRegistrationExtraLocalInfoWhileRegistered ( ) { register ( ) ; info . setRegistrationPropertyValue ( "<STR_LIT:foo>" , "<STR_LIT:bar>" ) ; RegistrationInfo . RegistrationRefreshResult result = info . refresh ( createServiceDescription ( true , <NUM_LIT:0> ) , producerId , false , false , true ) ; assertNotNull ( result ) ; assertEquals ( RefreshResult . Status . MODIFY_REGISTRATION_REQUIRED , result . getStatus ( ) ) ; assertTrue ( result . hasIssues ( ) ) ; assertEquals ( <NUM_LIT:1> , info . getRegistrationProperties ( ) . size ( ) ) ; assertEquals ( <NUM_LIT:1> , result . getRegistrationProperties ( ) . size ( ) ) ; assertTrue ( info . isModifyRegistrationNeeded ( ) ) ; checkProperties ( result ) ; } public void testRefreshRegistrationRegistrationNoLocalInfo ( ) { ServiceDescription sd = createServiceDescription ( true , <NUM_LIT:2> ) ; RegistrationInfo . RegistrationRefreshResult result = info . refresh ( sd , producerId , false , false , false ) ; assertNotNull ( result ) ; assertTrue ( result . hasIssues ( ) ) ; assertEquals ( RefreshResult . Status . FAILURE , result . getStatus ( ) ) ; assertEquals ( <NUM_LIT:0> , info . getRegistrationProperties ( ) . size ( ) ) ; assertEquals ( <NUM_LIT:2> , result . getRegistrationProperties ( ) . size ( ) ) ; assertFalse ( info . isModifyRegistrationNeeded ( ) ) ; Map < QName , RegistrationProperty > regProps = result . getRegistrationProperties ( ) ; assertNotNull ( regProps ) ; RegistrationProperty prop = regProps . get ( QName . valueOf ( "<STR_LIT>" ) ) ; assertNotNull ( prop ) ; assertTrue ( prop . isInvalid ( ) ) ; assertEquals ( RegistrationProperty . Status . MISSING , prop . getStatus ( ) ) ; prop = regProps . get ( QName . valueOf ( "<STR_LIT>" ) ) ; assertNotNull ( prop ) ; assertTrue ( prop . isInvalid ( ) ) ; assertEquals ( RegistrationProperty . Status . MISSING , prop . getStatus ( ) ) ; } public void testRefreshRegistrationRegistrationNoLocalInfoWhileRegistered ( ) { register ( ) ; ServiceDescription sd = createServiceDescription ( true , <NUM_LIT:2> ) ; RegistrationInfo . RegistrationRefreshResult result = info . refresh ( sd , producerId , false , true , false ) ; assertNotNull ( result ) ; assertTrue ( result . hasIssues ( ) ) ; assertEquals ( RefreshResult . Status . MODIFY_REGISTRATION_REQUIRED , result . getStatus ( ) ) ; assertEquals ( <NUM_LIT:0> , info . getRegistrationProperties ( ) . size ( ) ) ; assertEquals ( <NUM_LIT:2> , result . getRegistrationProperties ( ) . size ( ) ) ; assertTrue ( info . isModifyRegistrationNeeded ( ) ) ; Map < QName , RegistrationProperty > regProps = result . getRegistrationProperties ( ) ; assertNotNull ( regProps ) ; RegistrationProperty prop = regProps . get ( QName . valueOf ( "<STR_LIT>" ) ) ; assertNotNull ( prop ) ; assertTrue ( prop . isInvalid ( ) ) ; assertEquals ( RegistrationProperty . Status . MISSING , prop . getStatus ( ) ) ; prop = regProps . get ( QName . valueOf ( "<STR_LIT>" ) ) ; assertNotNull ( prop ) ; assertTrue ( prop . isInvalid ( ) ) ; assertEquals ( RegistrationProperty . Status . MISSING , prop . getStatus ( ) ) ; } public void testRefreshRegistrationRegistrationMergeWithLocalInfo ( ) { info . setRegistrationPropertyValue ( "<STR_LIT:foo>" , "<STR_LIT:bar>" ) ; RegistrationInfo . RegistrationRefreshResult result = info . refresh ( createServiceDescription ( true , <NUM_LIT:2> ) , producerId , true , false , false ) ; assertNotNull ( result ) ; assertTrue ( result . hasIssues ( ) ) ; RegistrationProperty prop = info . getRegistrationProperty ( "<STR_LIT>" ) ; assertNotNull ( prop ) ; assertNull ( prop . getValue ( ) ) ; assertTrue ( prop . isInvalid ( ) ) ; assertEquals ( RegistrationProperty . Status . MISSING_VALUE , prop . getStatus ( ) ) ; prop = info . getRegistrationProperty ( "<STR_LIT>" ) ; assertNotNull ( prop ) ; assertNull ( prop . getValue ( ) ) ; assertTrue ( prop . isInvalid ( ) ) ; assertEquals ( RegistrationProperty . Status . MISSING_VALUE , prop . getStatus ( ) ) ; assertEquals ( <NUM_LIT:2> , info . getRegistrationProperties ( ) . size ( ) ) ; assertEquals ( <NUM_LIT:2> , result . getRegistrationProperties ( ) . size ( ) ) ; assertNull ( info . getRegistrationProperty ( "<STR_LIT:foo>" ) ) ; } public void testForceRefreshRegistration ( ) { RefreshResult result = info . refresh ( createServiceDescription ( true , <NUM_LIT:0> ) , producerId , false , false , false ) ; assertNotNull ( result ) ; assertFalse ( result . hasIssues ( ) ) ; assertFalse ( info . isRegistrationValid ( ) ) ; info . setRegistrationPropertyValue ( "<STR_LIT:foo>" , "<STR_LIT:bar>" ) ; result = info . refresh ( createServiceDescription ( true , <NUM_LIT:0> ) , producerId , false , false , false ) ; assertTrue ( result . hasIssues ( ) ) ; assertFalse ( info . isRegistrationValid ( ) ) ; info . removeRegistrationProperty ( "<STR_LIT:foo>" ) ; result = info . refresh ( createServiceDescription ( true , <NUM_LIT:0> ) , producerId , false , false , false ) ; assertFalse ( result . hasIssues ( ) ) ; assertFalse ( info . isRegistrationValid ( ) ) ; result = info . refresh ( createServiceDescription ( false , <NUM_LIT:0> ) , producerId , false , false , false ) ; assertFalse ( result . hasIssues ( ) ) ; assertFalse ( info . isRegistrationValid ( ) ) ; result = info . refresh ( createServiceDescription ( false , <NUM_LIT:0> ) , producerId , false , true , false ) ; assertFalse ( result . hasIssues ( ) ) ; assertTrue ( info . isRegistrationValid ( ) ) ; } public void testSetRegistrationContext ( ) { assertNull ( info . isConsistentWithProducerExpectations ( ) ) ; assertNull ( info . getRegistrationHandle ( ) ) ; String registrationHandle = "<STR_LIT>" ; info . setRegistrationContext ( WSRPTypeFactory . createRegistrationContext ( registrationHandle ) ) ; RegistrationContext registrationContext = info . getRegistrationContext ( ) ; assertNotNull ( registrationContext ) ; assertEquals ( registrationHandle , registrationContext . getRegistrationHandle ( ) ) ; assertNull ( registrationContext . getRegistrationState ( ) ) ; assertTrue ( info . isConsistentWithProducerExpectations ( ) ) ; assertTrue ( info . isRegistrationValid ( ) ) ; assertFalse ( info . isRefreshNeeded ( ) ) ; assertTrue ( info . isRegistrationRequired ( ) ) ; assertTrue ( info . isRegistrationDeterminedRequired ( ) ) ; assertFalse ( info . isRegistrationDeterminedNotRequired ( ) ) ; assertFalse ( info . isModifyRegistrationNeeded ( ) ) ; } public void testGetRegistrationData ( ) { assertNotNull ( info . getRegistrationData ( ) ) ; assertFalse ( info . isModifiedSinceLastRefresh ( ) ) ; assertFalse ( info . isModifyRegistrationNeeded ( ) ) ; info . setRegistrationPropertyValue ( "<STR_LIT>" , "<STR_LIT>" ) ; assertTrue ( info . isModifiedSinceLastRefresh ( ) ) ; assertFalse ( info . isModifyRegistrationNeeded ( ) ) ; RegistrationData registrationData = info . getRegistrationData ( ) ; checkRegistrationData ( registrationData , "<STR_LIT>" ) ; info . setRegistrationPropertyValue ( "<STR_LIT>" , "<STR_LIT:value1>" ) ; assertTrue ( info . isModifiedSinceLastRefresh ( ) ) ; assertFalse ( info . isModifyRegistrationNeeded ( ) ) ; register ( ) ; assertFalse ( info . isModifiedSinceLastRefresh ( ) ) ; assertFalse ( info . isModifyRegistrationNeeded ( ) ) ; List < Property > properties = info . getRegistrationData ( ) . getRegistrationProperties ( ) ; assertEquals ( "<STR_LIT:value1>" , properties . get ( <NUM_LIT:0> ) . getStringValue ( ) ) ; } public void testGetRegistrationDataWithInitialWrongValue ( ) { info . setRegistrationPropertyValue ( "<STR_LIT>" , "<STR_LIT>" ) ; info . refresh ( createServiceDescription ( true , <NUM_LIT:1> ) , producerId , true , true , false ) ; checkRegistrationData ( info . getRegistrationData ( ) , "<STR_LIT>" ) ; info . setRegistrationPropertyValue ( "<STR_LIT>" , "<STR_LIT>" ) ; RefreshResult res = info . refresh ( createServiceDescription ( true , <NUM_LIT:1> ) , producerId , true , true , false ) ; assertFalse ( res . hasIssues ( ) ) ; checkRegistrationData ( info . getRegistrationData ( ) , "<STR_LIT>" ) ; } public void testRefreshWhileRegisteredAndProducerNotSendingPropertyDescriptions ( ) { info . setRegistrationPropertyValue ( "<STR_LIT>" , "<STR_LIT>" ) ; info . refresh ( createServiceDescription ( true , <NUM_LIT:1> ) , producerId , true , true , false ) ; info . setRegistrationContext ( FAKE_REGISTRATION_CONTEXT ) ; assertTrue ( info . isRegistrationRequired ( ) ) ; assertTrue ( info . isRegistrationValid ( ) ) ; ServiceDescription description = createServiceDescription ( true , <NUM_LIT:0> ) ; info . refresh ( description , producerId , true , true , false ) ; assertTrue ( info . isRegistrationValid ( ) ) ; RegistrationProperty prop = info . getRegistrationProperty ( "<STR_LIT>" ) ; assertNotNull ( prop ) ; assertFalse ( prop . isInvalid ( ) ) ; info . refresh ( description , producerId , true , true , true ) ; assertFalse ( info . isRegistrationValid ( ) ) ; assertNull ( info . getRegistrationProperty ( "<STR_LIT>" ) ) ; } public void testRefreshRegisteredWithoutPropsAndProducerNowSendsProps ( ) { info . setRegistrationContext ( FAKE_REGISTRATION_CONTEXT ) ; assertTrue ( info . isRegistrationRequired ( ) ) ; assertTrue ( info . isRegistrationValid ( ) ) ; info . refresh ( createServiceDescription ( true , <NUM_LIT:1> ) , producerId , true , true , true ) ; assertTrue ( info . isRegistrationRequired ( ) ) ; assertTrue ( info . isRegistrationDeterminedRequired ( ) ) ; assertFalse ( info . isRegistrationValid ( ) ) ; assertFalse ( info . isConsistentWithProducerExpectations ( ) ) ; assertFalse ( info . isModifiedSinceLastRefresh ( ) ) ; } private void checkRegistrationData ( RegistrationData registrationData , String prop0Value ) { assertNotNull ( registrationData ) ; List < Property > properties = registrationData . getRegistrationProperties ( ) ; assertNotNull ( properties ) ; assertEquals ( <NUM_LIT:1> , properties . size ( ) ) ; Property property = properties . get ( <NUM_LIT:0> ) ; assertEquals ( "<STR_LIT>" , property . getName ( ) . toString ( ) ) ; assertEquals ( prop0Value , property . getStringValue ( ) ) ; } private ServiceDescription createServiceDescription ( boolean requiresRegistration , int numberOfProperties ) { return ServiceDescriptionBehavior . createServiceDescription ( requiresRegistration , numberOfProperties ) ; } } </s>
|
<s> package org . gatein . wsrp . consumer . migration ; import junit . framework . TestCase ; import java . util . List ; import java . util . TreeMap ; public class MigrationServiceTestCase extends TestCase { private MigrationService service ; @ Override protected void setUp ( ) throws Exception { service = new InMemoryMigrationService ( ) ; } public void testIsAvailableExportInfosEmpty ( ) { assertTrue ( service . isAvailableExportInfosEmpty ( ) ) ; } public void testAddExport ( ) { ExportInfo info = new ExportInfo ( System . currentTimeMillis ( ) , null , new TreeMap < String , byte [ ] > ( ) , null ) ; service . add ( info ) ; List < ExportInfo > exports = service . getAvailableExportInfos ( ) ; assertNotNull ( exports ) ; assertEquals ( <NUM_LIT:1> , exports . size ( ) ) ; assertEquals ( info , exports . get ( <NUM_LIT:0> ) ) ; assertEquals ( info , service . getExportInfo ( info . getExportTime ( ) ) ) ; assertFalse ( service . isAvailableExportInfosEmpty ( ) ) ; } } </s>
|
<s> package org . gatein . wsrp . protocol . v2 ; import org . gatein . pc . api . Portlet ; import org . gatein . pc . api . PortletInvokerException ; import org . gatein . wsrp . test . ExtendedAssert ; import org . gatein . wsrp . test . protocol . v2 . BehaviorRegistry ; import java . util . HashSet ; import java . util . Set ; public class InteropServiceDescriptionTestCase extends V2ConsumerBaseTest { public InteropServiceDescriptionTestCase ( ) throws Exception { super ( ) ; } @ Override public void setUp ( ) throws Exception { setStrict ( false ) ; super . setUp ( ) ; } public void testUsesRelaxedMode ( ) { ExtendedAssert . assertFalse ( isStrict ( ) ) ; } public void testGetPortlets ( ) throws PortletInvokerException { Set returnedPortlets = consumer . getPortlets ( ) ; int portletNumber = returnedPortlets . size ( ) ; ExtendedAssert . assertEquals ( getPortletNumber ( ) , portletNumber ) ; Set < String > handles = getPortletHandles ( ) ; Set < String > consumerHandles = new HashSet < String > ( portletNumber ) ; for ( Object o : returnedPortlets ) { Portlet portlet = ( Portlet ) o ; consumerHandles . add ( portlet . getContext ( ) . getId ( ) ) ; } ExtendedAssert . assertTrue ( handles . containsAll ( consumerHandles ) ) ; } @ Override protected void registerAdditionalMarkupBehaviors ( BehaviorRegistry registry ) { } } </s>
|
<s> package org . gatein . wsrp . protocol . v2 ; import junit . framework . TestCase ; import org . gatein . wsrp . consumer . EndpointConfigurationInfo ; import org . gatein . wsrp . consumer . ProducerInfo ; import org . gatein . wsrp . consumer . WSRPConsumerImpl ; import org . gatein . wsrp . spec . v2 . WSRP2Constants ; import org . gatein . wsrp . test . ExtendedAssert ; import org . gatein . wsrp . test . protocol . v2 . BehaviorBackedServiceFactory ; import org . gatein . wsrp . test . protocol . v2 . BehaviorRegistry ; import org . gatein . wsrp . test . protocol . v2 . PortletManagementBehavior ; import org . gatein . wsrp . test . protocol . v2 . RegistrationBehavior ; import org . gatein . wsrp . test . protocol . v2 . ServiceDescriptionBehavior ; import org . gatein . wsrp . test . protocol . v2 . TestProducerBehavior ; import org . gatein . wsrp . test . protocol . v2 . TestWSRPProducer ; import org . gatein . wsrp . test . protocol . v2 . TestWSRPProducerImpl ; import org . gatein . wsrp . test . protocol . v2 . behaviors . BasicMarkupBehavior ; import org . gatein . wsrp . test . protocol . v2 . behaviors . BasicPortletManagementBehavior ; import org . gatein . wsrp . test . protocol . v2 . behaviors . BasicServiceDescriptionBehavior ; import org . gatein . wsrp . test . protocol . v2 . behaviors . EmptyMarkupBehavior ; import org . gatein . wsrp . test . protocol . v2 . behaviors . ExtensionMarkupBehavior ; import org . gatein . wsrp . test . protocol . v2 . behaviors . InitCookieNotRequiredMarkupBehavior ; import org . gatein . wsrp . test . protocol . v2 . behaviors . NullMarkupBehavior ; import org . gatein . wsrp . test . protocol . v2 . behaviors . PerGroupInitCookieMarkupBehavior ; import org . gatein . wsrp . test . protocol . v2 . behaviors . PerUserInitCookieMarkupBehavior ; import org . gatein . wsrp . test . protocol . v2 . behaviors . ResourceMarkupBehavior ; import org . gatein . wsrp . test . protocol . v2 . behaviors . SessionMarkupBehavior ; import org . gatein . wsrp . test . support . MockConsumerRegistry ; import org . gatein . wsrp . test . support . RequestedMarkupBehavior ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; import java . util . Set ; public abstract class WSRP2ConsumerBaseTest extends TestCase { private static Logger log = LoggerFactory . getLogger ( WSRP2ConsumerBaseTest . class ) ; private static final String TEST_PRODUCER_ID = "<STR_LIT>" ; protected TestWSRPProducer producer = new TestWSRPProducerImpl ( ) ; protected WSRPConsumerImpl consumer = new WSRPConsumerImpl ( new ProducerInfo ( new MockConsumerRegistry ( ) ) ) ; private boolean strict = true ; public void setUp ( ) throws Exception { producer . reset ( ) ; ProducerInfo producerInfo = consumer . getProducerInfo ( ) ; producerInfo . setId ( TEST_PRODUCER_ID ) ; producerInfo . setSupportedOption ( WSRP2Constants . OPTIONS_EXPORT ) ; producerInfo . setSupportedOption ( WSRP2Constants . OPTIONS_IMPORT ) ; BehaviorRegistry registry = producer . getBehaviorRegistry ( ) ; setServiceDescriptionBehavior ( null ) ; setPortletManagementBehavior ( null ) ; setRegistrationBehavior ( null ) ; registerAdditionalMarkupBehaviors ( registry ) ; producerInfo . setEndpointConfigurationInfo ( new EndpointConfigurationInfo ( new BehaviorBackedServiceFactory ( registry ) ) ) ; producerInfo . setExpirationCacheSeconds ( null ) ; consumer . refreshProducerInfo ( ) ; producerInfo . setExpirationCacheSeconds ( <NUM_LIT> ) ; } protected void setRegistrationBehavior ( RegistrationBehavior behavior ) { producer . getBehaviorRegistry ( ) . setRegistrationBehavior ( behavior ) ; } protected void setServiceDescriptionBehavior ( ServiceDescriptionBehavior behavior ) { if ( behavior == null ) { log . debug ( "<STR_LIT>" ) ; behavior = new BasicServiceDescriptionBehavior ( ) ; } producer . getBehaviorRegistry ( ) . setServiceDescriptionBehavior ( behavior ) ; } protected void setPortletManagementBehavior ( PortletManagementBehavior behavior ) { BehaviorRegistry registry = producer . getBehaviorRegistry ( ) ; if ( behavior == null ) { log . debug ( "<STR_LIT>" ) ; behavior = new BasicPortletManagementBehavior ( registry ) ; } registry . setPortletManagementBehavior ( behavior ) ; } public void testProducerId ( ) { ExtendedAssert . assertEquals ( TEST_PRODUCER_ID , consumer . getProducerId ( ) ) ; } public void setStrict ( boolean strict ) { this . strict = strict ; producer . usingStrictModeChangedTo ( strict ) ; } public boolean isStrict ( ) { return strict ; } private < T extends TestProducerBehavior > T createBehavior ( String behaviorClassName , Class < T > expectedBehaviorClass ) { if ( behaviorClassName != null ) { try { Class behaviorClass = getClass ( ) . getClassLoader ( ) . loadClass ( behaviorClassName ) ; if ( expectedBehaviorClass . isAssignableFrom ( behaviorClass ) ) { return expectedBehaviorClass . cast ( behaviorClass . newInstance ( ) ) ; } else { throw new IllegalArgumentException ( behaviorClassName + "<STR_LIT>" + expectedBehaviorClass . getSimpleName ( ) ) ; } } catch ( ClassNotFoundException e ) { throw new IllegalArgumentException ( "<STR_LIT>" + behaviorClassName , e ) ; } catch ( IllegalAccessException e ) { throw new IllegalArgumentException ( "<STR_LIT>" + behaviorClassName , e ) ; } catch ( InstantiationException e ) { throw new IllegalArgumentException ( "<STR_LIT>" + behaviorClassName , e ) ; } } return null ; } protected void registerAdditionalMarkupBehaviors ( BehaviorRegistry registry ) { registry . registerMarkupBehavior ( new BasicMarkupBehavior ( registry ) ) ; registry . registerMarkupBehavior ( new EmptyMarkupBehavior ( registry ) ) ; registry . registerMarkupBehavior ( new InitCookieNotRequiredMarkupBehavior ( registry ) ) ; registry . registerMarkupBehavior ( new PerGroupInitCookieMarkupBehavior ( registry ) ) ; registry . registerMarkupBehavior ( new PerUserInitCookieMarkupBehavior ( registry ) ) ; registry . registerMarkupBehavior ( new NullMarkupBehavior ( registry ) ) ; registry . registerMarkupBehavior ( new SessionMarkupBehavior ( registry ) ) ; registry . registerMarkupBehavior ( new ResourceMarkupBehavior ( registry ) ) ; registry . registerMarkupBehavior ( new ExtensionMarkupBehavior ( registry ) ) ; } protected Set < String > getPortletHandles ( ) { return producer . getBehaviorRegistry ( ) . getServiceDescriptionBehavior ( ) . getPortletHandles ( ) ; } protected int getPortletNumber ( ) { return producer . getBehaviorRegistry ( ) . getServiceDescriptionBehavior ( ) . getPortletNumber ( ) ; } @ Override protected void tearDown ( ) throws Exception { RequestedMarkupBehavior . setRequestedMarkupBehavior ( null ) ; } } </s>
|
<s> package org . gatein . wsrp . protocol . v2 ; import org . gatein . pc . api . Portlet ; import org . gatein . pc . api . PortletContext ; import org . gatein . pc . api . PortletInvokerException ; import org . gatein . wsrp . consumer . ProducerInfo ; import org . gatein . wsrp . test . ExtendedAssert ; import org . gatein . wsrp . test . protocol . v1 . behaviors . BasicMarkupBehavior ; import org . gatein . wsrp . test . protocol . v1 . behaviors . SessionMarkupBehavior ; import org . gatein . wsrp . test . protocol . v2 . BehaviorRegistry ; import org . gatein . wsrp . test . protocol . v2 . ServiceDescriptionBehavior ; import org . gatein . wsrp . test . protocol . v2 . behaviors . GroupedPortletsServiceDescriptionBehavior ; import org . oasis . wsrp . v2 . CookieProtocol ; import org . oasis . wsrp . v2 . EventDescription ; import org . oasis . wsrp . v2 . ExportDescription ; import org . oasis . wsrp . v2 . Extension ; import org . oasis . wsrp . v2 . InvalidRegistration ; import org . oasis . wsrp . v2 . ItemDescription ; import org . oasis . wsrp . v2 . ModelDescription ; import org . oasis . wsrp . v2 . ModelTypes ; import org . oasis . wsrp . v2 . ModifyRegistrationRequired ; import org . oasis . wsrp . v2 . OperationFailed ; import org . oasis . wsrp . v2 . PortletDescription ; import org . oasis . wsrp . v2 . ResourceList ; import org . oasis . wsrp . v2 . ResourceSuspended ; import javax . xml . ws . Holder ; import java . util . List ; public class ServiceDescriptionTestCase extends InteropServiceDescriptionTestCase { public ServiceDescriptionTestCase ( ) throws Exception { super ( ) ; } @ Override public void setUp ( ) throws Exception { super . setUp ( ) ; setStrict ( true ) ; } public void testUsesRelaxedMode ( ) { ExtendedAssert . assertTrue ( isStrict ( ) ) ; } public void testGetPortlet ( ) throws Exception { Portlet portlet = consumer . getPortlet ( PortletContext . createPortletContext ( BasicMarkupBehavior . PORTLET_HANDLE , false ) ) ; checkPortlet ( portlet , "<STR_LIT>" , BasicMarkupBehavior . PORTLET_HANDLE ) ; portlet = consumer . getPortlet ( PortletContext . createPortletContext ( SessionMarkupBehavior . PORTLET_HANDLE , false ) ) ; checkPortlet ( portlet , "<STR_LIT:2>" , SessionMarkupBehavior . PORTLET_HANDLE ) ; } public void testRequiresInitCookieIsProperlySetOnConsumerInitiatedRefresh ( ) throws OperationFailed , ResourceSuspended , ModifyRegistrationRequired , InvalidRegistration , PortletInvokerException { BehaviorRegistry registry = producer . getBehaviorRegistry ( ) ; Holder < List < PortletDescription > > offeredPortlets = new Holder < List < PortletDescription > > ( ) ; registry . getServiceDescriptionBehavior ( ) . getServiceDescription ( null , null , null , null , new Holder < Boolean > ( ) , offeredPortlets , new Holder < List < ItemDescription > > ( ) , null , new Holder < List < ItemDescription > > ( ) , new Holder < List < ItemDescription > > ( ) , new Holder < CookieProtocol > ( ) , new Holder < ModelDescription > ( ) , new Holder < List < String > > ( ) , new Holder < ResourceList > ( ) , new Holder < List < EventDescription > > ( ) , new Holder < ModelTypes > ( ) , new Holder < List < String > > ( ) , new Holder < ExportDescription > ( ) , new Holder < Boolean > ( ) , new Holder < List < Extension > > ( ) ) ; setServiceDescriptionBehavior ( new GroupedPortletsServiceDescriptionBehavior ( offeredPortlets . value ) ) ; ServiceDescriptionBehavior sdb = new GroupedPortletsServiceDescriptionBehavior ( offeredPortlets . value ) ; sdb . setRequiresInitCookie ( CookieProtocol . PER_GROUP ) ; setServiceDescriptionBehavior ( sdb ) ; consumer . refreshProducerInfo ( ) ; ProducerInfo producerInfo = consumer . getProducerInfo ( ) ; assertEquals ( CookieProtocol . PER_GROUP , producerInfo . getRequiresInitCookie ( ) ) ; assertTrue ( consumer . getSessionHandler ( ) . requiresInitCookie ( ) ) ; } public void testRequiresInitCookieIsProperlySetOnProducerInfoInitiatedRefresh ( ) throws OperationFailed , ResourceSuspended , ModifyRegistrationRequired , InvalidRegistration , PortletInvokerException { BehaviorRegistry registry = producer . getBehaviorRegistry ( ) ; Holder < List < PortletDescription > > offeredPortlets = new Holder < List < PortletDescription > > ( ) ; registry . getServiceDescriptionBehavior ( ) . getServiceDescription ( null , null , null , null , new Holder < Boolean > ( ) , offeredPortlets , new Holder < List < ItemDescription > > ( ) , null , new Holder < List < ItemDescription > > ( ) , new Holder < List < ItemDescription > > ( ) , new Holder < CookieProtocol > ( ) , new Holder < ModelDescription > ( ) , new Holder < List < String > > ( ) , new Holder < ResourceList > ( ) , new Holder < List < EventDescription > > ( ) , new Holder < ModelTypes > ( ) , new Holder < List < String > > ( ) , new Holder < ExportDescription > ( ) , new Holder < Boolean > ( ) , new Holder < List < Extension > > ( ) ) ; setServiceDescriptionBehavior ( new GroupedPortletsServiceDescriptionBehavior ( offeredPortlets . value ) ) ; ServiceDescriptionBehavior sdb = new GroupedPortletsServiceDescriptionBehavior ( offeredPortlets . value ) ; sdb . setRequiresInitCookie ( CookieProtocol . PER_GROUP ) ; setServiceDescriptionBehavior ( sdb ) ; consumer . getProducerInfo ( ) . refresh ( true ) ; ProducerInfo producerInfo = consumer . getProducerInfo ( ) ; assertEquals ( CookieProtocol . PER_GROUP , producerInfo . getRequiresInitCookie ( ) ) ; assertTrue ( consumer . getSessionHandler ( ) . requiresInitCookie ( ) ) ; } } </s>
|
<s> package org . gatein . wsrp . protocol . v2 ; import org . gatein . pc . api . Portlet ; import org . gatein . pc . api . PortletContext ; import org . gatein . pc . api . PortletInvokerException ; import org . gatein . pc . api . PortletStateType ; import org . gatein . pc . api . info . MetaInfo ; import org . gatein . pc . api . state . DestroyCloneFailure ; import org . gatein . pc . api . state . PropertyChange ; import org . gatein . pc . api . state . PropertyMap ; import org . gatein . wsrp . consumer . migration . ExportInfo ; import org . gatein . wsrp . test . ExtendedAssert ; import org . gatein . wsrp . test . protocol . v2 . BehaviorRegistry ; import org . gatein . wsrp . test . protocol . v2 . behaviors . BasicMarkupBehavior ; import org . gatein . wsrp . test . protocol . v2 . behaviors . BasicPortletManagementBehavior ; import org . gatein . wsrp . test . protocol . v2 . behaviors . DestroyClonesPortletManagementBehavior ; import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; public class PortletManagementTestCase extends V2ConsumerBaseTest { public PortletManagementTestCase ( ) throws Exception { } public void testClone ( ) throws Exception { PortletContext original = PortletContext . createPortletContext ( BasicMarkupBehavior . PORTLET_HANDLE , false ) ; PortletContext clone = consumer . createClone ( PortletStateType . OPAQUE , original ) ; ExtendedAssert . assertNotNull ( clone ) ; ExtendedAssert . assertFalse ( original . equals ( clone ) ) ; ExtendedAssert . assertEquals ( BasicPortletManagementBehavior . CLONED_HANDLE , clone . getId ( ) ) ; Portlet originalPortlet = consumer . getPortlet ( original ) ; Portlet clonePortlet = consumer . getPortlet ( clone ) ; ExtendedAssert . assertNotNull ( clonePortlet ) ; ExtendedAssert . assertFalse ( originalPortlet . getContext ( ) . equals ( clonePortlet . getContext ( ) ) ) ; MetaInfo originalInfo = originalPortlet . getInfo ( ) . getMeta ( ) ; MetaInfo cloneInfo = clonePortlet . getInfo ( ) . getMeta ( ) ; ExtendedAssert . assertEquals ( originalInfo . getMetaValue ( MetaInfo . TITLE ) , cloneInfo . getMetaValue ( MetaInfo . TITLE ) ) ; ExtendedAssert . assertEquals ( originalInfo . getMetaValue ( MetaInfo . DESCRIPTION ) , cloneInfo . getMetaValue ( MetaInfo . DESCRIPTION ) ) ; } public void testGetSetProperties ( ) throws Exception { PortletContext original = PortletContext . createPortletContext ( BasicMarkupBehavior . PORTLET_HANDLE , false ) ; PropertyMap props = consumer . getProperties ( original ) ; checkProperties ( props , BasicPortletManagementBehavior . PROPERTY_VALUE ) ; PortletContext clone = consumer . createClone ( PortletStateType . OPAQUE , original ) ; props = consumer . getProperties ( clone ) ; checkProperties ( props , BasicPortletManagementBehavior . PROPERTY_VALUE ) ; consumer . setProperties ( clone , new PropertyChange [ ] { PropertyChange . newUpdate ( BasicPortletManagementBehavior . PROPERTY_NAME , BasicPortletManagementBehavior . PROPERTY_NEW_VALUE ) } ) ; checkProperties ( consumer . getProperties ( clone ) , BasicPortletManagementBehavior . PROPERTY_NEW_VALUE ) ; consumer . setProperties ( clone , new PropertyChange [ ] { PropertyChange . newReset ( BasicPortletManagementBehavior . PROPERTY_NAME ) } ) ; checkProperties ( consumer . getProperties ( clone ) , BasicPortletManagementBehavior . PROPERTY_VALUE ) ; } public void testSetResetSameProperty ( ) throws PortletInvokerException { PortletContext original = PortletContext . createPortletContext ( BasicMarkupBehavior . PORTLET_HANDLE , false ) ; PortletContext clone = consumer . createClone ( PortletStateType . OPAQUE , original ) ; try { consumer . setProperties ( clone , new PropertyChange [ ] { PropertyChange . newUpdate ( BasicPortletManagementBehavior . PROPERTY_NAME , BasicPortletManagementBehavior . PROPERTY_NEW_VALUE ) , PropertyChange . newReset ( BasicPortletManagementBehavior . PROPERTY_NAME ) } ) ; fail ( "<STR_LIT>" ) ; } catch ( Exception e ) { assertTrue ( e . getCause ( ) . getLocalizedMessage ( ) . contains ( BasicPortletManagementBehavior . CANNOT_BOTH_SET_AND_RESET_A_PROPERTY_AT_THE_SAME_TIME ) ) ; } } private void checkProperties ( PropertyMap props , String expectedValue ) { ExtendedAssert . assertNotNull ( props ) ; ExtendedAssert . assertEquals ( <NUM_LIT:1> , props . size ( ) ) ; ExtendedAssert . assertEquals ( expectedValue , props . getProperty ( BasicPortletManagementBehavior . PROPERTY_NAME ) . get ( <NUM_LIT:0> ) ) ; } public void testDestroyClones ( ) throws Exception { BehaviorRegistry behaviorRegistry = producer . getBehaviorRegistry ( ) ; behaviorRegistry . setPortletManagementBehavior ( new DestroyClonesPortletManagementBehavior ( behaviorRegistry ) ) ; PortletContext original = PortletContext . createPortletContext ( BasicMarkupBehavior . PORTLET_HANDLE , false ) ; PortletContext clone = consumer . createClone ( PortletStateType . OPAQUE , original ) ; ExtendedAssert . assertNotNull ( clone ) ; Portlet portlet = consumer . getPortlet ( clone ) ; ExtendedAssert . assertNotNull ( portlet ) ; ExtendedAssert . assertEquals ( BasicPortletManagementBehavior . CLONED_HANDLE , portlet . getContext ( ) . getId ( ) ) ; List clones = new ArrayList ( <NUM_LIT:1> ) ; clones . add ( clone ) ; List result = consumer . destroyClones ( clones ) ; ExtendedAssert . assertTrue ( result . isEmpty ( ) ) ; try { consumer . getPortlet ( clone ) ; ExtendedAssert . fail ( "<STR_LIT>" ) ; } catch ( PortletInvokerException expected ) { } clone = consumer . createClone ( PortletStateType . OPAQUE , original ) ; PortletContext invalidContext = PortletContext . createPortletContext ( "<STR_LIT>" , false ) ; clones . add ( invalidContext ) ; result = consumer . destroyClones ( clones ) ; ExtendedAssert . assertEquals ( <NUM_LIT:1> , result . size ( ) ) ; DestroyCloneFailure failure = ( DestroyCloneFailure ) result . get ( <NUM_LIT:0> ) ; ExtendedAssert . assertEquals ( "<STR_LIT>" , failure . getPortletId ( ) ) ; try { consumer . getPortlet ( clone ) ; ExtendedAssert . fail ( "<STR_LIT>" ) ; } catch ( PortletInvokerException expected ) { } } public void testInvalidSetProperties ( ) throws Exception { PortletContext original = PortletContext . createPortletContext ( BasicMarkupBehavior . PORTLET_HANDLE , false ) ; try { consumer . setProperties ( original , null ) ; ExtendedAssert . fail ( "<STR_LIT>" ) ; } catch ( IllegalArgumentException expected ) { } } public void testNullExportPortlets ( ) throws PortletInvokerException { try { consumer . exportPortlets ( null ) ; fail ( "<STR_LIT>" ) ; } catch ( IllegalArgumentException e ) { } } public void testEmptyExportPortlets ( ) throws PortletInvokerException { try { consumer . exportPortlets ( Collections . < String > emptyList ( ) ) ; fail ( "<STR_LIT>" ) ; } catch ( IllegalArgumentException e ) { } } public void testExportPortlets ( ) throws PortletInvokerException { long now = System . currentTimeMillis ( ) ; ArrayList < String > portletContexts = new ArrayList < String > ( ) ; portletContexts . add ( BasicMarkupBehavior . PORTLET_HANDLE ) ; ExportInfo ei = consumer . exportPortlets ( portletContexts ) ; assertNotNull ( ei ) ; long tenSeconds = <NUM_LIT:10> * <NUM_LIT:1000> ; assertTrue ( ( ei . getExportTime ( ) - now ) < tenSeconds ) ; assertEquals ( <NUM_LIT:0> , ei . getExpirationTime ( ) ) ; List < String > exportedPortlets = ei . getExportedPortletHandles ( ) ; assertNotNull ( exportedPortlets ) ; assertEquals ( <NUM_LIT:1> , exportedPortlets . size ( ) ) ; assertTrue ( exportedPortlets . contains ( BasicMarkupBehavior . PORTLET_HANDLE ) ) ; assertNotNull ( ei . getPortletStateFor ( BasicMarkupBehavior . PORTLET_HANDLE ) ) ; assertTrue ( ei . getErrorCodesToFailedPortletHandlesMapping ( ) . isEmpty ( ) ) ; List < ExportInfo > availableExportInfos = consumer . getMigrationService ( ) . getAvailableExportInfos ( ) ; assertEquals ( <NUM_LIT:1> , availableExportInfos . size ( ) ) ; assertEquals ( ei , availableExportInfos . get ( <NUM_LIT:0> ) ) ; } } </s>
|
<s> package org . gatein . wsrp . protocol . v2 ; import org . gatein . pc . api . Portlet ; import org . gatein . pc . api . info . MetaInfo ; import org . gatein . wsrp . test . ExtendedAssert ; import org . gatein . wsrp . test . protocol . v2 . TestProducerBehavior ; public class V2ConsumerBaseTest extends WSRP2ConsumerBaseTest { public V2ConsumerBaseTest ( ) throws Exception { } protected void checkPortlet ( Portlet portlet , String suffix , String handle ) { MetaInfo meta = portlet . getInfo ( ) . getMeta ( ) ; ExtendedAssert . assertEquals ( handle , portlet . getContext ( ) . getId ( ) ) ; ExtendedAssert . assertEquals ( TestProducerBehavior . SAMPLE_DESCRIPTION + suffix , TestProducerBehavior . extractString ( meta . getMetaValue ( MetaInfo . DESCRIPTION ) ) ) ; ExtendedAssert . assertEquals ( TestProducerBehavior . SAMPLE_TITLE + suffix , TestProducerBehavior . extractString ( meta . getMetaValue ( MetaInfo . TITLE ) ) ) ; ExtendedAssert . assertEquals ( TestProducerBehavior . SAMPLE_SHORTTITLE + suffix , TestProducerBehavior . extractString ( meta . getMetaValue ( MetaInfo . SHORT_TITLE ) ) ) ; ExtendedAssert . assertEquals ( TestProducerBehavior . SAMPLE_DISPLAYNAME + suffix , TestProducerBehavior . extractString ( meta . getMetaValue ( MetaInfo . DISPLAY_NAME ) ) ) ; ExtendedAssert . assertEquals ( TestProducerBehavior . SAMPLE_KEYWORD + suffix , TestProducerBehavior . extractString ( meta . getMetaValue ( MetaInfo . KEYWORDS ) ) ) ; } public void setUp ( ) throws Exception { super . setUp ( ) ; } } </s>
|
<s> package org . gatein . wsrp . protocol . v2 ; import org . gatein . pc . api . Mode ; import org . gatein . pc . api . OpaqueStateString ; import org . gatein . pc . api . PortletContext ; import org . gatein . pc . api . PortletInvokerException ; import org . gatein . pc . api . WindowState ; import org . gatein . pc . api . invocation . ActionInvocation ; import org . gatein . pc . api . invocation . PortletInvocation ; import org . gatein . pc . api . invocation . RenderInvocation ; import org . gatein . pc . api . invocation . response . ErrorResponse ; import org . gatein . pc . api . invocation . response . FragmentResponse ; import org . gatein . pc . api . invocation . response . PortletInvocationResponse ; import org . gatein . pc . api . invocation . response . UpdateNavigationalStateResponse ; import org . gatein . pc . portlet . impl . spi . AbstractInstanceContext ; import org . gatein . pc . portlet . impl . spi . AbstractPortalContext ; import org . gatein . pc . portlet . impl . spi . AbstractSecurityContext ; import org . gatein . pc . portlet . impl . spi . AbstractUserContext ; import org . gatein . pc . portlet . impl . spi . AbstractWindowContext ; import org . gatein . wsrp . WSRPResourceURL ; 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 . consumer . handlers . ProducerSessionInformation ; import org . gatein . wsrp . payload . PayloadUtils ; import org . gatein . wsrp . test . ExtendedAssert ; import org . gatein . wsrp . test . protocol . v2 . BehaviorRegistry ; import org . gatein . wsrp . test . protocol . v2 . behaviors . BasicMarkupBehavior ; import org . gatein . wsrp . test . protocol . v2 . behaviors . EmptyMarkupBehavior ; import org . gatein . wsrp . test . protocol . v2 . behaviors . ExtensionMarkupBehavior ; import org . gatein . wsrp . test . protocol . v2 . behaviors . GroupedPortletsServiceDescriptionBehavior ; import org . gatein . wsrp . test . protocol . v2 . behaviors . InitCookieMarkupBehavior ; import org . gatein . wsrp . test . protocol . v2 . behaviors . InitCookieNotRequiredMarkupBehavior ; import org . gatein . wsrp . test . protocol . v2 . behaviors . NullMarkupBehavior ; import org . gatein . wsrp . test . protocol . v2 . behaviors . PerGroupInitCookieMarkupBehavior ; import org . gatein . wsrp . test . protocol . v2 . behaviors . PerUserInitCookieMarkupBehavior ; import org . gatein . wsrp . test . protocol . v2 . behaviors . ResourceMarkupBehavior ; import org . gatein . wsrp . test . protocol . v2 . behaviors . SessionMarkupBehavior ; import org . gatein . wsrp . test . support . MockHttpServletRequest ; import org . gatein . wsrp . test . support . RequestedMarkupBehavior ; import org . gatein . wsrp . test . support . TestPortletInvocationContext ; import org . oasis . wsrp . v2 . BlockingInteractionResponse ; import org . oasis . wsrp . v2 . CookieProtocol ; import org . oasis . wsrp . v2 . EventDescription ; import org . oasis . wsrp . v2 . ExportDescription ; import org . oasis . wsrp . v2 . Extension ; import org . oasis . wsrp . v2 . InteractionParams ; import org . oasis . wsrp . v2 . InvalidHandle ; import org . oasis . wsrp . v2 . InvalidRegistration ; import org . oasis . wsrp . v2 . ItemDescription ; import org . oasis . wsrp . v2 . MarkupParams ; import org . oasis . wsrp . v2 . MarkupResponse ; import org . oasis . wsrp . v2 . ModelDescription ; import org . oasis . wsrp . v2 . ModelTypes ; import org . oasis . wsrp . v2 . ModifyRegistrationRequired ; import org . oasis . wsrp . v2 . OperationFailed ; import org . oasis . wsrp . v2 . PortletDescription ; import org . oasis . wsrp . v2 . ResourceList ; import org . oasis . wsrp . v2 . ResourceSuspended ; import org . w3c . dom . Element ; import org . w3c . dom . Node ; import javax . servlet . http . HttpSession ; import javax . xml . ws . Holder ; import java . net . MalformedURLException ; import java . net . URL ; import java . util . Collections ; import java . util . List ; import java . util . Locale ; public class MarkupTestCase extends V2ConsumerBaseTest { public MarkupTestCase ( ) throws Exception { super ( ) ; } @ Override protected void tearDown ( ) throws Exception { InvocationHandlerDelegate . registerConsumerDelegate ( null ) ; super . tearDown ( ) ; } public void testInvalidHandle ( ) { try { consumer . invoke ( createRenderInvocation ( "<STR_LIT>" ) ) ; ExtendedAssert . fail ( "<STR_LIT>" ) ; } catch ( PortletInvokerException expected ) { } } public void testEmptyRender ( ) throws Exception { checkRenderResult ( consumer . invoke ( createRenderInvocation ( EmptyMarkupBehavior . PORTLET_HANDLE ) ) , "<STR_LIT>" ) ; } public void testNullAction ( ) throws Exception { ExtendedAssert . assertTrue ( consumer . invoke ( createActionInvocation ( NullMarkupBehavior . PORTLET_HANDLE ) ) instanceof ErrorResponse ) ; } public void testNullRender ( ) throws Exception { ExtendedAssert . assertTrue ( consumer . invoke ( createRenderInvocation ( NullMarkupBehavior . PORTLET_HANDLE ) ) instanceof ErrorResponse ) ; } public void testRender ( ) throws Exception { RenderInvocation render = createRenderInvocation ( BasicMarkupBehavior . PORTLET_HANDLE , Mode . EDIT , WindowState . NORMAL , "<STR_LIT>" ) ; FragmentResponse result = checkRenderResult ( consumer . invoke ( render ) , "<STR_LIT>" ) ; ExtendedAssert . assertEquals ( <NUM_LIT:15> , result . getCacheControl ( ) . getExpirationSecs ( ) ) ; render = createRenderInvocation ( SessionMarkupBehavior . PORTLET_HANDLE ) ; result = checkRenderResult ( consumer . invoke ( render ) , "<STR_LIT>" ) ; ExtendedAssert . assertEquals ( <NUM_LIT:0> , result . getCacheControl ( ) . getExpirationSecs ( ) ) ; } public void testRenderWithSimpleExtensions ( ) throws PortletInvokerException { InvocationHandlerDelegate . registerConsumerDelegate ( new InvocationHandlerDelegate ( ) { @ Override public void processInvocation ( PortletInvocation invocation ) { ExtensionAccess . getConsumerExtensionAccessor ( ) . addRequestExtension ( MarkupParams . class , ExtensionMarkupBehavior . EXPECTED_REQUEST_EXTENSION_VALUE ) ; } @ Override public void processInvocationResponse ( PortletInvocationResponse response , PortletInvocation invocation ) { final List < UnmarshalledExtension > extensions = ExtensionAccess . getConsumerExtensionAccessor ( ) . getResponseExtensionsFrom ( MarkupResponse . class ) ; assertEquals ( <NUM_LIT:1> , extensions . size ( ) ) ; assertEquals ( ExtensionMarkupBehavior . EXPECTED_RESPONSE_EXTENSION_VALUE , extensions . get ( <NUM_LIT:0> ) . getValue ( ) ) ; } } ) ; checkRenderResult ( consumer . invoke ( createRenderInvocation ( ExtensionMarkupBehavior . PORTLET_HANDLE ) ) , ExtensionMarkupBehavior . SIMPLE_SUCCESS ) ; } public void testRenderWithElementExtensions ( ) throws PortletInvokerException { InvocationHandlerDelegate . registerConsumerDelegate ( new InvocationHandlerDelegate ( ) { @ Override public void processInvocation ( PortletInvocation invocation ) { final String namespaceURI = "<STR_LIT>" ; Element extension = PayloadUtils . createElement ( namespaceURI , "<STR_LIT>" ) ; Node state = extension . getOwnerDocument ( ) . createElementNS ( namespaceURI , "<STR_LIT:state>" ) ; state = extension . appendChild ( state ) ; state . setTextContent ( ExtensionMarkupBehavior . EXPECTED_REQUEST_EXTENSION_VALUE ) ; ExtensionAccess . getConsumerExtensionAccessor ( ) . addRequestExtension ( MarkupParams . class , extension ) ; } @ Override public void processInvocationResponse ( PortletInvocationResponse response , PortletInvocation invocation ) { final List < UnmarshalledExtension > extensions = ExtensionAccess . getConsumerExtensionAccessor ( ) . getResponseExtensionsFrom ( MarkupResponse . class ) ; assertEquals ( <NUM_LIT:1> , extensions . size ( ) ) ; final UnmarshalledExtension unmarshalledExtension = extensions . get ( <NUM_LIT:0> ) ; assertTrue ( unmarshalledExtension . isElement ( ) ) ; Element element = ( Element ) unmarshalledExtension . getValue ( ) ; assertEquals ( ExtensionMarkupBehavior . EXPECTED_RESPONSE_EXTENSION_VALUE , element . getTextContent ( ) ) ; } } ) ; checkRenderResult ( consumer . invoke ( createRenderInvocation ( ExtensionMarkupBehavior . PORTLET_HANDLE ) ) , ExtensionMarkupBehavior . ELEMENT_SUCCESS ) ; } public void testAction ( ) throws Exception { ActionInvocation action = createActionInvocation ( BasicMarkupBehavior . PORTLET_HANDLE ) ; PortletInvocationResponse response = consumer . invoke ( action ) ; ExtendedAssert . assertNotNull ( response ) ; ExtendedAssert . assertTrue ( "<STR_LIT>" + response , response instanceof UpdateNavigationalStateResponse ) ; UpdateNavigationalStateResponse render = ( UpdateNavigationalStateResponse ) response ; ExtendedAssert . assertEquals ( BasicMarkupBehavior . NS , render . getNavigationalState ( ) . getStringValue ( ) ) ; } public void testActionWithSimpleExtensions ( ) throws PortletInvokerException { InvocationHandlerDelegate . registerConsumerDelegate ( new InvocationHandlerDelegate ( ) { @ Override public void processInvocation ( PortletInvocation invocation ) { ExtensionAccess . getConsumerExtensionAccessor ( ) . addRequestExtension ( InteractionParams . class , ExtensionMarkupBehavior . EXPECTED_REQUEST_EXTENSION_VALUE ) ; } @ Override public void processInvocationResponse ( PortletInvocationResponse response , PortletInvocation invocation ) { final List < UnmarshalledExtension > extensions = ExtensionAccess . getConsumerExtensionAccessor ( ) . getResponseExtensionsFrom ( BlockingInteractionResponse . class ) ; assertEquals ( <NUM_LIT:1> , extensions . size ( ) ) ; assertEquals ( ExtensionMarkupBehavior . EXPECTED_RESPONSE_EXTENSION_VALUE , extensions . get ( <NUM_LIT:0> ) . getValue ( ) ) ; } } ) ; consumer . invoke ( createActionInvocation ( ExtensionMarkupBehavior . PORTLET_HANDLE ) ) ; } public void testSessionHandling ( ) throws Exception { RenderInvocation render = createRenderInvocation ( SessionMarkupBehavior . PORTLET_HANDLE ) ; PortletInvocationResponse response = consumer . invoke ( render ) ; checkRenderResult ( response , "<STR_LIT>" ) ; ProducerSessionInformation sessionInfo = consumer . getProducerSessionInformationFrom ( render ) ; String sessionId = sessionInfo . getSessionIdForPortlet ( SessionMarkupBehavior . PORTLET_HANDLE ) ; ExtendedAssert . assertNotNull ( sessionId ) ; ExtendedAssert . assertEquals ( SessionMarkupBehavior . SESSION_ID , sessionId ) ; ExtendedAssert . assertFalse ( sessionInfo . isPerGroupCookies ( ) ) ; ExtendedAssert . assertFalse ( sessionInfo . isInitCookieDone ( ) ) ; response = consumer . invoke ( render ) ; checkRenderResult ( response , "<STR_LIT>" ) ; } public void testInitCookieNotCalledWhenNotNeeded ( ) throws Exception { String handle = InitCookieNotRequiredMarkupBehavior . INIT_COOKIE_NOT_REQUIRED_HANDLE ; InitCookieMarkupBehavior behavior = ( InitCookieMarkupBehavior ) producer . getBehaviorRegistry ( ) . getMarkupBehaviorFor ( handle ) ; consumer . getProducerInfo ( ) . setExpirationCacheSeconds ( <NUM_LIT:0> ) ; ExtendedAssert . assertTrue ( consumer . getProducerInfo ( ) . isRefreshNeeded ( true ) ) ; ProducerSessionInformation sessionInfo = commonInitCookieTest ( handle , behavior , CookieProtocol . NONE . value ( ) ) ; ExtendedAssert . assertNotNull ( sessionInfo ) ; ExtendedAssert . assertFalse ( sessionInfo . isPerGroupCookies ( ) ) ; ExtendedAssert . assertFalse ( sessionInfo . isInitCookieDone ( ) ) ; ExtendedAssert . assertEquals ( <NUM_LIT:0> , behavior . getInitCookieCallCount ( ) ) ; } public void testInitCookiePerUser ( ) throws PortletInvokerException , InvalidHandle { String handle = PerUserInitCookieMarkupBehavior . PER_USER_INIT_COOKIE_HANDLE ; InitCookieMarkupBehavior behavior = ( InitCookieMarkupBehavior ) producer . getBehaviorRegistry ( ) . getMarkupBehaviorFor ( handle ) ; ProducerSessionInformation sessionInfo = commonInitCookieTest ( handle , behavior , CookieProtocol . PER_USER . value ( ) ) ; ExtendedAssert . assertFalse ( sessionInfo . isPerGroupCookies ( ) ) ; ExtendedAssert . assertTrue ( sessionInfo . isInitCookieDone ( ) ) ; ExtendedAssert . assertNotNull ( sessionInfo . getUserCookie ( ) ) ; ExtendedAssert . assertEquals ( <NUM_LIT:1> , behavior . getInitCookieCallCount ( ) ) ; } public void testInitCookiePerGroup ( ) throws PortletInvokerException , OperationFailed , ResourceSuspended , ModifyRegistrationRequired , InvalidRegistration , InvalidHandle { BehaviorRegistry registry = producer . getBehaviorRegistry ( ) ; Holder < List < PortletDescription > > offeredPortlets = new Holder < List < PortletDescription > > ( ) ; registry . getServiceDescriptionBehavior ( ) . getServiceDescription ( null , null , null , null , new Holder < Boolean > ( ) , offeredPortlets , new Holder < List < ItemDescription > > ( ) , null , new Holder < List < ItemDescription > > ( ) , new Holder < List < ItemDescription > > ( ) , new Holder < CookieProtocol > ( ) , new Holder < ModelDescription > ( ) , new Holder < List < String > > ( ) , new Holder < ResourceList > ( ) , new Holder < List < EventDescription > > ( ) , new Holder < ModelTypes > ( ) , new Holder < List < String > > ( ) , new Holder < ExportDescription > ( ) , new Holder < Boolean > ( ) , new Holder < List < Extension > > ( ) ) ; setServiceDescriptionBehavior ( new GroupedPortletsServiceDescriptionBehavior ( offeredPortlets . value ) ) ; String handle = PerGroupInitCookieMarkupBehavior . PER_GROUP_INIT_COOKIE_HANDLE ; InitCookieMarkupBehavior behavior = ( InitCookieMarkupBehavior ) registry . getMarkupBehaviorFor ( handle ) ; ProducerSessionInformation sessionInfo = commonInitCookieTest ( handle , behavior , CookieProtocol . PER_GROUP . value ( ) ) ; ExtendedAssert . assertTrue ( sessionInfo . isPerGroupCookies ( ) ) ; ExtendedAssert . assertTrue ( sessionInfo . isInitCookieDone ( ) ) ; ExtendedAssert . assertNull ( sessionInfo . getUserCookie ( ) ) ; ExtendedAssert . assertEquals ( <NUM_LIT:3> , behavior . getInitCookieCallCount ( ) ) ; } public void testResource ( ) throws PortletInvokerException , MalformedURLException { RenderInvocation render = createRenderInvocation ( ResourceMarkupBehavior . PORTLET_HANDLE ) ; PortletInvocationResponse response = consumer . invoke ( render ) ; String resourceID = WSRPResourceURL . encodeResource ( null , new URL ( "<STR_LIT>" ) , false ) ; String expectedResult = "<STR_LIT>" + resourceID + "<STR_LIT>" ; ; checkRenderResult ( response , expectedResult ) ; } private ProducerSessionInformation commonInitCookieTest ( String handle , InitCookieMarkupBehavior behavior , String cookieProtocol ) throws PortletInvokerException { RenderInvocation render = createRenderInvocation ( handle ) ; TestPortletInvocationContext invocationContext = ( TestPortletInvocationContext ) render . getContext ( ) ; HttpSession session = invocationContext . getClientRequest ( ) . getSession ( ) ; producer . setRequiresInitCookie ( CookieProtocol . fromValue ( cookieProtocol ) ) ; consumer . refreshProducerInfo ( ) ; producer . setCurrentMarkupBehaviorHandle ( handle ) ; render = createRenderInvocation ( handle , invocationContext ) ; ExtendedAssert . assertEquals ( <NUM_LIT:0> , behavior . getInitCookieCallCount ( ) ) ; consumer . invoke ( render ) ; ExtendedAssert . assertEquals ( cookieProtocol , consumer . getProducerInfo ( ) . getRequiresInitCookie ( ) . value ( ) ) ; return consumer . getProducerSessionInformationFrom ( session ) ; } private FragmentResponse checkRenderResult ( PortletInvocationResponse response , String markup ) { ExtendedAssert . assertNotNull ( response ) ; if ( response instanceof ErrorResponse ) { ErrorResponse errorResponse = ( ErrorResponse ) response ; ExtendedAssert . fail ( "<STR_LIT>" + errorResponse . getMessage ( ) ) ; } ExtendedAssert . assertTrue ( "<STR_LIT>" + response , response instanceof FragmentResponse ) ; FragmentResponse fragment = ( FragmentResponse ) response ; ExtendedAssert . assertEquals ( markup , fragment . getChars ( ) . toString ( ) ) ; return fragment ; } private RenderInvocation createRenderInvocation ( String portletHandle ) { return createRenderInvocation ( portletHandle , null ) ; } private RenderInvocation createRenderInvocation ( String portletHandle , TestPortletInvocationContext invocationContext ) { return createRenderInvocation ( portletHandle , Mode . VIEW , WindowState . MAXIMIZED , null , invocationContext ) ; } private RenderInvocation createRenderInvocation ( String portletHandle , Mode mode , WindowState state , String navigationalState ) { return createRenderInvocation ( portletHandle , mode , state , navigationalState , null ) ; } private RenderInvocation createRenderInvocation ( String portletHandle , Mode mode , WindowState state , String navigationalState , TestPortletInvocationContext invocationContext ) { if ( invocationContext == null ) { invocationContext = new TestPortletInvocationContext ( ) ; } RenderInvocation render = new RenderInvocation ( invocationContext ) ; render . setTarget ( PortletContext . createPortletContext ( portletHandle , false ) ) ; render . setMode ( mode ) ; render . setWindowState ( state ) ; if ( navigationalState != null ) { render . setNavigationalState ( new OpaqueStateString ( navigationalState ) ) ; } render . setInstanceContext ( new AbstractInstanceContext ( portletHandle ) ) ; render . setSecurityContext ( new AbstractSecurityContext ( MockHttpServletRequest . createMockRequest ( null ) ) ) ; render . setUserContext ( new MockUserContext ( ) ) ; render . setWindowContext ( new AbstractWindowContext ( "<STR_LIT>" ) ) ; render . setPortalContext ( new AbstractPortalContext ( ) ) ; RequestedMarkupBehavior . setRequestedMarkupBehavior ( portletHandle ) ; return render ; } private ActionInvocation createActionInvocation ( String portletHandle ) { TestPortletInvocationContext ac = new TestPortletInvocationContext ( ) ; ActionInvocation action = new ActionInvocation ( ac ) ; action . setInstanceContext ( new AbstractInstanceContext ( portletHandle ) ) ; action . setSecurityContext ( new AbstractSecurityContext ( MockHttpServletRequest . createMockRequest ( null ) ) ) ; action . setUserContext ( new MockUserContext ( ) ) ; action . setTarget ( PortletContext . createPortletContext ( portletHandle , false ) ) ; RequestedMarkupBehavior . setRequestedMarkupBehavior ( portletHandle ) ; return action ; } static class MockUserContext extends AbstractUserContext { @ Override public List < Locale > getLocales ( ) { return Collections . singletonList ( Locale . ENGLISH ) ; } } } </s>
|
<s> package org . gatein . wsrp . protocol . v1 ; import org . gatein . pc . api . Mode ; import org . gatein . pc . api . OpaqueStateString ; import org . gatein . pc . api . PortletContext ; import org . gatein . pc . api . PortletInvokerException ; import org . gatein . pc . api . WindowState ; import org . gatein . pc . api . invocation . ActionInvocation ; import org . gatein . pc . api . invocation . RenderInvocation ; import org . gatein . pc . api . invocation . response . ErrorResponse ; import org . gatein . pc . api . invocation . response . FragmentResponse ; import org . gatein . pc . api . invocation . response . PortletInvocationResponse ; import org . gatein . pc . api . invocation . response . UpdateNavigationalStateResponse ; import org . gatein . pc . portlet . impl . spi . AbstractInstanceContext ; import org . gatein . pc . portlet . impl . spi . AbstractPortalContext ; import org . gatein . pc . portlet . impl . spi . AbstractSecurityContext ; import org . gatein . pc . portlet . impl . spi . AbstractUserContext ; import org . gatein . pc . portlet . impl . spi . AbstractWindowContext ; import org . gatein . wsrp . WSRPResourceURL ; import org . gatein . wsrp . consumer . handlers . ProducerSessionInformation ; import org . gatein . wsrp . test . ExtendedAssert ; import org . gatein . wsrp . test . protocol . v1 . BehaviorRegistry ; import org . gatein . wsrp . test . protocol . v1 . behaviors . BasicMarkupBehavior ; import org . gatein . wsrp . test . protocol . v1 . behaviors . EmptyMarkupBehavior ; import org . gatein . wsrp . test . protocol . v1 . behaviors . GroupedPortletsServiceDescriptionBehavior ; import org . gatein . wsrp . test . protocol . v1 . behaviors . InitCookieMarkupBehavior ; import org . gatein . wsrp . test . protocol . v1 . behaviors . InitCookieNotRequiredMarkupBehavior ; import org . gatein . wsrp . test . protocol . v1 . behaviors . NullMarkupBehavior ; import org . gatein . wsrp . test . protocol . v1 . behaviors . PerGroupInitCookieMarkupBehavior ; import org . gatein . wsrp . test . protocol . v1 . behaviors . PerUserInitCookieMarkupBehavior ; import org . gatein . wsrp . test . protocol . v1 . behaviors . ResourceMarkupBehavior ; import org . gatein . wsrp . test . protocol . v1 . behaviors . SessionMarkupBehavior ; import org . gatein . wsrp . test . support . MockHttpServletRequest ; import org . gatein . wsrp . test . support . RequestedMarkupBehavior ; import org . gatein . wsrp . test . support . TestPortletInvocationContext ; import org . oasis . wsrp . v1 . V1CookieProtocol ; import org . oasis . wsrp . v1 . V1Extension ; import org . oasis . wsrp . v1 . V1InvalidHandle ; import org . oasis . wsrp . v1 . V1InvalidRegistration ; import org . oasis . wsrp . v1 . V1ItemDescription ; import org . oasis . wsrp . v1 . V1ModelDescription ; import org . oasis . wsrp . v1 . V1OperationFailed ; import org . oasis . wsrp . v1 . V1PortletDescription ; import org . oasis . wsrp . v1 . V1ResourceList ; import javax . servlet . http . HttpSession ; import javax . xml . ws . Holder ; import java . net . MalformedURLException ; import java . net . URL ; import java . util . Collections ; import java . util . List ; import java . util . Locale ; public class MarkupTestCase extends V1ConsumerBaseTest { public MarkupTestCase ( ) throws Exception { super ( ) ; } public void testInvalidHandle ( ) { try { consumer . invoke ( createRenderInvocation ( "<STR_LIT>" ) ) ; ExtendedAssert . fail ( "<STR_LIT>" ) ; } catch ( PortletInvokerException expected ) { } } public void testEmptyRender ( ) throws Exception { checkRenderResult ( consumer . invoke ( createRenderInvocation ( EmptyMarkupBehavior . PORTLET_HANDLE ) ) , "<STR_LIT>" ) ; } public void testNullAction ( ) throws Exception { ExtendedAssert . assertTrue ( consumer . invoke ( createActionInvocation ( NullMarkupBehavior . PORTLET_HANDLE ) ) instanceof ErrorResponse ) ; } public void testNullRender ( ) throws Exception { ExtendedAssert . assertTrue ( consumer . invoke ( createRenderInvocation ( NullMarkupBehavior . PORTLET_HANDLE ) ) instanceof ErrorResponse ) ; } public void testRender ( ) throws Exception { RenderInvocation render = createRenderInvocation ( BasicMarkupBehavior . PORTLET_HANDLE , Mode . EDIT , WindowState . NORMAL , "<STR_LIT>" ) ; FragmentResponse result = checkRenderResult ( consumer . invoke ( render ) , "<STR_LIT>" ) ; ExtendedAssert . assertEquals ( <NUM_LIT:15> , result . getCacheControl ( ) . getExpirationSecs ( ) ) ; render = createRenderInvocation ( SessionMarkupBehavior . PORTLET_HANDLE ) ; result = checkRenderResult ( consumer . invoke ( render ) , "<STR_LIT>" ) ; ExtendedAssert . assertEquals ( <NUM_LIT:0> , result . getCacheControl ( ) . getExpirationSecs ( ) ) ; } public void testAction ( ) throws Exception { ActionInvocation action = createActionInvocation ( BasicMarkupBehavior . PORTLET_HANDLE ) ; PortletInvocationResponse response = consumer . invoke ( action ) ; ExtendedAssert . assertNotNull ( response ) ; ExtendedAssert . assertTrue ( "<STR_LIT>" + response , response instanceof UpdateNavigationalStateResponse ) ; UpdateNavigationalStateResponse render = ( UpdateNavigationalStateResponse ) response ; ExtendedAssert . assertEquals ( BasicMarkupBehavior . NS , render . getNavigationalState ( ) . getStringValue ( ) ) ; } public void testSessionHandling ( ) throws Exception { RenderInvocation render = createRenderInvocation ( SessionMarkupBehavior . PORTLET_HANDLE ) ; PortletInvocationResponse response = consumer . invoke ( render ) ; checkRenderResult ( response , "<STR_LIT>" ) ; ProducerSessionInformation sessionInfo = consumer . getProducerSessionInformationFrom ( render ) ; String sessionId = sessionInfo . getSessionIdForPortlet ( SessionMarkupBehavior . PORTLET_HANDLE ) ; ExtendedAssert . assertNotNull ( sessionId ) ; ExtendedAssert . assertEquals ( SessionMarkupBehavior . SESSION_ID , sessionId ) ; ExtendedAssert . assertFalse ( sessionInfo . isPerGroupCookies ( ) ) ; ExtendedAssert . assertFalse ( sessionInfo . isInitCookieDone ( ) ) ; response = consumer . invoke ( render ) ; checkRenderResult ( response , "<STR_LIT>" ) ; } public void testInitCookieNotCalledWhenNotNeeded ( ) throws Exception { String handle = InitCookieNotRequiredMarkupBehavior . INIT_COOKIE_NOT_REQUIRED_HANDLE ; InitCookieMarkupBehavior behavior = ( InitCookieMarkupBehavior ) producer . getBehaviorRegistry ( ) . getMarkupBehaviorFor ( handle ) ; consumer . getProducerInfo ( ) . setExpirationCacheSeconds ( <NUM_LIT:0> ) ; ExtendedAssert . assertTrue ( consumer . getProducerInfo ( ) . isRefreshNeeded ( true ) ) ; ProducerSessionInformation sessionInfo = commonInitCookieTest ( handle , behavior , V1CookieProtocol . NONE . value ( ) ) ; ExtendedAssert . assertNotNull ( sessionInfo ) ; ExtendedAssert . assertFalse ( sessionInfo . isPerGroupCookies ( ) ) ; ExtendedAssert . assertFalse ( sessionInfo . isInitCookieDone ( ) ) ; ExtendedAssert . assertEquals ( <NUM_LIT:0> , behavior . getInitCookieCallCount ( ) ) ; } public void testInitCookiePerUser ( ) throws PortletInvokerException , V1InvalidHandle { String handle = PerUserInitCookieMarkupBehavior . PER_USER_INIT_COOKIE_HANDLE ; InitCookieMarkupBehavior behavior = ( InitCookieMarkupBehavior ) producer . getBehaviorRegistry ( ) . getMarkupBehaviorFor ( handle ) ; ProducerSessionInformation sessionInfo = commonInitCookieTest ( handle , behavior , V1CookieProtocol . PER_USER . value ( ) ) ; ExtendedAssert . assertFalse ( sessionInfo . isPerGroupCookies ( ) ) ; ExtendedAssert . assertTrue ( sessionInfo . isInitCookieDone ( ) ) ; ExtendedAssert . assertNotNull ( sessionInfo . getUserCookie ( ) ) ; ExtendedAssert . assertEquals ( <NUM_LIT:1> , behavior . getInitCookieCallCount ( ) ) ; } public void testInitCookiePerGroup ( ) throws PortletInvokerException , V1InvalidHandle , V1InvalidRegistration , V1OperationFailed { BehaviorRegistry registry = producer . getBehaviorRegistry ( ) ; Holder < List < V1PortletDescription > > offeredPortlets = new Holder < List < V1PortletDescription > > ( ) ; registry . getServiceDescriptionBehavior ( ) . getServiceDescription ( null , null , new Holder < Boolean > ( ) , offeredPortlets , new Holder < List < V1ItemDescription > > ( ) , new Holder < List < V1ItemDescription > > ( ) , new Holder < List < V1ItemDescription > > ( ) , new Holder < List < V1ItemDescription > > ( ) , new Holder < V1CookieProtocol > ( ) , new Holder < V1ModelDescription > ( ) , new Holder < List < String > > ( ) , new Holder < V1ResourceList > ( ) , new Holder < List < V1Extension > > ( ) ) ; setServiceDescriptionBehavior ( new GroupedPortletsServiceDescriptionBehavior ( offeredPortlets . value ) ) ; String handle = PerGroupInitCookieMarkupBehavior . PER_GROUP_INIT_COOKIE_HANDLE ; InitCookieMarkupBehavior behavior = ( InitCookieMarkupBehavior ) registry . getMarkupBehaviorFor ( handle ) ; ProducerSessionInformation sessionInfo = commonInitCookieTest ( handle , behavior , V1CookieProtocol . PER_GROUP . value ( ) ) ; ExtendedAssert . assertTrue ( sessionInfo . isPerGroupCookies ( ) ) ; ExtendedAssert . assertTrue ( sessionInfo . isInitCookieDone ( ) ) ; ExtendedAssert . assertNull ( sessionInfo . getUserCookie ( ) ) ; ExtendedAssert . assertEquals ( <NUM_LIT:3> , behavior . getInitCookieCallCount ( ) ) ; } public void testResource ( ) throws PortletInvokerException , MalformedURLException { RenderInvocation render = createRenderInvocation ( ResourceMarkupBehavior . PORTLET_HANDLE ) ; PortletInvocationResponse response = consumer . invoke ( render ) ; String resourceID = WSRPResourceURL . encodeResource ( null , new URL ( "<STR_LIT>" ) , false ) ; String expectedResult = "<STR_LIT>" + resourceID + "<STR_LIT>" ; checkRenderResult ( response , expectedResult ) ; } private ProducerSessionInformation commonInitCookieTest ( String handle , InitCookieMarkupBehavior behavior , String cookieProtocol ) throws PortletInvokerException { RenderInvocation render = createRenderInvocation ( handle ) ; TestPortletInvocationContext invocationContext = ( TestPortletInvocationContext ) render . getContext ( ) ; HttpSession session = invocationContext . getClientRequest ( ) . getSession ( ) ; producer . setRequiresInitCookie ( cookieProtocol ) ; consumer . refreshProducerInfo ( ) ; producer . setCurrentMarkupBehaviorHandle ( handle ) ; render = createRenderInvocation ( handle , invocationContext ) ; ExtendedAssert . assertEquals ( <NUM_LIT:0> , behavior . getInitCookieCallCount ( ) ) ; consumer . invoke ( render ) ; ExtendedAssert . assertEquals ( cookieProtocol , consumer . getProducerInfo ( ) . getRequiresInitCookie ( ) . value ( ) ) ; return consumer . getProducerSessionInformationFrom ( session ) ; } private FragmentResponse checkRenderResult ( PortletInvocationResponse response , String markup ) { ExtendedAssert . assertNotNull ( response ) ; if ( response instanceof ErrorResponse ) { ErrorResponse errorResponse = ( ErrorResponse ) response ; ExtendedAssert . fail ( "<STR_LIT>" + errorResponse . getMessage ( ) ) ; } ExtendedAssert . assertTrue ( "<STR_LIT>" + response , response instanceof FragmentResponse ) ; FragmentResponse fragment = ( FragmentResponse ) response ; ExtendedAssert . assertEquals ( markup , fragment . getChars ( ) . toString ( ) ) ; return fragment ; } private RenderInvocation createRenderInvocation ( String portletHandle ) { return createRenderInvocation ( portletHandle , null ) ; } private RenderInvocation createRenderInvocation ( String portletHandle , TestPortletInvocationContext invocationContext ) { return createRenderInvocation ( portletHandle , Mode . VIEW , WindowState . MAXIMIZED , null , invocationContext ) ; } private RenderInvocation createRenderInvocation ( String portletHandle , Mode mode , WindowState state , String navigationalState ) { return createRenderInvocation ( portletHandle , mode , state , navigationalState , null ) ; } private RenderInvocation createRenderInvocation ( String portletHandle , Mode mode , WindowState state , String navigationalState , TestPortletInvocationContext invocationContext ) { if ( invocationContext == null ) { invocationContext = new TestPortletInvocationContext ( ) ; } RenderInvocation render = new RenderInvocation ( invocationContext ) ; render . setTarget ( PortletContext . createPortletContext ( portletHandle , false ) ) ; render . setMode ( mode ) ; render . setWindowState ( state ) ; if ( navigationalState != null ) { render . setNavigationalState ( new OpaqueStateString ( navigationalState ) ) ; } render . setInstanceContext ( new AbstractInstanceContext ( portletHandle ) ) ; render . setSecurityContext ( new AbstractSecurityContext ( MockHttpServletRequest . createMockRequest ( null ) ) ) ; render . setUserContext ( new MockUserContext ( ) ) ; render . setWindowContext ( new AbstractWindowContext ( "<STR_LIT>" ) ) ; render . setPortalContext ( new AbstractPortalContext ( ) ) ; RequestedMarkupBehavior . setRequestedMarkupBehavior ( portletHandle ) ; return render ; } private ActionInvocation createActionInvocation ( String portletHandle ) { TestPortletInvocationContext ac = new TestPortletInvocationContext ( ) ; ActionInvocation action = new ActionInvocation ( ac ) ; action . setInstanceContext ( new AbstractInstanceContext ( portletHandle ) ) ; action . setSecurityContext ( new AbstractSecurityContext ( MockHttpServletRequest . createMockRequest ( null ) ) ) ; action . setUserContext ( new MockUserContext ( ) ) ; action . setTarget ( PortletContext . createPortletContext ( portletHandle , false ) ) ; RequestedMarkupBehavior . setRequestedMarkupBehavior ( portletHandle ) ; return action ; } static class MockUserContext extends AbstractUserContext { @ Override public List < Locale > getLocales ( ) { return Collections . singletonList ( Locale . ENGLISH ) ; } } } </s>
|
<s> package org . gatein . wsrp . protocol . v1 ; import org . gatein . pc . api . Portlet ; import org . gatein . pc . api . info . MetaInfo ; import org . gatein . wsrp . test . ExtendedAssert ; import org . gatein . wsrp . test . protocol . v1 . TestProducerBehavior ; public class V1ConsumerBaseTest extends WSRP1ConsumerBaseTest { public V1ConsumerBaseTest ( ) throws Exception { } protected void checkPortlet ( Portlet portlet , String suffix , String handle ) { MetaInfo meta = portlet . getInfo ( ) . getMeta ( ) ; ExtendedAssert . assertEquals ( handle , portlet . getContext ( ) . getId ( ) ) ; ExtendedAssert . assertEquals ( TestProducerBehavior . SAMPLE_DESCRIPTION + suffix , TestProducerBehavior . extractString ( meta . getMetaValue ( MetaInfo . DESCRIPTION ) ) ) ; ExtendedAssert . assertEquals ( TestProducerBehavior . SAMPLE_TITLE + suffix , TestProducerBehavior . extractString ( meta . getMetaValue ( MetaInfo . TITLE ) ) ) ; ExtendedAssert . assertEquals ( TestProducerBehavior . SAMPLE_SHORTTITLE + suffix , TestProducerBehavior . extractString ( meta . getMetaValue ( MetaInfo . SHORT_TITLE ) ) ) ; ExtendedAssert . assertEquals ( TestProducerBehavior . SAMPLE_DISPLAYNAME + suffix , TestProducerBehavior . extractString ( meta . getMetaValue ( MetaInfo . DISPLAY_NAME ) ) ) ; ExtendedAssert . assertEquals ( TestProducerBehavior . SAMPLE_KEYWORD + suffix , TestProducerBehavior . extractString ( meta . getMetaValue ( MetaInfo . KEYWORDS ) ) ) ; } public void setUp ( ) throws Exception { super . setUp ( ) ; } } </s>
|
<s> package org . gatein . wsrp . protocol . v1 ; import org . gatein . pc . api . Portlet ; import org . gatein . pc . api . PortletContext ; import org . gatein . wsrp . test . ExtendedAssert ; import org . gatein . wsrp . test . protocol . v1 . behaviors . BasicMarkupBehavior ; import org . gatein . wsrp . test . protocol . v1 . behaviors . SessionMarkupBehavior ; public class ServiceDescriptionTestCase extends InteropServiceDescriptionTestCase { public ServiceDescriptionTestCase ( ) throws Exception { super ( ) ; } @ Override public void setUp ( ) throws Exception { super . setUp ( ) ; setStrict ( true ) ; } public void testUsesRelaxedMode ( ) { ExtendedAssert . assertTrue ( isStrict ( ) ) ; } public void testGetPortlet ( ) throws Exception { Portlet portlet = consumer . getPortlet ( PortletContext . createPortletContext ( BasicMarkupBehavior . PORTLET_HANDLE , false ) ) ; checkPortlet ( portlet , "<STR_LIT>" , BasicMarkupBehavior . PORTLET_HANDLE ) ; portlet = consumer . getPortlet ( PortletContext . createPortletContext ( SessionMarkupBehavior . PORTLET_HANDLE , false ) ) ; checkPortlet ( portlet , "<STR_LIT:2>" , SessionMarkupBehavior . PORTLET_HANDLE ) ; } } </s>
|
<s> package org . gatein . wsrp . protocol . v1 ; import junit . framework . TestCase ; import org . gatein . wsrp . consumer . EndpointConfigurationInfo ; import org . gatein . wsrp . consumer . ProducerInfo ; import org . gatein . wsrp . consumer . WSRPConsumerImpl ; import org . gatein . wsrp . test . ExtendedAssert ; import org . gatein . wsrp . test . protocol . v1 . BehaviorBackedServiceFactory ; import org . gatein . wsrp . test . protocol . v1 . BehaviorRegistry ; import org . gatein . wsrp . test . protocol . v1 . PortletManagementBehavior ; import org . gatein . wsrp . test . protocol . v1 . RegistrationBehavior ; import org . gatein . wsrp . test . protocol . v1 . ServiceDescriptionBehavior ; import org . gatein . wsrp . test . protocol . v1 . TestProducerBehavior ; import org . gatein . wsrp . test . protocol . v1 . TestWSRPProducer ; import org . gatein . wsrp . test . protocol . v1 . TestWSRPProducerImpl ; import org . gatein . wsrp . test . protocol . v1 . behaviors . BasicMarkupBehavior ; import org . gatein . wsrp . test . protocol . v1 . behaviors . BasicPortletManagementBehavior ; import org . gatein . wsrp . test . protocol . v1 . behaviors . BasicServiceDescriptionBehavior ; import org . gatein . wsrp . test . protocol . v1 . behaviors . EmptyMarkupBehavior ; import org . gatein . wsrp . test . protocol . v1 . behaviors . InitCookieNotRequiredMarkupBehavior ; import org . gatein . wsrp . test . protocol . v1 . behaviors . NullMarkupBehavior ; import org . gatein . wsrp . test . protocol . v1 . behaviors . PerGroupInitCookieMarkupBehavior ; import org . gatein . wsrp . test . protocol . v1 . behaviors . PerUserInitCookieMarkupBehavior ; import org . gatein . wsrp . test . protocol . v1 . behaviors . ResourceMarkupBehavior ; import org . gatein . wsrp . test . protocol . v1 . behaviors . SessionMarkupBehavior ; import org . gatein . wsrp . test . support . MockConsumerRegistry ; import org . gatein . wsrp . test . support . RequestedMarkupBehavior ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; import java . util . Set ; public abstract class WSRP1ConsumerBaseTest extends TestCase { private static Logger log = LoggerFactory . getLogger ( WSRP1ConsumerBaseTest . class ) ; private static final String TEST_PRODUCER_ID = "<STR_LIT>" ; protected TestWSRPProducer producer = new TestWSRPProducerImpl ( ) ; protected WSRPConsumerImpl consumer = new WSRPConsumerImpl ( new ProducerInfo ( new MockConsumerRegistry ( ) ) ) ; private boolean strict = true ; public void setUp ( ) throws Exception { producer . reset ( ) ; ProducerInfo producerInfo = consumer . getProducerInfo ( ) ; producerInfo . setId ( TEST_PRODUCER_ID ) ; BehaviorRegistry registry = producer . getBehaviorRegistry ( ) ; setServiceDescriptionBehavior ( null ) ; setPortletManagementBehavior ( null ) ; setRegistrationBehavior ( null ) ; registerAdditionalMarkupBehaviors ( registry ) ; producerInfo . setEndpointConfigurationInfo ( new EndpointConfigurationInfo ( new BehaviorBackedServiceFactory ( registry ) ) ) ; producerInfo . setExpirationCacheSeconds ( null ) ; consumer . refreshProducerInfo ( ) ; producerInfo . setExpirationCacheSeconds ( <NUM_LIT> ) ; } protected void setRegistrationBehavior ( RegistrationBehavior behavior ) { producer . getBehaviorRegistry ( ) . setRegistrationBehavior ( behavior ) ; } protected void setServiceDescriptionBehavior ( ServiceDescriptionBehavior behavior ) { if ( behavior == null ) { log . debug ( "<STR_LIT>" ) ; behavior = new BasicServiceDescriptionBehavior ( ) ; } producer . getBehaviorRegistry ( ) . setServiceDescriptionBehavior ( behavior ) ; } protected void setPortletManagementBehavior ( PortletManagementBehavior behavior ) { BehaviorRegistry registry = producer . getBehaviorRegistry ( ) ; if ( behavior == null ) { log . debug ( "<STR_LIT>" ) ; behavior = new BasicPortletManagementBehavior ( registry ) ; } registry . setPortletManagementBehavior ( behavior ) ; } public void testProducerId ( ) { ExtendedAssert . assertEquals ( TEST_PRODUCER_ID , consumer . getProducerId ( ) ) ; } public void setStrict ( boolean strict ) { this . strict = strict ; producer . usingStrictModeChangedTo ( strict ) ; } public boolean isStrict ( ) { return strict ; } private < T extends TestProducerBehavior > T createBehavior ( String behaviorClassName , Class < T > expectedBehaviorClass ) { if ( behaviorClassName != null ) { try { Class behaviorClass = getClass ( ) . getClassLoader ( ) . loadClass ( behaviorClassName ) ; if ( expectedBehaviorClass . isAssignableFrom ( behaviorClass ) ) { return expectedBehaviorClass . cast ( behaviorClass . newInstance ( ) ) ; } else { throw new IllegalArgumentException ( behaviorClassName + "<STR_LIT>" + expectedBehaviorClass . getSimpleName ( ) ) ; } } catch ( ClassNotFoundException e ) { throw new IllegalArgumentException ( "<STR_LIT>" + behaviorClassName , e ) ; } catch ( IllegalAccessException e ) { throw new IllegalArgumentException ( "<STR_LIT>" + behaviorClassName , e ) ; } catch ( InstantiationException e ) { throw new IllegalArgumentException ( "<STR_LIT>" + behaviorClassName , e ) ; } } return null ; } protected void registerAdditionalMarkupBehaviors ( BehaviorRegistry registry ) { registry . registerMarkupBehavior ( new BasicMarkupBehavior ( registry ) ) ; registry . registerMarkupBehavior ( new EmptyMarkupBehavior ( registry ) ) ; registry . registerMarkupBehavior ( new InitCookieNotRequiredMarkupBehavior ( registry ) ) ; registry . registerMarkupBehavior ( new PerGroupInitCookieMarkupBehavior ( registry ) ) ; registry . registerMarkupBehavior ( new PerUserInitCookieMarkupBehavior ( registry ) ) ; registry . registerMarkupBehavior ( new NullMarkupBehavior ( registry ) ) ; registry . registerMarkupBehavior ( new SessionMarkupBehavior ( registry ) ) ; registry . registerMarkupBehavior ( new ResourceMarkupBehavior ( registry ) ) ; } protected Set < String > getPortletHandles ( ) { return producer . getBehaviorRegistry ( ) . getServiceDescriptionBehavior ( ) . getPortletHandles ( ) ; } protected int getPortletNumber ( ) { return producer . getBehaviorRegistry ( ) . getServiceDescriptionBehavior ( ) . getPortletNumber ( ) ; } @ Override protected void tearDown ( ) throws Exception { RequestedMarkupBehavior . setRequestedMarkupBehavior ( null ) ; } } </s>
|
<s> package org . gatein . wsrp . protocol . v1 ; import org . gatein . pc . api . Portlet ; import org . gatein . pc . api . PortletInvokerException ; import org . gatein . wsrp . test . ExtendedAssert ; import org . gatein . wsrp . test . protocol . v1 . BehaviorRegistry ; import java . util . HashSet ; import java . util . Set ; public class InteropServiceDescriptionTestCase extends V1ConsumerBaseTest { public InteropServiceDescriptionTestCase ( ) throws Exception { super ( ) ; } @ Override public void setUp ( ) throws Exception { setStrict ( false ) ; super . setUp ( ) ; } public void testUsesRelaxedMode ( ) { ExtendedAssert . assertFalse ( isStrict ( ) ) ; } public void testGetPortlets ( ) throws PortletInvokerException { Set returnedPortlets = consumer . getPortlets ( ) ; int portletNumber = returnedPortlets . size ( ) ; ExtendedAssert . assertEquals ( getPortletNumber ( ) , portletNumber ) ; Set < String > handles = getPortletHandles ( ) ; Set < String > consumerHandles = new HashSet < String > ( portletNumber ) ; for ( Object o : returnedPortlets ) { Portlet portlet = ( Portlet ) o ; consumerHandles . add ( portlet . getContext ( ) . getId ( ) ) ; } ExtendedAssert . assertTrue ( handles . containsAll ( consumerHandles ) ) ; } @ Override protected void registerAdditionalMarkupBehaviors ( BehaviorRegistry registry ) { } } </s>
|
<s> package org . gatein . wsrp . protocol . v1 ; import org . gatein . pc . api . Portlet ; import org . gatein . pc . api . PortletContext ; import org . gatein . pc . api . PortletInvokerException ; import org . gatein . pc . api . PortletStateType ; import org . gatein . pc . api . info . MetaInfo ; import org . gatein . pc . api . state . DestroyCloneFailure ; import org . gatein . pc . api . state . PropertyChange ; import org . gatein . pc . api . state . PropertyMap ; import org . gatein . wsrp . test . ExtendedAssert ; import org . gatein . wsrp . test . protocol . v1 . BehaviorRegistry ; import org . gatein . wsrp . test . protocol . v1 . behaviors . BasicMarkupBehavior ; import org . gatein . wsrp . test . protocol . v1 . behaviors . BasicPortletManagementBehavior ; import org . gatein . wsrp . test . protocol . v1 . behaviors . DestroyClonesPortletManagementBehavior ; import java . util . ArrayList ; import java . util . List ; public class PortletManagementTestCase extends V1ConsumerBaseTest { public PortletManagementTestCase ( ) throws Exception { } public void testClone ( ) throws Exception { PortletContext original = PortletContext . createPortletContext ( BasicMarkupBehavior . PORTLET_HANDLE , false ) ; PortletContext clone = consumer . createClone ( PortletStateType . OPAQUE , original ) ; ExtendedAssert . assertNotNull ( clone ) ; ExtendedAssert . assertFalse ( original . equals ( clone ) ) ; ExtendedAssert . assertEquals ( BasicPortletManagementBehavior . CLONED_HANDLE , clone . getId ( ) ) ; Portlet originalPortlet = consumer . getPortlet ( original ) ; Portlet clonePortlet = consumer . getPortlet ( clone ) ; ExtendedAssert . assertNotNull ( clonePortlet ) ; ExtendedAssert . assertFalse ( originalPortlet . getContext ( ) . equals ( clonePortlet . getContext ( ) ) ) ; MetaInfo originalInfo = originalPortlet . getInfo ( ) . getMeta ( ) ; MetaInfo cloneInfo = clonePortlet . getInfo ( ) . getMeta ( ) ; ExtendedAssert . assertEquals ( originalInfo . getMetaValue ( MetaInfo . TITLE ) , cloneInfo . getMetaValue ( MetaInfo . TITLE ) ) ; ExtendedAssert . assertEquals ( originalInfo . getMetaValue ( MetaInfo . DESCRIPTION ) , cloneInfo . getMetaValue ( MetaInfo . DESCRIPTION ) ) ; } public void testGetSetProperties ( ) throws Exception { PortletContext original = PortletContext . createPortletContext ( BasicMarkupBehavior . PORTLET_HANDLE , false ) ; PropertyMap props = consumer . getProperties ( original ) ; checkProperties ( props , BasicPortletManagementBehavior . PROPERTY_VALUE ) ; PortletContext clone = consumer . createClone ( PortletStateType . OPAQUE , original ) ; props = consumer . getProperties ( clone ) ; checkProperties ( props , BasicPortletManagementBehavior . PROPERTY_VALUE ) ; consumer . setProperties ( clone , new PropertyChange [ ] { PropertyChange . newUpdate ( BasicPortletManagementBehavior . PROPERTY_NAME , BasicPortletManagementBehavior . PROPERTY_NEW_VALUE ) } ) ; checkProperties ( consumer . getProperties ( clone ) , BasicPortletManagementBehavior . PROPERTY_NEW_VALUE ) ; consumer . setProperties ( clone , new PropertyChange [ ] { PropertyChange . newReset ( BasicPortletManagementBehavior . PROPERTY_NAME ) } ) ; checkProperties ( consumer . getProperties ( clone ) , BasicPortletManagementBehavior . PROPERTY_VALUE ) ; } public void testSetResetSameProperty ( ) throws PortletInvokerException { PortletContext original = PortletContext . createPortletContext ( BasicMarkupBehavior . PORTLET_HANDLE , false ) ; PortletContext clone = consumer . createClone ( PortletStateType . OPAQUE , original ) ; try { consumer . setProperties ( clone , new PropertyChange [ ] { PropertyChange . newUpdate ( BasicPortletManagementBehavior . PROPERTY_NAME , BasicPortletManagementBehavior . PROPERTY_NEW_VALUE ) , PropertyChange . newReset ( BasicPortletManagementBehavior . PROPERTY_NAME ) } ) ; fail ( "<STR_LIT>" ) ; } catch ( Exception e ) { assertTrue ( e . getCause ( ) . getLocalizedMessage ( ) . contains ( BasicPortletManagementBehavior . CANNOT_BOTH_SET_AND_RESET_A_PROPERTY_AT_THE_SAME_TIME ) ) ; } } private void checkProperties ( PropertyMap props , String expectedValue ) { ExtendedAssert . assertNotNull ( props ) ; ExtendedAssert . assertEquals ( <NUM_LIT:1> , props . size ( ) ) ; ExtendedAssert . assertEquals ( expectedValue , props . getProperty ( BasicPortletManagementBehavior . PROPERTY_NAME ) . get ( <NUM_LIT:0> ) ) ; } public void testDestroyClones ( ) throws Exception { BehaviorRegistry behaviorRegistry = producer . getBehaviorRegistry ( ) ; behaviorRegistry . setPortletManagementBehavior ( new DestroyClonesPortletManagementBehavior ( behaviorRegistry ) ) ; PortletContext original = PortletContext . createPortletContext ( BasicMarkupBehavior . PORTLET_HANDLE , false ) ; PortletContext clone = consumer . createClone ( PortletStateType . OPAQUE , original ) ; ExtendedAssert . assertNotNull ( clone ) ; Portlet portlet = consumer . getPortlet ( clone ) ; ExtendedAssert . assertNotNull ( portlet ) ; ExtendedAssert . assertEquals ( BasicPortletManagementBehavior . CLONED_HANDLE , portlet . getContext ( ) . getId ( ) ) ; List clones = new ArrayList ( <NUM_LIT:1> ) ; clones . add ( clone ) ; List result = consumer . destroyClones ( clones ) ; ExtendedAssert . assertTrue ( result . isEmpty ( ) ) ; try { consumer . getPortlet ( clone ) ; ExtendedAssert . fail ( "<STR_LIT>" ) ; } catch ( PortletInvokerException expected ) { } clone = consumer . createClone ( PortletStateType . OPAQUE , original ) ; PortletContext invalidContext = PortletContext . createPortletContext ( "<STR_LIT>" , false ) ; clones . add ( invalidContext ) ; result = consumer . destroyClones ( clones ) ; ExtendedAssert . assertEquals ( <NUM_LIT:1> , result . size ( ) ) ; DestroyCloneFailure failure = ( DestroyCloneFailure ) result . get ( <NUM_LIT:0> ) ; ExtendedAssert . assertEquals ( "<STR_LIT>" , failure . getPortletId ( ) ) ; try { consumer . getPortlet ( clone ) ; ExtendedAssert . fail ( "<STR_LIT>" ) ; } catch ( PortletInvokerException expected ) { } } public void testInvalidSetProperties ( ) throws Exception { PortletContext original = PortletContext . createPortletContext ( BasicMarkupBehavior . PORTLET_HANDLE , false ) ; try { consumer . setProperties ( original , null ) ; ExtendedAssert . fail ( "<STR_LIT>" ) ; } catch ( IllegalArgumentException expected ) { } } } </s>
|
<s> package org . oasis . wsrp . v2 ; 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 PortletLifetime { @ XmlElement ( required = true ) protected PortletContext portletContext ; @ XmlElement ( required = true ) protected Lifetime scheduledDestruction ; protected List < Extension > extensions ; public PortletContext getPortletContext ( ) { return portletContext ; } public void setPortletContext ( PortletContext value ) { this . portletContext = value ; } public Lifetime getScheduledDestruction ( ) { return scheduledDestruction ; } public void setScheduledDestruction ( Lifetime value ) { this . scheduledDestruction = value ; } public List < Extension > getExtensions ( ) { if ( extensions == null ) { extensions = new ArrayList < Extension > ( ) ; } return this . extensions ; } } </s>
|
<s> package org . oasis . wsrp . v2 ; 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 ExportNoLongerValidFault extends Fault { } </s>
|
<s> package org . oasis . wsrp . v2 ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlAnyElement ; import javax . xml . bind . annotation . XmlRootElement ; import javax . xml . bind . annotation . XmlType ; import org . w3c . dom . Element ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" , propOrder = { "<STR_LIT>" } ) @ XmlRootElement ( name = "<STR_LIT>" ) public class NewNavigationalContextScope { @ 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 . v2 ; 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 StateChange { @ 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 ; StateChange ( String v ) { value = v ; } public String value ( ) { return value ; } public static StateChange fromValue ( String v ) { for ( StateChange c : StateChange . values ( ) ) { if ( c . value . equals ( v ) ) { return c ; } } throw new IllegalArgumentException ( v ) ; } } </s>
|
<s> package org . oasis . wsrp . v2 ; 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 . XmlType ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" , propOrder = { "<STR_LIT>" } ) public class CCPPProfileDiff { protected List < Extension > extensions ; @ XmlAttribute ( required = true ) protected String diffName ; @ XmlAttribute ( required = true ) protected String description ; public List < Extension > getExtensions ( ) { if ( extensions == null ) { extensions = new ArrayList < Extension > ( ) ; } return this . extensions ; } public String getDiffName ( ) { return diffName ; } public void setDiffName ( String value ) { this . diffName = value ; } public String getDescription ( ) { return description ; } public void setDescription ( String value ) { this . description = value ; } } </s>
|
<s> package org . oasis . wsrp . v2 ; 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 ResourceValue { @ XmlElement ( required = true ) protected String value ; protected List < Extension > 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 < Extension > getExtensions ( ) { if ( extensions == null ) { extensions = new ArrayList < Extension > ( ) ; } return this . extensions ; } public String getLang ( ) { return lang ; } public void setLang ( String value ) { this . lang = value ; } } </s>
|
<s> package org . oasis . wsrp . v2 ; 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 ExportByValueNotSupportedFault extends Fault { } </s>
|
<s> package org . oasis . wsrp . v2 ; 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 MissingParametersFault extends Fault { } </s>
|
<s> package org . oasis . wsrp . v2 ; 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 UnsupportedMimeTypeFault extends Fault { } </s>
|
<s> package org . oasis . wsrp . v2 ; 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 . XmlSchemaType ; import javax . xml . bind . annotation . XmlType ; import javax . xml . namespace . QName ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" , propOrder = { "<STR_LIT:description>" , "<STR_LIT:label>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" } ) public class PropertyDescription { protected LocalizedString description ; protected LocalizedString label ; protected LocalizedString hint ; protected List < String > usage ; protected List < QName > aliases ; protected List < Extension > extensions ; @ XmlAttribute ( required = true ) protected QName name ; @ XmlAttribute ( required = true ) protected QName type ; @ XmlAttribute @ XmlSchemaType ( name = "<STR_LIT>" ) protected String schemaLocation ; public LocalizedString getDescription ( ) { return description ; } public void setDescription ( LocalizedString value ) { this . description = value ; } public LocalizedString getLabel ( ) { return label ; } public void setLabel ( LocalizedString value ) { this . label = value ; } public LocalizedString getHint ( ) { return hint ; } public void setHint ( LocalizedString value ) { this . hint = value ; } public List < String > getUsage ( ) { if ( usage == null ) { usage = new ArrayList < String > ( ) ; } return this . usage ; } public List < QName > getAliases ( ) { if ( aliases == null ) { aliases = new ArrayList < QName > ( ) ; } return this . aliases ; } public List < Extension > getExtensions ( ) { if ( extensions == null ) { extensions = new ArrayList < Extension > ( ) ; } return this . extensions ; } public QName getName ( ) { return name ; } public void setName ( QName value ) { this . name = value ; } public QName getType ( ) { return type ; } public void setType ( QName value ) { this . type = value ; } public String getSchemaLocation ( ) { return schemaLocation ; } public void setSchemaLocation ( String value ) { this . schemaLocation = value ; } } </s>
|
<s> package org . oasis . wsrp . v2 ; 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 SessionContext { protected String sessionID ; protected Integer expires ; protected List < Extension > extensions ; public String getSessionID ( ) { return sessionID ; } public void setSessionID ( String value ) { this . sessionID = value ; } public Integer getExpires ( ) { return expires ; } public void setExpires ( Integer value ) { this . expires = value ; } public List < Extension > getExtensions ( ) { if ( extensions == null ) { extensions = new ArrayList < Extension > ( ) ; } return this . extensions ; } } </s>
|
<s> package org . oasis . wsrp . v2 ; 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 InitCookie { @ XmlElement ( required = true , nillable = true ) protected RegistrationContext registrationContext ; @ XmlElement ( required = true , nillable = true ) protected UserContext userContext ; public RegistrationContext getRegistrationContext ( ) { return registrationContext ; } public void setRegistrationContext ( RegistrationContext value ) { this . registrationContext = value ; } public UserContext getUserContext ( ) { return userContext ; } public void setUserContext ( UserContext value ) { this . userContext = value ; } } </s>
|
<s> package org . oasis . wsrp . v2 ; 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 PortletPropertyDescriptionResponse { protected ModelDescription modelDescription ; protected ResourceList resourceList ; protected List < Extension > extensions ; public ModelDescription getModelDescription ( ) { return modelDescription ; } public void setModelDescription ( ModelDescription value ) { this . modelDescription = value ; } public ResourceList getResourceList ( ) { return resourceList ; } public void setResourceList ( ResourceList value ) { this . resourceList = value ; } public List < Extension > getExtensions ( ) { if ( extensions == null ) { extensions = new ArrayList < Extension > ( ) ; } return this . extensions ; } } </s>
|
<s> package org . oasis . wsrp . v2 ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlAnyElement ; import javax . xml . bind . annotation . XmlRootElement ; import javax . xml . bind . annotation . XmlType ; import org . w3c . dom . Element ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" , propOrder = { "<STR_LIT>" } ) @ XmlRootElement ( name = "<STR_LIT>" ) public class EventHandlingFailed { @ 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 . v2 ; 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 MarkupParams extends MimeRequest { } </s>
|
<s> package org . oasis . wsrp . v2 ; 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 Templates { @ 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 < Extension > 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 < Extension > getExtensions ( ) { if ( extensions == null ) { extensions = new ArrayList < Extension > ( ) ; } return this . extensions ; } } </s>
|
<s> package org . oasis . wsrp . v2 ; 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>" , "<STR_LIT>" } ) public class ItemDescription { @ XmlElement ( required = true , nillable = true ) protected LocalizedString description ; protected LocalizedString displayName ; protected List < Extension > extensions ; @ XmlAttribute ( required = true ) protected String itemName ; public LocalizedString getDescription ( ) { return description ; } public void setDescription ( LocalizedString value ) { this . description = value ; } public LocalizedString getDisplayName ( ) { return displayName ; } public void setDisplayName ( LocalizedString value ) { this . displayName = value ; } public List < Extension > getExtensions ( ) { if ( extensions == null ) { extensions = new ArrayList < Extension > ( ) ; } return this . extensions ; } public String getItemName ( ) { return itemName ; } public void setItemName ( String value ) { this . itemName = value ; } } </s>
|
<s> package org . oasis . wsrp . v2 ; 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 GetPortletsLifetime { @ XmlElement ( required = true , nillable = true ) protected RegistrationContext registrationContext ; @ XmlElement ( required = true ) protected List < PortletContext > portletContext ; @ XmlElement ( required = true , nillable = true ) protected UserContext userContext ; public RegistrationContext getRegistrationContext ( ) { return registrationContext ; } public void setRegistrationContext ( RegistrationContext value ) { this . registrationContext = value ; } public List < PortletContext > getPortletContext ( ) { if ( portletContext == null ) { portletContext = new ArrayList < PortletContext > ( ) ; } return this . portletContext ; } public UserContext getUserContext ( ) { return userContext ; } public void setUserContext ( UserContext value ) { this . userContext = value ; } } </s>
|
<s> package org . oasis . wsrp . v2 ; 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 SetRegistrationLifetime { @ XmlElement ( required = true , nillable = true ) protected RegistrationContext registrationContext ; @ XmlElement ( required = true , nillable = true ) protected UserContext userContext ; @ XmlElement ( required = true , nillable = true ) protected Lifetime lifetime ; public RegistrationContext getRegistrationContext ( ) { return registrationContext ; } public void setRegistrationContext ( RegistrationContext value ) { this . registrationContext = value ; } public UserContext getUserContext ( ) { return userContext ; } public void setUserContext ( UserContext value ) { this . userContext = value ; } public Lifetime getLifetime ( ) { return lifetime ; } public void setLifetime ( Lifetime value ) { this . lifetime = value ; } } </s>
|
<s> package org . oasis . wsrp . v2 ; 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 MarkupType { @ 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 < Extension > 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 < Extension > getExtensions ( ) { if ( extensions == null ) { extensions = new ArrayList < Extension > ( ) ; } return this . extensions ; } } </s>
|
<s> package org . oasis . wsrp . v2 ; import javax . xml . ws . WebFault ; @ WebFault ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) public class InconsistentParameters extends Exception { private InconsistentParametersFault faultInfo ; public InconsistentParameters ( String message , InconsistentParametersFault faultInfo ) { super ( message ) ; this . faultInfo = faultInfo ; } public InconsistentParameters ( String message , InconsistentParametersFault faultInfo , Throwable cause ) { super ( message , cause ) ; this . faultInfo = faultInfo ; } public InconsistentParametersFault getFaultInfo ( ) { return faultInfo ; } } </s>
|
<s> package org . oasis . wsrp . v2 ; 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 TelephoneNum { protected String intcode ; protected String loccode ; protected String number ; protected String ext ; protected String comment ; protected List < Extension > 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 < Extension > getExtensions ( ) { if ( extensions == null ) { extensions = new ArrayList < Extension > ( ) ; } return this . extensions ; } } </s>
|
<s> package org . oasis . wsrp . v2 ; 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 . XmlSchemaType ; import javax . xml . bind . annotation . XmlType ; import javax . xml . datatype . XMLGregorianCalendar ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" , propOrder = { "<STR_LIT:name>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" } ) public class UserProfile { protected PersonName name ; @ XmlSchemaType ( name = "<STR_LIT>" ) protected XMLGregorianCalendar bdate ; protected String gender ; protected EmployerInfo employerInfo ; protected Contact homeInfo ; protected Contact businessInfo ; protected List < Extension > extensions ; public PersonName getName ( ) { return name ; } public void setName ( PersonName value ) { this . name = value ; } public XMLGregorianCalendar getBdate ( ) { return bdate ; } public void setBdate ( XMLGregorianCalendar value ) { this . bdate = value ; } public String getGender ( ) { return gender ; } public void setGender ( String value ) { this . gender = value ; } public EmployerInfo getEmployerInfo ( ) { return employerInfo ; } public void setEmployerInfo ( EmployerInfo value ) { this . employerInfo = value ; } public Contact getHomeInfo ( ) { return homeInfo ; } public void setHomeInfo ( Contact value ) { this . homeInfo = value ; } public Contact getBusinessInfo ( ) { return businessInfo ; } public void setBusinessInfo ( Contact value ) { this . businessInfo = value ; } public List < Extension > getExtensions ( ) { if ( extensions == null ) { extensions = new ArrayList < Extension > ( ) ; } return this . extensions ; } } </s>
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.