Package org.jasig.portal.portlet.om

Examples of org.jasig.portal.portlet.om.IPortletEntity


   
    when(portletDescriptor.getCacheScope()).thenReturn(null);
   
    final IPortletWindowRegistry portletWindowRegistry = mock(IPortletWindowRegistry.class);
    final IPortletWindow portletWindow = mock(IPortletWindow.class);
    final IPortletEntity portletEntity = mock(IPortletEntity.class);
   
    when(portletWindowRegistry.getPortletWindow(httpRequest, portletWindowId)).thenReturn(portletWindow);
        when(portletWindow.getPortletEntity()).thenReturn(portletEntity);
    when(portletWindow.getWindowState()).thenReturn(WindowState.NORMAL);
    when(portletWindow.getPortletMode()).thenReturn(PortletMode.VIEW);
    when(portletEntity.getPortletDefinitionId()).thenReturn(portletDefinitionId);
   
    when(portletDefinitionRegistry.getParentPortletDescriptor(portletDefinitionId)).thenReturn(portletDescriptor);

        final CacheState<CachedPortletData<PortletRenderResult>, PortletRenderResult> cacheState = cacheControlService.getPortletRenderState(httpRequest, portletWindowId);
        final CacheControl cacheControl = cacheState.getCacheControl();
View Full Code Here


       
        final IPortletEntityId portletEntityId = this.execute(new Callable<IPortletEntityId>() {
            @Override
            public IPortletEntityId call() throws Exception {
                //T1 - Create the entity
                final IPortletEntity portletEntity = portletEntityRegistry.getOrCreatePortletEntity(request, portDefId1, nodeId, 12);
                assertEquals(SessionPortletEntityImpl.class, portletEntity.getClass());
               
                return portletEntity.getPortletEntityId();
            }
        });
       
        /*
         * T1 create entity
         * T1 add preference, making persistent
         * T2 delete preference, making interim
         * T1 add preference 2 to persistent, stays persistent
         */


        this.execute(new Callable<Object>() {
            @Override
            public Object call() throws Exception {
                final IPortletEntity portletEntity = portletEntityRegistry.getPortletEntity(request, portletEntityId);
               
                //Add a preference
                final List<IPortletPreference> preferences = portletEntity.getPortletPreferences();
                final IPortletPreference portletPreference = new PortletPreferenceImpl("pref", false, "value");
                preferences.add(portletPreference);
       
                //Store the entity
                portletEntityRegistry.storePortletEntity(request, portletEntity);
               
                return null;
            }
        });

        this.execute(new Callable<Object>() {
            @Override
            public Object call() throws Exception {
                //T1 - Verify it was converted from interim to persistent
                final IPortletEntity portletEntity = portletEntityRegistry.getPortletEntity(request, portletEntityId);
                assertEquals(PersistentPortletEntityWrapper.class, portletEntity.getClass());
                final List<IPortletPreference> preferences = portletEntity.getPortletPreferences();
                assertEquals(1, preferences.size());
               
                //T2 - get the entity and add preferences
                final IPortletEntityId localPortletEntityId = executeInThread("T2.1", new Callable<IPortletEntityId>() {
                    @Override
                    public IPortletEntityId call() throws Exception {
                        //T2 - Get entity
                        final IPortletEntity portletEntity = portletEntityRegistry.getPortletEntity(request, portletEntityId.getStringId());
                        assertEquals(portletEntity, portletEntity);
       
                        //T2 - add preference
                        final List<IPortletPreference> preferences = portletEntity.getPortletPreferences();
                        preferences.clear();
                       
                        //T2 - Store the entity
                        portletEntityRegistry.storePortletEntity(request, portletEntity);
                       
                        return portletEntity.getPortletEntityId();
                    }
                });

                //T2 - verify entity was made persistent
                executeInThread("T2.2", new Callable<Object>() {
                    @Override
                    public Object call() throws Exception {
                       
                        //T2 - Verify it was converted from persistent to interim
                        final IPortletEntity portletEntity = portletEntityRegistry.getPortletEntity(request, localPortletEntityId);
                        assertNotNull(portletEntity);
                        assertEquals(SessionPortletEntityImpl.class, portletEntity.getClass());
                        final List<IPortletPreference> preferences = portletEntity.getPortletPreferences();
                        assertEquals(0, preferences.size());
                       
                        return null;
                    }
                });
       

                //T1 - add preference 2
                final IPortletPreference portletPreference = new PortletPreferenceImpl("pref2", false, "value");
                preferences.add(portletPreference);
       
                //T1 - Store the entity
                portletEntityRegistry.storePortletEntity(request, portletEntity);
               
                return null;
            }
        });
       
        this.execute(new Callable<Object>() {
            @Override
            public Object call() throws Exception {
                //T1 - Verify it was converted from interim to persistent
                final IPortletEntity portletEntity = portletEntityRegistry.getPortletEntity(request, portletEntityId);
                assertEquals(PersistentPortletEntityWrapper.class, portletEntity.getClass());
                final List<IPortletPreference> preferences = portletEntity.getPortletPreferences();
                assertEquals(2, preferences.size());
               
                return null;
            }
        });
