Examples of Portlets


Examples of org.apache.jetspeed.om.profile.Portlets

                InputSource is = new InputSource( new FileReader(map) );
                is.setSystemId( mapFile );
                mapping.loadMapping( is );
                System.out.println("++++++++++++++++++++++++++++++++++++++++++++++++++++");
                Unmarshaller unmarshaller = new Unmarshaller(mapping);
                Portlets rootset = (Portlets)unmarshaller.unmarshal(reader);
                System.out.println("++++++++++++++++++++++++++++++++++++++++++++++++++++");

                assertTrue(rootset.getName().equals("theRootSet"));
                assertTrue(rootset.getId().equals("01"));

                MetaInfo meta = rootset.getMetaInfo();
                assertNotNull(meta);
                assertTrue(meta.getTitle().equals("Jetspeed"));
                assertTrue(meta.getDescription().equals("This is the default page for me"));
                assertTrue(meta.getImage().equals("me.png"));
                assertTrue(rootset.getTitle().equals("Jetspeed"));
                assertTrue(rootset.getDescription().equals("This is the default page for me"));
                assertTrue(rootset.getImage().equals("me.png"));

                Security security = rootset.getSecurity();
                assertNotNull(security);
                assertTrue(security.getId().equals("999"));

                Iterator params = rootset.getParameterIterator();
                Parameter param = (Parameter)params.next();
                assertTrue(param.getName().equals("city"));
                assertTrue(param.getValue().equals("Atlanta"));
                param = (Parameter)params.next();
                assertTrue(param.getName().equals("state"));
                assertTrue(param.getValue().equals("Georgia"));
                param = (Parameter)params.next();
                assertTrue(param.getName().equals("country"));
                assertTrue(param.getValue().equals("USA"));

                assertTrue(rootset.getParameterValue("city").equals("Atlanta"));
                assertTrue(rootset.getParameterValue("country").equals("USA"));
                assertTrue(rootset.getParameter("state").getValue().equals("Georgia"));               

                Skin skin = rootset.getSkin();
                assertNotNull(skin);
                assertTrue(skin.getName().equals("skinny"));
                assertTrue(skin.getState().equals("DETACHED"));
                Iterator skinParams = skin.getParameterIterator();
                assertNotNull(skinParams);
                Parameter skinParam = (Parameter)skinParams.next();
                assertTrue(skinParam.getName().equals("a"));
                assertTrue(skinParam.getValue().equals("1"));
                skinParam = (Parameter)skinParams.next();
                assertTrue(skinParam.getName().equals("b"));
                assertTrue(skinParam.getValue().equals("2"));

                Layout layout = rootset.getLayout();
                assertNotNull(layout);
                assertTrue(layout.getName().equals("layout1"));
                assertTrue(layout.getSize() == 1);
                assertTrue(layout.getPosition() == 3);

                Iterator layoutParams = layout.getParameterIterator();
                assertNotNull(layoutParams);
                Parameter layoutParam = (Parameter)layoutParams.next();
                assertTrue(layoutParam.getName().equals("a"));
                assertTrue(layoutParam.getValue().equals("1"));
                layoutParam = (Parameter)layoutParams.next();
                assertTrue(layoutParam.getName().equals("b"));
                assertTrue(layoutParam.getValue().equals("2"));

                Control control = rootset.getControl();
                assertNotNull(control);
                Iterator controlParams = control.getParameterIterator();
                assertNotNull(controlParams);
                Parameter controlParam = (Parameter)controlParams.next();
                assertTrue(control.getName().equals("TabControl"));
                assertTrue(controlParam.getName().equals("a"));
                assertTrue(controlParam.getValue().equals("1"));
                controlParam = (Parameter)controlParams.next();
                assertTrue(controlParam.getName().equals("b"));
                assertTrue(controlParam.getValue().equals("2"));

                Controller controller = rootset.getController();
                assertNotNull(controller);
                Iterator controllerParams = controller.getParameterIterator();
                assertNotNull(controllerParams);
                Parameter controllerParam = (Parameter)controllerParams.next();

                assertTrue(controller.getName().equals("TabController"));
                assertTrue(controllerParam.getName().equals("a"));
                assertTrue(controllerParam.getValue().equals("1"));
                controllerParam = (Parameter)controllerParams.next();
                assertTrue(controllerParam.getName().equals("b"));
                assertTrue(controllerParam.getValue().equals("2"));

                Iterator entries = rootset.getEntriesIterator();
                assertNotNull(entries);
                Entry entry = (Entry)entries.next();
                assertTrue(entry.getParent().equals("LoggedInWelcome"));   
                assertTrue(entry.getId().equals("03"));   

                Layout elayout = entry.getLayout();
                assertNotNull(elayout);
                Iterator elayoutParams = elayout.getParameterIterator();
                assertNotNull(elayoutParams);
                Parameter elayoutParam = (Parameter)elayoutParams.next();
                assertTrue(elayoutParam.getName().equals("column"));
                elayoutParam = (Parameter)elayoutParams.next();
                assertTrue(elayoutParam.getName().equals("row"));

                Iterator pv = rootset.getPortletsIterator();

                Portlets p = (Portlets)pv.next();
                assertNotNull(p);

                Controller pc = p.getController();
                assertNotNull(pc);
                assertTrue(pc.getName().equals("TwoColumns"));

                Iterator pe = p.getEntriesIterator();
                assertNotNull(pe);
                Entry e1 = (Entry)pe.next();
                assertTrue(e1.getParent().equals("HelloWhatever"));   
                assertTrue(e1.getId().equals("99"));   

                Entry e2 = (Entry)pe.next();
                assertTrue(e2.getParent().equals("HelloVelocity"));   
                assertTrue(e2.getId().equals("100"));   

                Entry e3 = (Entry)pe.next();
                assertTrue(e3.getParent().equals("HelloCleveland"));   
                assertTrue(e3.getId().startsWith("P-"));   
                System.out.println(e3.getId());

                Iterator rv = p.getReferenceIterator();
                assertNotNull(rv);
                Reference ref = (Reference)rv.next();
                assertNotNull(ref);
                assertTrue(ref.getName().equals("ReferenceTest"));
                assertTrue(ref.getId().equals("300"));
                Portlets epr = ref.getPortletsReference();
                assertNotNull(epr);
                assertEquals("group/apache/page/news/media-type/html", ref.getPath());

                /* SHIT
                 
View Full Code Here

Examples of org.apache.jetspeed.om.profile.Portlets

            is.setSystemId( mapFile );
            mapping.loadMapping( is );

            System.out.println("++++++++++++++++++++++++++++++++++++++++++++++++++++");
            Unmarshaller unmarshaller = new Unmarshaller(mapping);
            Portlets rootset = (Portlets)unmarshaller.unmarshal(reader);
            System.out.println("++++++++++++++++++++++++++++++++++++++++++++++++++++");
           
            assertTrue(rootset.getName().equals("theRootSet"));
            assertTrue(rootset.getId().equals("01"));
           
            SecurityReference securityRef = rootset.getSecurityRef();
            assertNotNull("got SecurityRef", securityRef);
            assertEquals( "Name of parent", "all_users", securityRef.getParent());
               
        }
        else
View Full Code Here

Examples of org.apache.jetspeed.om.profile.Portlets

                InputSource is = new InputSource( new FileReader(map) );
                is.setSystemId( mapFile );
                mapping.loadMapping( is );
                System.out.println("++++++++++++++++++++++++++++++++++++++++++++++++++++");
                Unmarshaller unmarshaller = new Unmarshaller(mapping);
                Portlets rootset = (Portlets)unmarshaller.unmarshal(reader);
                System.out.println("++++++++++++++++++++++++++++++++++++++++++++++++++++");

                assertTrue(rootset.getName().equals("theRootSet"));
                assertTrue(rootset.getId().equals("01"));

                Iterator itt = rootset.getPortletsIterator();
                while (itt.hasNext())
                {
                    Portlets pp = (Portlets)itt.next();
                    System.out.println(" PORTLETS %%% " + pp.getId());
                    if (pp instanceof Reference)
                    {
                        System.out.println(" PORTLETS %%% REF: " + pp.getId());
                    }
                }

                Iterator itr = rootset.getReferenceIterator();
                while (itr.hasNext())
View Full Code Here

Examples of org.apache.jetspeed.om.profile.Portlets

                InputSource is = new InputSource( new FileReader(map) );
                is.setSystemId( mapFile );
                mapping.loadMapping( is );
                System.out.println("++++++++++++++++++++++++++++++++++++++++++++++++++++");
                Unmarshaller unmarshaller = new Unmarshaller(mapping);
                Portlets rootset = (Portlets)unmarshaller.unmarshal(reader);
                System.out.println("++++++++++++++++++++++++++++++++++++++++++++++++++++");

                assertTrue(rootset.getName().equals("theRootSet"));
                assertTrue(rootset.getId().equals("01"));

                Iterator itt = rootset.getPortletsIterator();
                while (itt.hasNext())
                {
                    Portlets pp = (Portlets)itt.next();
                    System.out.println(" PORTLETS %%% " + pp.getId());
                    if ( pp.getId().equals("02"))
                    {
                        foundPortlet02 = true;
                        MetaInfo pp02MetaInfo = pp.getMetaInfo();
                        assertNotNull( "Portlet ID 02 has metaInfo", pp02MetaInfo);
                        assertEquals( "Portlet ID 02 Title", "Portlet Title", pp02MetaInfo.getTitle());
                        assertEquals( "Portlet ID 02 Title", "Portlet Description", pp02MetaInfo.getDescription());
                        assertEquals( "Portlet ID 02 Title", "Portlet Image", pp02MetaInfo.getImage());
                        Iterator pp02itt = pp.getEntriesIterator();
                        while (pp02itt.hasNext())
                        {
                            Entry pp02Entry = (Entry) pp02itt.next();
                            assertNotNull( "Portlet Id 02 has entry", pp02Entry);
                            if (pp02Entry.getId().equals("07"))
View Full Code Here

Examples of org.apache.jetspeed.om.profile.Portlets

        print("Description: No skin set in PSML ");
        print("RESULT: All portlets use the system default skin.");
        print("Checking test case 1...");
        File file = createTestProfile(prof1);
        PSMLDocument doc = getDocumentFromPath(file.getPath());
        Portlets portlets = doc.getPortlets();
        print("Portlets loaded as: " + portlets);

        // checkSkinPresence(portlets, null);

        print("Using the PortalToolkit.  All Portlets and PsmlEntries (individual portlets) ");
        print("should now be using the system default skin, " + this.defaultSkin);

        PortletSet pSet = PortalToolkit.getSet(portlets);
        assertNotNull(pSet);

        // Checking if we are at the root
        isRoot(pSet);

        checkPortletSkinValues(pSet, new HashMap(), doc);

        print("Saving test document...");
        saveDocument(doc);
        printOk();
        print("Re-run check to make sure that the default setting did not get written...");
        PSMLDocument doc2 = getDocumentFromPath(file.getPath());
        Portlets portlets2 = doc.getPortlets();
        PortletSet pSet2 = PortalToolkit.getSet(portlets2);

        checkPortletSkinValues(pSet2, new HashMap(), doc2);

        printDivider();
View Full Code Here

Examples of org.apache.jetspeed.om.profile.Portlets

        print("Description: Skin set at root level, skin set in any children.");
        print("RESULT: All portlets use the root level skin");
        print("Checking test case 2...");
        File file = createTestProfile(prof2);
        PSMLDocument doc = getDocumentFromPath(file.getPath());
        Portlets portlets = doc.getPortlets();
        print("Portlets loaded as: " + portlets);

        print("Save and re-open document as if it were being loaded for the first time...");
        saveDocument(doc);
        // re-load everything...
        doc = null;
        doc = getDocumentFromPath(file.getPath());
        portlets = doc.getPortlets();

        print("Using the PortalToolkit.  All Portlets and PsmlEntries (individual portlets) ");

        PortletSet pSet = PortalToolkit.getSet(portlets);
        assertNotNull(pSet);

        // Checking if we are at the root
        isRoot(pSet);
        HashMap settingsMap = new HashMap();
        settingsMap.put(portlets.getId(), new MatchSettings(false, false, "grey", true));
        settingsMap.put("02", new MatchSettings(false, true, null, false));
        settingsMap.put("03", new MatchSettings(false, true, null, false));
        settingsMap.put("04", new MatchSettings(false, true, null, false));
        settingsMap.put("05", new MatchSettings(false, true, null, false));
        settingsMap.put("06", new MatchSettings(false, true, null, false));
View Full Code Here

Examples of org.apache.jetspeed.om.profile.Portlets

        print("Assigned PortletSets use assigned skin and so do their children.");
        print("");
        print("Checking test case 3...");
        File file = createTestProfile(prof3);
        PSMLDocument doc = getDocumentFromPath(file.getPath());
        Portlets portlets = doc.getPortlets();
        print("Portlets loaded as: " + portlets);

        print("Save and re-open document as if it were being loaded for the first time...");
        saveDocument(doc);
        // re-load everything...
View Full Code Here

Examples of org.apache.jetspeed.om.profile.Portlets

        print("Assigned PortletSets use assigned skin and so do their children.");
        print("");
        print("Checking test case 4...");
        File file = createTestProfile(prof4);
        PSMLDocument doc = getDocumentFromPath(file.getPath());
        Portlets portlets = doc.getPortlets();
        print("Portlets loaded as: " + portlets);


        print("Save and re-open document as if it were being loaded for the first time...");
        saveDocument(doc);
View Full Code Here

Examples of org.apache.jetspeed.om.profile.Portlets

        print("");
        print("Checking test case 5...");
        File file = createTestProfile(prof1);
        PSMLDocument doc = getDocumentFromPath(file.getPath());
        Portlets portlets = doc.getPortlets();
        print("Portlets loaded as: " + portlets);

        print("Directly setting the rootSet to a \"grey\"...");
        Skin rootSkin = new PsmlSkin();
        rootSkin.setName("grey");
        portlets.setSkin(rootSkin);
        print("Save and re-open document as if it were being loaded for the first time...");
        saveDocument(doc);
        // re-load everything...
        doc = null;
        doc = getDocumentFromPath(file.getPath());
View Full Code Here

Examples of org.apache.jetspeed.om.profile.Portlets

        printOk();

        Iterator itr = portlets.getPortletsIterator();
        while (itr.hasNext())
        {
            Portlets childPortlets = (Portlets) itr.next();
            if (idsWithSkins == null || !idsWithSkins.contains(childPortlets.getId()))
            {
                print("Verify skin *IS NOT* set for Portlets " + getNameTag(childPortlets) + "...");
                assertNull(childPortlets.getSkin());
            }
            else
            {
                print("Verify skin *IS* set for Portlets " + getNameTag(childPortlets) + "...");
                assertNotNull(childPortlets.getSkin());
            }
            printOk();

            Iterator pItr = childPortlets.getEntriesIterator();
            while (pItr.hasNext())
            {
                PsmlEntry entry = (PsmlEntry) pItr.next();

                if (idsWithSkins == null || !idsWithSkins.contains(entry.getId()))
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.