final IPortletEntity portletEntity = createMock(IPortletEntity.class);
final IPortletWindow portletWindow = createMock(IPortletWindow.class);
final MockPortletDefinitionId portletDefinitionId = new MockPortletDefinitionId("42");
final MockPortletEntityId portletEntityId = new MockPortletEntityId("subId1");
final MockPortletWindowId portletWindowId = new MockPortletWindowId("windowId1");
expect(userInstanceManager.getUserInstance(request)).andReturn(userInstance);
expect(userInstance.getPreferencesManager()).andReturn(userPreferencesManager);
expect(userPreferencesManager.getUserLayoutManager()).andReturn(userLayoutManager);
expect(userLayoutManager.getSubscribeId("my-info-student-center-home")).andReturn("subId1");
expect(userLayoutManager.getNode("subId1")).andReturn(userLayoutChannelDescription);
expect(userLayoutChannelDescription.getChannelPublishId()).andReturn("42");
expect(portletDefinitionRegistry.getPortletDefinition(42)).andReturn(portletDefinition);
expect(portletDefinition.getChannelDefinition()).andReturn(channelDefinition);
expect(channelDefinition.isPortlet()).andReturn(true);
expect(userInstance.getPerson()).andReturn(person);
expect(portletDefinition.getPortletDefinitionId()).andReturn(portletDefinitionId);
expect(person.getID()).andReturn(37);
expect(portletEntityRegistry.getOrCreatePortletEntity(portletDefinitionId, "subId1", 37)).andReturn(portletEntity);
expect(portletEntity.getPortletEntityId()).andReturn(portletEntityId);
expect(portletWindowRegistry.createDefaultPortletWindow(request, portletEntityId)).andReturn(portletWindow);
expect(portletWindow.getPortletWindowId()).andReturn(portletWindowId);
expect(portletWindowRegistry.createTransientPortletWindowId(request, portletWindowId)).andReturn(portletWindowId);
replay(portletWindowRegistry, userInstanceManager, userInstance, userPreferencesManager, userLayoutManager,
userLayoutChannelDescription, portletDefinitionRegistry, portletDefinition, channelDefinition, person,
portletEntityRegistry, portletEntity, portletWindow);
portletUrlSyntaxProvider.setPortletWindowRegistry(portletWindowRegistry);
portletUrlSyntaxProvider.setPortletEntityRegistry(portletEntityRegistry);
portletUrlSyntaxProvider.setPortletDefinitionRegistry(portletDefinitionRegistry);
portletUrlSyntaxProvider.setUserInstanceManager(userInstanceManager);
request.setParameter("uP_fname", "my-info-student-center-home");
request.setParameter("pltc_type", "ACTION");
request.setParameter("pltp_action", "loginAction");
final PortletUrl portletUrl = portletUrlSyntaxProvider.parsePortletUrl(request);
verify(portletWindowRegistry, userInstanceManager, userInstance, userPreferencesManager, userLayoutManager,
userLayoutChannelDescription, portletDefinitionRegistry, portletDefinition, channelDefinition, person,
portletEntityRegistry, portletEntity, portletWindow);
PortletUrl portletUrl1 = new PortletUrl(new MockPortletWindowId("windowId1"));
portletUrl1.setRequestType(RequestType.ACTION);
final Map<String, List<String>> parameters = new LinkedHashMap<String, List<String>>();
parameters.put("action", Arrays.asList("loginAction"));
portletUrl1.setParameters(parameters);