View Full Code Here

        final IPortletEntityId portletEntityId = this.execute(new Callable<IPortletEntityId>() {
            @Override
            public IPortletEntityId call() throws Exception {
                //T1 - Create the entity
                final IPortletEntity portletEntity = portletEntityRegistry.getOrCreatePortletEntity(request, portDefId1, nodeId, 12);;
                assertEquals(SessionPortletEntityImpl.class, portletEntity.getClass());
               
                return portletEntity.getPortletEntityId();
            }
        });


        this.execute(new Callable<Object>() {
            @Override
            public Object call() throws Exception {
                final IPortletEntity portletEntity = portletEntityRegistry.getPortletEntity(request, portletEntityId);
               
                //Add a preference
                final List<IPortletPreference> preferences = portletEntity.getPortletPreferences();
                final IPortletPreference portletPreference = new PortletPreferenceImpl("pref", false, "value");
                preferences.add(portletPreference);
       
                //Store the entity
                portletEntityRegistry.storePortletEntity(request, portletEntity);
               
                return null;
            }
        });

        this.execute(new Callable<Object>() {
            @Override
            public Object call() throws Exception {
                //T1 - Verify it was converted from interim to persistent
                final IPortletEntity portletEntity = portletEntityRegistry.getPortletEntity(request, portletEntityId);
                assertEquals(PersistentPortletEntityWrapper.class, portletEntity.getClass());
                final List<IPortletPreference> preferences = portletEntity.getPortletPreferences();
                assertEquals(1, preferences.size());
               
                //T2 - get the entity and add preferences
                final IPortletEntityId localPortletEntityId = executeInThread("T2.1", new Callable<IPortletEntityId>() {
                    @Override
                    public IPortletEntityId call() throws Exception {
                        //T2 - Get entity
                        final IPortletEntity portletEntity = portletEntityRegistry.getPortletEntity(request, portletEntityId.getStringId());
                        assertEquals(portletEntity, portletEntity);
       
                        //T2 - remove preferences
                        final List<IPortletPreference> preferences = portletEntity.getPortletPreferences();
                        preferences.clear();
                       
                        //T2 - Store the entity
                        portletEntityRegistry.storePortletEntity(request, portletEntity);
                       
                        return portletEntity.getPortletEntityId();
                    }
                });

                //T2 - verify entity was made persistent
                executeInThread("T2.2", new Callable<Object>() {
                    @Override
                    public Object call() throws Exception {
                       
                        //T2 - Verify it was converted from persistent to interim
                        IPortletEntity portletEntity = portletEntityRegistry.getPortletEntity(request, localPortletEntityId);
                        assertEquals(SessionPortletEntityImpl.class, portletEntity.getClass());
                        List<IPortletPreference> preferences = portletEntity.getPortletPreferences();
                        assertEquals(0, preferences.size());
                       
                        return null;
                    }
                });
       

                //T1 - remove all preferences
                preferences.clear();
       
                //T1 - Store the entity
                portletEntityRegistry.storePortletEntity(request, portletEntity);
               
                return null;
            }
        });
       
        this.execute(new Callable<Object>() {
            @Override
            public Object call() throws Exception {
                //T1 - Verify it was converted from interim to persistent
                final IPortletEntity portletEntity = portletEntityRegistry.getPortletEntity(request, portletEntityId);
                assertEquals(SessionPortletEntityImpl.class, portletEntity.getClass());
                final List<IPortletPreference> preferences = portletEntity.getPortletPreferences();
                assertEquals(0, preferences.size());
               
                return null;
            }
        });
