Package org.jasig.portal.mock.portlet.om

Examples of org.jasig.portal.mock.portlet.om.MockPortletWindow


     */
    public void testGetUnsetCache() throws Exception {
        final MockHttpServletRequest httpServletRequest = new MockHttpServletRequest();
        httpServletRequest.setAttribute(PortletHttpServletRequestWrapper.ATTRIBUTE__HTTP_SERVLET_REQUEST, httpServletRequest);
       
        final MockPortletWindow portletWindow = new MockPortletWindow();
        final MockPortletEntityId portletEntityId = new MockPortletEntityId("1");
        portletWindow.setPortletEntityId(portletEntityId);
       
        final MockPortletDefinitionId portletDefinitionId = new MockPortletDefinitionId("2");
       
        final IPortletDefinition portletDefinition = EasyMock.createMock(IPortletDefinition.class);
        EasyMock.expect(portletDefinition.getPortletDefinitionId()).andReturn(portletDefinitionId);
View Full Code Here


     */
    public void testGetCacheFromDD() throws Exception {
        final MockHttpServletRequest httpServletRequest = new MockHttpServletRequest();
        httpServletRequest.setAttribute(PortletHttpServletRequestWrapper.ATTRIBUTE__HTTP_SERVLET_REQUEST, httpServletRequest);
       
        final MockPortletWindow portletWindow = new MockPortletWindow();
        final MockPortletEntityId portletEntityId = new MockPortletEntityId("1");
        portletWindow.setPortletEntityId(portletEntityId);
       
        final MockPortletDefinitionId portletDefinitionId = new MockPortletDefinitionId("2");
       
        final IPortletDefinition portletDefinition = EasyMock.createMock(IPortletDefinition.class);
        EasyMock.expect(portletDefinition.getPortletDefinitionId()).andReturn(portletDefinitionId);
View Full Code Here

     */
    public void testGetCacheFromWindow() throws Exception {
        final MockHttpServletRequest httpServletRequest = new MockHttpServletRequest();
        httpServletRequest.setAttribute(PortletHttpServletRequestWrapper.ATTRIBUTE__HTTP_SERVLET_REQUEST, httpServletRequest);
       
        final MockPortletWindow portletWindow = new MockPortletWindow();
        portletWindow.setExpirationCache(-1);
       
        final IPortletEntityRegistry portletEntityRegistry = EasyMock.createMock(IPortletEntityRegistry.class);
       
        final IPortletDefinitionRegistry portletDefinitionRegistry = EasyMock.createMock(IPortletDefinitionRegistry.class);
       
View Full Code Here

     */
    public void testSetCacheWithDDCache() throws Exception  {
        final MockHttpServletRequest httpServletRequest = new MockHttpServletRequest();
        httpServletRequest.setAttribute(PortletHttpServletRequestWrapper.ATTRIBUTE__HTTP_SERVLET_REQUEST, httpServletRequest);
       
        final MockPortletWindow portletWindow = new MockPortletWindow();
        final MockPortletEntityId portletEntityId = new MockPortletEntityId("1");
        portletWindow.setPortletEntityId(portletEntityId);
       
        final MockPortletDefinitionId portletDefinitionId = new MockPortletDefinitionId("2");
       
        final IPortletDefinition portletDefinition = EasyMock.createMock(IPortletDefinition.class);
        EasyMock.expect(portletDefinition.getPortletDefinitionId()).andReturn(portletDefinitionId);
       
        final IPortletEntityRegistry portletEntityRegistry = EasyMock.createMock(IPortletEntityRegistry.class);
        EasyMock.expect(portletEntityRegistry.getParentPortletDefinition(portletEntityId)).andReturn(portletDefinition);
       
        final PortletDD portletDD = new PortletDD();
        portletDD.setExpirationCache(1);
       
        final IPortletDefinitionRegistry portletDefinitionRegistry = EasyMock.createMock(IPortletDefinitionRegistry.class);
        EasyMock.expect(portletDefinitionRegistry.getParentPortletDescriptor(portletDefinitionId)).andReturn(portletDD);
       
        final IPortalRequestUtils portalRequestUtils = EasyMock.createMock(IPortalRequestUtils.class);
        EasyMock.expect(portalRequestUtils.getOriginalPortletAdaptorRequest(httpServletRequest)).andReturn(httpServletRequest);
       
       
        EasyMock.replay(portletDefinition, portletEntityRegistry, portletDefinitionRegistry, portalRequestUtils);
           
        this.cacheRequestPropertiesManager.setPortletEntityRegistry(portletEntityRegistry);
        this.cacheRequestPropertiesManager.setPortletDefinitionRegistry(portletDefinitionRegistry);
        this.cacheRequestPropertiesManager.setPortalRequestUtils(portalRequestUtils);
       
        this.cacheRequestPropertiesManager.setResponseProperty(httpServletRequest, portletWindow, RenderResponse.EXPIRATION_CACHE, "30");
       
        EasyMock.verify(portletDefinition, portletEntityRegistry, portletDefinitionRegistry);
       
        final Integer expirationCache = portletWindow.getExpirationCache();
        assertEquals(Integer.valueOf(30), expirationCache);
    }
View Full Code Here

     */
    public void testSetCacheWithNoDDCache() throws Exception  {
        final MockHttpServletRequest httpServletRequest = new MockHttpServletRequest();
        httpServletRequest.setAttribute(PortletHttpServletRequestWrapper.ATTRIBUTE__HTTP_SERVLET_REQUEST, httpServletRequest);
       
        final MockPortletWindow portletWindow = new MockPortletWindow();
        final MockPortletEntityId portletEntityId = new MockPortletEntityId("1");
        portletWindow.setPortletEntityId(portletEntityId);
       
        final MockPortletDefinitionId portletDefinitionId = new MockPortletDefinitionId("2");
       
        final IPortletDefinition portletDefinition = EasyMock.createMock(IPortletDefinition.class);
        EasyMock.expect(portletDefinition.getPortletDefinitionId()).andReturn(portletDefinitionId);
       
        final IPortletEntityRegistry portletEntityRegistry = EasyMock.createMock(IPortletEntityRegistry.class);
        EasyMock.expect(portletEntityRegistry.getParentPortletDefinition(portletEntityId)).andReturn(portletDefinition);
       
        final PortletDD portletDD = new PortletDD();
       
        final IPortletDefinitionRegistry portletDefinitionRegistry = EasyMock.createMock(IPortletDefinitionRegistry.class);
        EasyMock.expect(portletDefinitionRegistry.getParentPortletDescriptor(portletDefinitionId)).andReturn(portletDD);
       
        final IPortalRequestUtils portalRequestUtils = EasyMock.createMock(IPortalRequestUtils.class);
        EasyMock.expect(portalRequestUtils.getOriginalPortletAdaptorRequest(httpServletRequest)).andReturn(httpServletRequest);
       
       
        EasyMock.replay(portletDefinition, portletEntityRegistry, portletDefinitionRegistry, portalRequestUtils);
           
        this.cacheRequestPropertiesManager.setPortletEntityRegistry(portletEntityRegistry);
        this.cacheRequestPropertiesManager.setPortletDefinitionRegistry(portletDefinitionRegistry);
        this.cacheRequestPropertiesManager.setPortalRequestUtils(portalRequestUtils);
       
        this.cacheRequestPropertiesManager.setResponseProperty(httpServletRequest, portletWindow, RenderResponse.EXPIRATION_CACHE, "30");
       
        EasyMock.verify(portletDefinition, portletEntityRegistry, portletDefinitionRegistry);
       
        final Integer expirationCache = portletWindow.getExpirationCache();
        assertNull(expirationCache);
    }
View Full Code Here

        replay(portalRequestUtils);
        portletUrlSyntaxProvider.setPortalRequestUtils(portalRequestUtils);
       
        final IPortletEntityId portletEntityId = new MockPortletEntityId("entityId1");
        final IPortletWindowId portletWindowId = new MockPortletWindowId("windowId1");
        final IPortletWindow portletWindow = new MockPortletWindow(portletWindowId, portletEntityId, "portletApp", "portletName");
       
        final ChannelRuntimeData channelRuntimeData = new ChannelRuntimeData();
        channelRuntimeData.setBaseActionURL("base/action.url");
       
        request.setAttribute(IPortletAdaptor.ATTRIBUTE__RUNTIME_DATA, channelRuntimeData);
View Full Code Here

       
        portletUrlSyntaxProvider.setPortalRequestUtils(portalRequestUtils);
       
        final IPortletEntityId portletEntityId1 = new MockPortletEntityId("eId1");
        final IPortletWindowId portletWindowId1 = new MockPortletWindowId("wId1");
        final IPortletWindow portletWindow1 = new MockPortletWindow(portletWindowId1, portletEntityId1, "portletAppA", "portletNameA");
      
        final IPortletEntityId portletEntityId2 = new MockPortletEntityId("eId2");
        final IPortletWindowId portletWindowId2 = new MockPortletWindowId("wId2");
        final MockPortletWindow portletWindow2 = new MockPortletWindow(portletWindowId2, portletEntityId2, "portletAppB", "portletNameB");

       
        final ChannelRuntimeData channelRuntimeData = new ChannelRuntimeData();
        channelRuntimeData.setBaseActionURL("base/action.url");
       
        request.setAttribute(IPortletAdaptor.ATTRIBUTE__RUNTIME_DATA, channelRuntimeData);
       
        final MockPortletEntity portletEntity1 = new MockPortletEntity();
        portletEntity1.setPortletEntityId(portletEntityId1);
        portletEntity1.setChannelSubscribeId(portletEntityId1.getStringId());
       
        final MockPortletEntity portletEntity2 = new MockPortletEntity();
        portletEntity2.setPortletEntityId(portletEntityId2);
        portletEntity2.setChannelSubscribeId(portletEntityId2.getStringId());
       
        final IPortletWindowRegistry portletWindowRegistry = createMock(IPortletWindowRegistry.class);
        expect(portletWindowRegistry.getParentPortletEntity(request, portletWindowId1))
            .andReturn(portletEntity1)
            .anyTimes();
        expect(portletWindowRegistry.getParentPortletEntity(request, portletWindowId2))
            .andReturn(portletEntity2)
            .anyTimes();
       
        expect(portletWindowRegistry.isTransient(request, portletWindowId2))
            .andReturn(true)
            .anyTimes();
       
        expect(portletWindowRegistry.isTransient(request, portletWindowId1))
            .andReturn(false)
            .anyTimes();
       
        expect(portletWindowRegistry.getDefaultPortletWindowId(portletEntityId1))
            .andReturn(portletWindowId1)
            .anyTimes();
       
        expect(portletWindowRegistry.getPortletWindow(request, portletWindowId1))
            .andReturn(portletWindow1)
            .anyTimes();

        final IPortletDelegationManager portletDelegationManager = createMock(IPortletDelegationManager.class);
       
       
        expect(portletDelegationManager.getParentPortletUrl(request, portletWindowId1))
            .andReturn(null);
       
       
        replay(portletDelegationManager, portalRequestUtils, portletWindowRegistry);

       
        portletUrlSyntaxProvider.setPortletWindowRegistry(portletWindowRegistry);
        portletUrlSyntaxProvider.setPortletDelegationManager(portletDelegationManager);
       

        //Setup portlet window 1
        portletWindow1.setWindowState(WindowState.MAXIMIZED);
        portletWindow1.setPortletMode(PortletMode.VIEW);
        final Map<String, List<String>> parameters1 = new LinkedHashMap<String, List<String>>();
        parameters1.put("key1", Arrays.asList(new String[] { "value1.1", "value1.2" }) );
        parameters1.put("key2", Arrays.asList(new String[] { "value2.1" }) );
        parameters1.put("key3", Arrays.asList(new String[] { "" }) );
        portletWindow1.setRequestParameters(parameters1);
       
        //Setup delegation (wId1 delegates to wId2)
        portletWindow2.setDelegationParent(portletWindowId1);
       
       
        final PortletUrl portletUrl = new PortletUrl(portletWindowId1);

        final Map<String, List<String>> parameters2 = new LinkedHashMap<String, List<String>>();
View Full Code Here

       
        portletUrlSyntaxProvider.setPortalRequestUtils(portalRequestUtils);
       
        final IPortletEntityId portletEntityId1 = new MockPortletEntityId("eId1");
        final IPortletWindowId portletWindowId1 = new MockPortletWindowId("wId1");
        final IPortletWindow portletWindow1 = new MockPortletWindow(portletWindowId1, portletEntityId1, "portletAppA", "portletNameA");
      
        final IPortletEntityId portletEntityId2 = new MockPortletEntityId("eId2");
        final IPortletWindowId portletWindowId2 = new MockPortletWindowId("wId2");
        final MockPortletWindow portletWindow2 = new MockPortletWindow(portletWindowId2, portletEntityId2, "portletAppB", "portletNameB");

       
        final ChannelRuntimeData channelRuntimeData = new ChannelRuntimeData();
        channelRuntimeData.setBaseActionURL("base/action.url");
       
        request.setAttribute(IPortletAdaptor.ATTRIBUTE__RUNTIME_DATA, channelRuntimeData);
       
        final MockPortletEntity portletEntity1 = new MockPortletEntity();
        portletEntity1.setPortletEntityId(portletEntityId1);
        portletEntity1.setChannelSubscribeId(portletEntityId1.getStringId());
       
        final MockPortletEntity portletEntity2 = new MockPortletEntity();
        portletEntity2.setPortletEntityId(portletEntityId2);
        portletEntity2.setChannelSubscribeId(portletEntityId2.getStringId());
       
        final IPortletWindowRegistry portletWindowRegistry = createMock(IPortletWindowRegistry.class);
        expect(portletWindowRegistry.getParentPortletEntity(request, portletWindowId1))
            .andReturn(portletEntity1)
            .anyTimes();
        expect(portletWindowRegistry.getParentPortletEntity(request, portletWindowId2))
            .andReturn(portletEntity2)
            .anyTimes();
       
        expect(portletWindowRegistry.isTransient(request, portletWindowId2))
            .andReturn(true)
            .anyTimes();
       
        expect(portletWindowRegistry.isTransient(request, portletWindowId1))
            .andReturn(false)
            .anyTimes();
       
        expect(portletWindowRegistry.getDefaultPortletWindowId(portletEntityId1))
            .andReturn(portletWindowId1)
            .anyTimes();
       
        expect(portletWindowRegistry.getPortletWindow(request, portletWindowId1))
            .andReturn(portletWindow1)
            .anyTimes();

        final IPortletDelegationManager portletDelegationManager = createMock(IPortletDelegationManager.class);
       
       
        final PortletUrl portletUrl1 = new PortletUrl(portletWindowId1);
        final Map<String, List<String>> urlParameters1 = new LinkedHashMap<String, List<String>>();
        urlParameters1.put("newKey1", Arrays.asList(new String[] { "newValue1.1", "newValue1.2" }) );
        urlParameters1.put("newKey2", Arrays.asList(new String[] { "newValue2.1" }) );
        urlParameters1.put("newKey3", Arrays.asList(new String[] { "" }) );
        portletUrl1.setParameters(urlParameters1);
       
        expect(portletDelegationManager.getParentPortletUrl(request, portletWindowId1))
            .andReturn(portletUrl1);
       
       
        replay(portletDelegationManager, portalRequestUtils, portletWindowRegistry);

       
        portletUrlSyntaxProvider.setPortletWindowRegistry(portletWindowRegistry);
        portletUrlSyntaxProvider.setPortletDelegationManager(portletDelegationManager);
       

        //Setup portlet window 1
        portletWindow1.setWindowState(WindowState.MAXIMIZED);
        portletWindow1.setPortletMode(PortletMode.VIEW);
        final Map<String, List<String>> parameters1 = new LinkedHashMap<String, List<String>>();
        parameters1.put("key1", Arrays.asList(new String[] { "value1.1", "value1.2" }) );
        parameters1.put("key2", Arrays.asList(new String[] { "value2.1" }) );
        parameters1.put("key3", Arrays.asList(new String[] { "" }) );
        portletWindow1.setRequestParameters(parameters1);
       
        //Setup delegation (wId1 delegates to wId2)
        portletWindow2.setDelegationParent(portletWindowId1);
       
       
        final PortletUrl portletUrl = new PortletUrl(portletWindowId1);

        final Map<String, List<String>> parameters2 = new LinkedHashMap<String, List<String>>();
View Full Code Here

       
        portletUrlSyntaxProvider.setPortalRequestUtils(portalRequestUtils);
       
        final IPortletEntityId portletEntityId1 = new MockPortletEntityId("eId1");
        final IPortletWindowId portletWindowId1 = new MockPortletWindowId("wId1");
        final IPortletWindow portletWindow1 = new MockPortletWindow(portletWindowId1, portletEntityId1, "portletAppA", "portletNameA");
      
        final IPortletEntityId portletEntityId2 = new MockPortletEntityId("eId2");
        final IPortletWindowId portletWindowId2 = new MockPortletWindowId("wId2");
        final MockPortletWindow portletWindow2 = new MockPortletWindow(portletWindowId2, portletEntityId2, "portletAppB", "portletNameB");
      
        final IPortletEntityId portletEntityId3 = new MockPortletEntityId("eId3");
        final IPortletWindowId portletWindowId3 = new MockPortletWindowId("wId3");
        final MockPortletWindow portletWindow3 = new MockPortletWindow(portletWindowId3, portletEntityId3, "portletAppC", "portletNameC");

       
        final ChannelRuntimeData channelRuntimeData = new ChannelRuntimeData();
        channelRuntimeData.setBaseActionURL("base/action.url");
       
        request.setAttribute(IPortletAdaptor.ATTRIBUTE__RUNTIME_DATA, channelRuntimeData);
       
        final MockPortletEntity portletEntity1 = new MockPortletEntity();
        portletEntity1.setPortletEntityId(portletEntityId1);
        portletEntity1.setChannelSubscribeId(portletEntityId1.getStringId());
       
        final MockPortletEntity portletEntity2 = new MockPortletEntity();
        portletEntity2.setPortletEntityId(portletEntityId2);
        portletEntity2.setChannelSubscribeId(portletEntityId2.getStringId());
       
        final MockPortletEntity portletEntity3 = new MockPortletEntity();
        portletEntity3.setPortletEntityId(portletEntityId3);
        portletEntity3.setChannelSubscribeId(portletEntityId3.getStringId());
       
        final IPortletWindowRegistry portletWindowRegistry = createMock(IPortletWindowRegistry.class);
        expect(portletWindowRegistry.getParentPortletEntity(request, portletWindowId1))
            .andReturn(portletEntity1)
            .anyTimes();
        expect(portletWindowRegistry.getParentPortletEntity(request, portletWindowId2))
            .andReturn(portletEntity2)
            .anyTimes();
        expect(portletWindowRegistry.getParentPortletEntity(request, portletWindowId3))
            .andReturn(portletEntity3)
            .anyTimes();
       
        expect(portletWindowRegistry.isTransient(request, portletWindowId3))
            .andReturn(true)
            .anyTimes();
       
        expect(portletWindowRegistry.isTransient(request, portletWindowId2))
            .andReturn(true)
            .anyTimes();
       
        expect(portletWindowRegistry.isTransient(request, portletWindowId1))
            .andReturn(false)
            .anyTimes();
       
        expect(portletWindowRegistry.getDefaultPortletWindowId(portletEntityId1))
            .andReturn(portletWindowId1)
            .anyTimes();
       
        expect(portletWindowRegistry.getPortletWindow(request, portletWindowId1))
            .andReturn(portletWindow1)
            .anyTimes();
       
        expect(portletWindowRegistry.getPortletWindow(request, portletWindowId2))
            .andReturn(portletWindow2)
            .anyTimes();
       
        final IPortletDelegationManager portletDelegationManager = createMock(IPortletDelegationManager.class);
       
        expect(portletDelegationManager.getParentPortletUrl(request, portletWindowId1))
            .andReturn(null);
        expect(portletDelegationManager.getParentPortletUrl(request, portletWindowId2))
            .andReturn(null);
       
        replay(portletDelegationManager, portalRequestUtils, portletWindowRegistry);

        portletUrlSyntaxProvider.setPortletWindowRegistry(portletWindowRegistry);
        portletUrlSyntaxProvider.setPortletDelegationManager(portletDelegationManager);
       
        //Setup portlet window 1
        portletWindow1.setWindowState(WindowState.MAXIMIZED);
        portletWindow1.setPortletMode(PortletMode.VIEW);
        final Map<String, List<String>> parameters1 = new LinkedHashMap<String, List<String>>();
        parameters1.put("key1", Arrays.asList(new String[] { "value1.1", "value1.2" }) );
        parameters1.put("key2", Arrays.asList(new String[] { "value2.1" }) );
        parameters1.put("key3", Arrays.asList(new String[] { "" }) );
        portletWindow1.setRequestParameters(parameters1);
       
        //Setup delegation (wId1 delegates to wId2)
        portletWindow2.setDelegationParent(portletWindowId1);
        portletWindow2.setWindowState(WindowState.MAXIMIZED);
        portletWindow2.setPortletMode(IPortletAdaptor.CONFIG);
        final Map<String, List<String>> parameters2 = new LinkedHashMap<String, List<String>>();
        parameters2.put("keyA", Arrays.asList(new String[] { "valueA.A", "valueA.B" }) );
        parameters2.put("keyB", Arrays.asList(new String[] { "valueB.A" }) );
        portletWindow2.setRequestParameters(parameters2);

       
        //Setup delegation (wId2 delegates to wId3)
        portletWindow3.setDelegationParent(portletWindowId2);
       
        final PortletUrl portletUrl = new PortletUrl(portletWindowId1);

        final Map<String, List<String>> parameters3 = new LinkedHashMap<String, List<String>>();
        parameters3.put("key3", Arrays.asList(new String[] { "value3.1", "value3.2" }) );
View Full Code Here

       
        portletUrlSyntaxProvider.setPortalRequestUtils(portalRequestUtils);
       
        final IPortletEntityId portletEntityId1 = new MockPortletEntityId("eId1");
        final IPortletWindowId portletWindowId1 = new MockPortletWindowId("wId1");
        final IPortletWindow portletWindow1 = new MockPortletWindow(portletWindowId1, portletEntityId1, "portletAppA", "portletNameA");
      
        final IPortletEntityId portletEntityId2 = new MockPortletEntityId("eId2");
        final IPortletWindowId portletWindowId2 = new MockPortletWindowId("wId2");
        final MockPortletWindow portletWindow2 = new MockPortletWindow(portletWindowId2, portletEntityId2, "portletAppB", "portletNameB");
      
        final IPortletEntityId portletEntityId3 = new MockPortletEntityId("eId3");
        final IPortletWindowId portletWindowId3 = new MockPortletWindowId("wId3");
        final MockPortletWindow portletWindow3 = new MockPortletWindow(portletWindowId3, portletEntityId3, "portletAppC", "portletNameC");

       
        final ChannelRuntimeData channelRuntimeData = new ChannelRuntimeData();
        channelRuntimeData.setBaseActionURL("base/action.url");
       
        request.setAttribute(IPortletAdaptor.ATTRIBUTE__RUNTIME_DATA, channelRuntimeData);
       
        final MockPortletEntity portletEntity1 = new MockPortletEntity();
        portletEntity1.setPortletEntityId(portletEntityId1);
        portletEntity1.setChannelSubscribeId(portletEntityId1.getStringId());
       
        final MockPortletEntity portletEntity2 = new MockPortletEntity();
        portletEntity2.setPortletEntityId(portletEntityId2);
        portletEntity2.setChannelSubscribeId(portletEntityId2.getStringId());
       
        final MockPortletEntity portletEntity3 = new MockPortletEntity();
        portletEntity3.setPortletEntityId(portletEntityId3);
        portletEntity3.setChannelSubscribeId(portletEntityId3.getStringId());
       
        final IPortletWindowRegistry portletWindowRegistry = createMock(IPortletWindowRegistry.class);
        expect(portletWindowRegistry.getParentPortletEntity(request, portletWindowId1))
            .andReturn(portletEntity1)
            .anyTimes();
        expect(portletWindowRegistry.getParentPortletEntity(request, portletWindowId2))
            .andReturn(portletEntity2)
            .anyTimes();
        expect(portletWindowRegistry.getParentPortletEntity(request, portletWindowId3))
            .andReturn(portletEntity3)
            .anyTimes();
       
        expect(portletWindowRegistry.isTransient(request, portletWindowId3))
            .andReturn(true)
            .anyTimes();
       
        expect(portletWindowRegistry.isTransient(request, portletWindowId2))
            .andReturn(true)
            .anyTimes();
       
        expect(portletWindowRegistry.isTransient(request, portletWindowId1))
            .andReturn(false)
            .anyTimes();
       
        expect(portletWindowRegistry.getDefaultPortletWindowId(portletEntityId1))
            .andReturn(portletWindowId1)
            .anyTimes();
       
        expect(portletWindowRegistry.getPortletWindow(request, portletWindowId1))
            .andReturn(portletWindow1)
            .anyTimes();
       
        expect(portletWindowRegistry.getPortletWindow(request, portletWindowId2))
            .andReturn(portletWindow2)
            .anyTimes();
       
        final IPortletDelegationManager portletDelegationManager = createMock(IPortletDelegationManager.class);
       
       
        final PortletUrl portletUrl1 = new PortletUrl(portletWindowId1);
        final Map<String, List<String>> urlParameters1 = new LinkedHashMap<String, List<String>>();
        urlParameters1.put("newKey1", Arrays.asList(new String[] { "newValue1.1", "newValue1.2" }) );
        urlParameters1.put("newKey2", Arrays.asList(new String[] { "newValue2.1" }) );
        urlParameters1.put("newKey3", Arrays.asList(new String[] { "" }) );
        portletUrl1.setParameters(urlParameters1);
        expect(portletDelegationManager.getParentPortletUrl(request, portletWindowId1))
            .andReturn(portletUrl1);
       
       
        final PortletUrl portletUrl2 = new PortletUrl(portletWindowId2);
        final Map<String, List<String>> urlParameters2 = new LinkedHashMap<String, List<String>>();
        urlParameters2.put("newKeyA", Arrays.asList(new String[] { "newValueA.A", "newValueA.B" }) );
        urlParameters2.put("newKeyB", Arrays.asList(new String[] { "newValueB.A" }) );
        portletUrl2.setParameters(urlParameters2);
        portletUrl2.setPortletMode(PortletMode.VIEW);
        expect(portletDelegationManager.getParentPortletUrl(request, portletWindowId2))
            .andReturn(portletUrl2);
       
        replay(portletDelegationManager, portalRequestUtils, portletWindowRegistry);

        portletUrlSyntaxProvider.setPortletWindowRegistry(portletWindowRegistry);
        portletUrlSyntaxProvider.setPortletDelegationManager(portletDelegationManager);
       
        //Setup portlet window 1
        portletWindow1.setWindowState(WindowState.MAXIMIZED);
        portletWindow1.setPortletMode(PortletMode.VIEW);
        final Map<String, List<String>> parameters1 = new LinkedHashMap<String, List<String>>();
        parameters1.put("key1", Arrays.asList(new String[] { "value1.1", "value1.2" }) );
        parameters1.put("key2", Arrays.asList(new String[] { "value2.1" }) );
        parameters1.put("key3", Arrays.asList(new String[] { "" }) );
        portletWindow1.setRequestParameters(parameters1);
       
        //Setup delegation (wId1 delegates to wId2)
        portletWindow2.setDelegationParent(portletWindowId1);
        portletWindow2.setWindowState(WindowState.MAXIMIZED);
        portletWindow2.setPortletMode(IPortletAdaptor.CONFIG);
        final Map<String, List<String>> parameters2 = new LinkedHashMap<String, List<String>>();
        parameters2.put("keyA", Arrays.asList(new String[] { "valueA.A", "valueA.B" }) );
        parameters2.put("keyB", Arrays.asList(new String[] { "valueB.A" }) );
        portletWindow2.setRequestParameters(parameters2);

       
        //Setup delegation (wId2 delegates to wId3)
        portletWindow3.setDelegationParent(portletWindowId2);
       
        final PortletUrl portletUrl = new PortletUrl(portletWindowId1);

        final Map<String, List<String>> parameters3 = new LinkedHashMap<String, List<String>>();
        parameters3.put("key3", Arrays.asList(new String[] { "value3.1", "value3.2" }) );
View Full Code Here

TOP

Related Classes of org.jasig.portal.mock.portlet.om.MockPortletWindow

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.