View Full Code Here

        final IPortletEntityId portletEntityId = this.execute(new Callable<IPortletEntityId>() {
            @Override
            public IPortletEntityId call() throws Exception {
                //T1 - Create the entity
                final IPortletEntity portletEntity = portletEntityRegistry.getOrCreatePortletEntity(request, portDefId1, nodeId, 12);;
                assertEquals(SessionPortletEntityImpl.class, portletEntity.getClass());
               
                //T2 - get the entity and add preferences
                final IPortletEntityId portletEntityId = executeInThread("T2.1", new Callable<IPortletEntityId>() {
                    @Override
                    public IPortletEntityId call() throws Exception {
                        //T2 - Get entity
                        final IPortletEntity localPortletEntity = portletEntityRegistry.getPortletEntity(request, portletEntity.getPortletEntityId().getStringId());
                        assertEquals(portletEntity, localPortletEntity);
       
                        //T2 - Add a preference
                        final List<IPortletPreference> preferences = localPortletEntity.getPortletPreferences();
                        final IPortletPreference portletPreference = new PortletPreferenceImpl("pref2", false, "value");
                        preferences.add(portletPreference);
                       
                        //T2 - Store the entity
                        portletEntityRegistry.storePortletEntity(request, localPortletEntity);
                       
                        return localPortletEntity.getPortletEntityId();
                    }
                });

                //T2 - verify entity was made persistent
                executeInThread("T2.2", new Callable<Object>() {
                    @Override
                    public Object call() throws Exception {
                       
                        //T2 - Verify it was converted from interim to persistent
                        IPortletEntity portletEntity = portletEntityRegistry.getPortletEntity(request, portletEntityId);
                        assertEquals(PersistentPortletEntityWrapper.class, portletEntity.getClass());
                        List<IPortletPreference> preferences = portletEntity.getPortletPreferences();
                        assertEquals(1, preferences.size());
                       
                        return null;
                    }
                });
       
                //T1 - clear preferences
                final List<IPortletPreference> preferences = portletEntity.getPortletPreferences();
                preferences.clear();
       
                //T1 - Store the entity
                portletEntityRegistry.storePortletEntity(request, portletEntity);
               
                return portletEntity.getPortletEntityId();
            }
        });
       
        this.execute(new Callable<Object>() {
            @Override
            public Object call() throws Exception {
                //T1 - Verify it was converted from interim to persistent
                final IPortletEntity portletEntity = portletEntityRegistry.getPortletEntity(request, portletEntityId);
                assertEquals(SessionPortletEntityImpl.class, portletEntity.getClass());
                final List<IPortletPreference> preferences = portletEntity.getPortletPreferences();
                assertEquals(0, preferences.size());
               
                return null;
            }
        });
View Full Code Here

        final IPortletEntityId portletEntityId = this.execute(new Callable<IPortletEntityId>() {
            @Override
            public IPortletEntityId call() throws Exception {
                //T1 - Create the entity
                final IPortletEntity portletEntity = portletEntityRegistry.getOrCreatePortletEntity(request, portDefId1, nodeId, 12);;
                assertEquals(SessionPortletEntityImpl.class, portletEntity.getClass());
               
                //T2 - get the entity and add preferences
                final IPortletEntityId portletEntityId = executeInThread("T2.1", new Callable<IPortletEntityId>() {
                    @Override
                    public IPortletEntityId call() throws Exception {
                        //T2 - Get entity
                        final IPortletEntity localPortletEntity = portletEntityRegistry.getPortletEntity(request, portletEntity.getPortletEntityId().getStringId());
                        assertEquals(portletEntity, localPortletEntity);
       
                        //T2 - Add a preference
                        final List<IPortletPreference> preferences = localPortletEntity.getPortletPreferences();
                        final IPortletPreference portletPreference = new PortletPreferenceImpl("pref2", false, "value");
                        preferences.add(portletPreference);
                       
                        //T2 - Store the entity
                        portletEntityRegistry.storePortletEntity(request, localPortletEntity);
                       
                        return localPortletEntity.getPortletEntityId();
                    }
                });

                //T2 - verify entity was made persistent
                executeInThread("T2.2", new Callable<Object>() {
                    @Override
                    public Object call() throws Exception {
                       
                        //T2 - Verify it was converted from interim to persistent
                        IPortletEntity portletEntity = portletEntityRegistry.getPortletEntity(request, portletEntityId);
                        assertEquals(PersistentPortletEntityWrapper.class, portletEntity.getClass());
                        List<IPortletPreference> preferences = portletEntity.getPortletPreferences();
                        assertEquals(1, preferences.size());
                       
                        return null;
                    }
                });
       
                //T1 - Add a preference
                final List<IPortletPreference> preferences = portletEntity.getPortletPreferences();
                final IPortletPreference portletPreference = new PortletPreferenceImpl("pref1", false, "value");
                preferences.add(portletPreference);
       
                //T1 - Store the entity
                portletEntityRegistry.storePortletEntity(request, portletEntity);
               
                return portletEntity.getPortletEntityId();
            }
        });
       
        this.execute(new Callable<Object>() {
            @Override
            public Object call() throws Exception {
                //T1 - Verify it was converted from interim to persistent
                final IPortletEntity portletEntity = portletEntityRegistry.getPortletEntity(request, portletEntityId);
                assertEquals(PersistentPortletEntityWrapper.class, portletEntity.getClass());
                final List<IPortletPreference> preferences = portletEntity.getPortletPreferences();
                assertEquals(1, preferences.size());
               
                return null;
            }
        });
View Full Code Here

        final IPortletEntityId portletEntityId = this.execute(new Callable<IPortletEntityId>() {
            @Override
            public IPortletEntityId call() throws Exception {
                //Create the entity
                IPortletEntity portletEntity = portletEntityRegistry.getOrCreatePortletEntity(request, portletDefId, nodeId, 12);
                assertEquals(SessionPortletEntityImpl.class, portletEntity.getClass());

                return portletEntity.getPortletEntityId();
            }
        });

        this.execute(new Callable<Object>() {
            @Override
            public Object call() throws Exception {
                final IPortletEntity portletEntity = portletEntityRegistry.getPortletEntity(request, portletEntityId);
               
                //Add a preference
                final List<IPortletPreference> preferences = portletEntity.getPortletPreferences();
                final IPortletPreference portletPreference = new PortletPreferenceImpl("pref", false, "value");
                preferences.add(portletPreference);
       
                //Store the entity
                portletEntityRegistry.storePortletEntity(request, portletEntity);
               
                return null;
            }
        });

        this.execute(new Callable<Object>() {
            @Override
            public Object call() throws Exception {
                //Verify it was converted from interim to persistent
                final IPortletEntity portletEntity = portletEntityRegistry.getPortletEntity(request, portletEntityId);
                assertEquals(PersistentPortletEntityWrapper.class, portletEntity.getClass());
                final List<IPortletPreference> preferences = portletEntity.getPortletPreferences();
                assertEquals(1, preferences.size());

                //remove all preferences
                preferences.clear();
       
                //Store the entity
                portletEntityRegistry.storePortletEntity(request, portletEntity);
               
                return null;
            }
        });


        this.execute(new Callable<Object>() {
            @Override
            public Object call() throws Exception {
                //Verify it switched from persistent to interim
                final IPortletEntity portletEntity = portletEntityRegistry.getPortletEntity(request, portletEntityId);
                assertEquals(SessionPortletEntityImpl.class, portletEntity.getClass());
                final List<IPortletPreference> preferences = portletEntity.getPortletPreferences();
                assertEquals(0, preferences.size());
               
                return null;
            }
        });
View Full Code Here

        final IPortletEntityId portletEntityId = this.execute(new Callable<IPortletEntityId>() {
            @Override
            public IPortletEntityId call() throws Exception {
                //Create the entity
                IPortletEntity portletEntity = portletEntityRegistry.getOrCreatePortletEntity(request, portletDefId, nodeId, 12);
                assertEquals(SessionPortletEntityImpl.class, portletEntity.getClass());

                return portletEntity.getPortletEntityId();
            }
        });

        this.execute(new Callable<Object>() {
            @Override
            public Object call() throws Exception {
                final IPortletEntity portletEntity = portletEntityRegistry.getPortletEntity(request, portletEntityId);
               
                //Add a preference
                final List<IPortletPreference> preferences = portletEntity.getPortletPreferences();
                final IPortletPreference portletPreference = new PortletPreferenceImpl("pref", false, "value");
                preferences.add(portletPreference);
       
                //Store the entity
                portletEntityRegistry.storePortletEntity(request, portletEntity);
               
                return null;
            }
        });

        this.execute(new Callable<Object>() {
            @Override
            public Object call() throws Exception {
                //Verify it was converted from interim to persistent
                final IPortletEntity portletEntity = portletEntityRegistry.getPortletEntity(request, portletEntityId);
                assertEquals(PersistentPortletEntityWrapper.class, portletEntity.getClass());
                final List<IPortletPreference> preferences = portletEntity.getPortletPreferences();
                assertEquals(1, preferences.size());

                //add another preference
                final PortletPreferenceImpl portletPreference = new PortletPreferenceImpl("pref2", false, "valuea");
                preferences.add(portletPreference);
       
                //Store the entity
                portletEntityRegistry.storePortletEntity(request, portletEntity);
               
                return null;
            }
        });

        this.execute(new Callable<Object>() {
            @Override
            public Object call() throws Exception {
                //Verify it was converted from interim to persistent
                final IPortletEntity portletEntity = portletEntityRegistry.getPortletEntity(request, portletEntityId);
                assertEquals(PersistentPortletEntityWrapper.class, portletEntity.getClass());
                final List<IPortletPreference> preferences = portletEntity.getPortletPreferences();
                assertEquals(2, preferences.size());
               
                return null;
            }
        });
View Full Code Here

    attributes.put("attribute1", Arrays.asList(new Object[] { "value1", "value2", "value3" }));
    NamedPersonImpl personAttributes = new NamedPersonImpl("username", attributes);
   
    PortletWindow plutoPortletWindow = mock(PortletWindow.class);
    IPortletWindow portletWindow = mock(IPortletWindow.class);
    IPortletEntity portletEntity = mock(IPortletEntity.class);
    when(portletWindow.getPortletEntity()).thenReturn(portletEntity);
    IPortletDefinition portletDefinition = mock(IPortletDefinition.class);
    when(portletEntity.getPortletDefinition()).thenReturn(portletDefinition);
    IPortletDefinitionId portletDefinitionId = mock(IPortletDefinitionId.class);
    when(portletDefinition.getPortletDefinitionId()).thenReturn(portletDefinitionId);
   
    IPersonAttributeDao personAttributeDao = mock(IPersonAttributeDao.class);
    when(personAttributeDao.getPerson("username")).thenReturn(personAttributes);
View Full Code Here

            protected void callWithoutResult() {
                final IPortletDefinitionId portletDefinitionId = PortletDefinitionIdImpl.create(1);
                final IPortletDefinition nullPortDef1 = jpaPortletDefinitionDao.getPortletDefinition(portletDefinitionId);
                assertNull(nullPortDef1);
               
                final IPortletEntity nullPortEnt1 = jpaPortletEntityDao.getPortletEntity("chanSub1", 1);
                assertNull(nullPortEnt1);
               
                final Set<IPortletEntity> portEnts = jpaPortletEntityDao.getPortletEntities(PortletDefinitionIdImpl.create(1));
                assertEquals(Collections.emptySet(), portEnts);
            }
View Full Code Here

       
       
        final IPortletEntityId portletEntityId = execute(new Callable<IPortletEntityId>() {
            @Override
            public IPortletEntityId call() throws Exception {
                IPortletEntity portEnt1 = jpaPortletEntityDao.createPortletEntity(portletDefinitionId, "chanSub1", 1);
               
                return portEnt1.getPortletEntityId();
            }
        });
               

        execute(new Callable<Object>() {
            @Override
            public Object call() throws Exception {
                final IPortletEntity portEnt1a = jpaPortletEntityDao.getPortletEntity(portletEntityId);
                assertNotNull(portEnt1a);
               
                final IPortletEntity portEnt1b = jpaPortletEntityDao.getPortletEntity("chanSub1", 1);
                assertEquals(portEnt1a, portEnt1b);
               
                final IPortletEntity portEnt1c = jpaPortletEntityDao.getPortletEntity("chanSub1", 1);
                assertEquals(portEnt1b, portEnt1c);
               
                final Set<IPortletEntity> portletEntities1 = jpaPortletEntityDao.getPortletEntities(portletDefinitionId);
                assertEquals(Collections.singleton(portEnt1a), portletEntities1);
               
                final Set<IPortletEntity> portletEntitiesByUser = jpaPortletEntityDao.getPortletEntitiesForUser(1);
                assertEquals(Collections.singleton(portEnt1a), portletEntitiesByUser);
               
                return null;
            }
        });
               
        execute(new Callable<Object>() {
            @Override
            public Object call() throws Exception {
                //Add entity and preferences
                final IPortletDefinition portDef1 = jpaPortletDefinitionDao.getPortletDefinition(portletDefinitionId);
                portDef1.getPortletPreferences().add(new PortletPreferenceImpl("defpref1", false, "dpv1", "dpv2"));
                jpaPortletDefinitionDao.updatePortletDefinition(portDef1);
               
                final IPortletEntity portEnt1 = jpaPortletEntityDao.getPortletEntity(portletEntityId);
                portEnt1.getPortletPreferences().add(new PortletPreferenceImpl("entpref1", false, "epv1", "epv2"));
//                portEnt1.setWindowState(WindowState.MINIMIZED);
                jpaPortletEntityDao.updatePortletEntity(portEnt1);
               
                return null;
            }
View Full Code Here

TOP

Related Classes of org.jasig.portal.portlet.om.IPortletEntity

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.