portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rwat...@apache.org
Subject svn commit: r921083 - in /portals/jetspeed-2/portal/branches/JETSPEED-2.1.4/components/portal-site: src/test/org/apache/jetspeed/portalsite/ testdata/pages/ testdata/pages/folder4/ testdata/pages/folder4/folder/
Date Tue, 09 Mar 2010 19:51:38 GMT
Author: rwatler
Date: Tue Mar  9 19:51:38 2010
New Revision: 921083

URL: http://svn.apache.org/viewvc?rev=921083&view=rev
Log:
JS2-1069: verified portal site does not filter folder menus without pages

Added:
    portals/jetspeed-2/portal/branches/JETSPEED-2.1.4/components/portal-site/testdata/pages/folder4/
    portals/jetspeed-2/portal/branches/JETSPEED-2.1.4/components/portal-site/testdata/pages/folder4/folder/
    portals/jetspeed-2/portal/branches/JETSPEED-2.1.4/components/portal-site/testdata/pages/folder4/folder/page0.psml
Modified:
    portals/jetspeed-2/portal/branches/JETSPEED-2.1.4/components/portal-site/src/test/org/apache/jetspeed/portalsite/TestPortalSite.java
    portals/jetspeed-2/portal/branches/JETSPEED-2.1.4/components/portal-site/testdata/pages/folder.metadata

Modified: portals/jetspeed-2/portal/branches/JETSPEED-2.1.4/components/portal-site/src/test/org/apache/jetspeed/portalsite/TestPortalSite.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JETSPEED-2.1.4/components/portal-site/src/test/org/apache/jetspeed/portalsite/TestPortalSite.java?rev=921083&r1=921082&r2=921083&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JETSPEED-2.1.4/components/portal-site/src/test/org/apache/jetspeed/portalsite/TestPortalSite.java
(original)
+++ portals/jetspeed-2/portal/branches/JETSPEED-2.1.4/components/portal-site/src/test/org/apache/jetspeed/portalsite/TestPortalSite.java
Tue Mar  9 19:51:38 2010
@@ -184,12 +184,13 @@ public class TestPortalSite extends Abst
         assertEquals("/", rootFolderProxy.getName());
         assertEquals("root", rootFolderProxy.getTitle());
         assertEquals("/", extractFileSystemPathFromId(rootFolderProxy.getId()));
-        assertEquals(4, rootFolderProxy.getFolders().size());
+        assertEquals(5, rootFolderProxy.getFolders().size());
         Iterator foldersIter = rootFolderProxy.getFolders().iterator();
         assertEquals("folder0", ((Folder)foldersIter.next()).getName());
         assertEquals("folder1", ((Folder)foldersIter.next()).getName());
         assertEquals("folder2", ((Folder)foldersIter.next()).getName());
         assertEquals("folder3", ((Folder)foldersIter.next()).getName());
+        assertEquals("folder4", ((Folder)foldersIter.next()).getName());
         assertEquals(4, rootFolderProxy.getPages().size());
         Iterator pagesIter = rootFolderProxy.getPages().iterator();
         assertEquals("page2.psml", ((Page)pagesIter.next()).getName());
@@ -246,7 +247,7 @@ public class TestPortalSite extends Abst
         assertTrue(rootPageProxiesByPath.contains(rootPage0Proxy));
         List rootFolderProxiesByPath = baseView.getNodeProxies("/*/", null, false, false);
         assertNotNull(rootFolderProxiesByPath);
-        assertEquals(4,rootFolderProxiesByPath.size());
+        assertEquals(5,rootFolderProxiesByPath.size());
         assertTrue(rootFolderProxiesByPath.contains(rootFolder0Proxy));
         List folderPageProxiesByPath = baseView.getNodeProxies("*/p*[0-9].psml", rootFolderProxy,
false, false);
         assertNotNull(folderPageProxiesByPath);
@@ -261,7 +262,7 @@ public class TestPortalSite extends Abst
         assertEquals("/", rootFolderProxy.getName());
         assertEquals("user root", rootFolderProxy.getTitle());
         assertEquals("/_user/user", extractFileSystemPathFromId(rootFolderProxy.getId()));
-        assertEquals(4, rootFolderProxy.getFolders().size());
+        assertEquals(5, rootFolderProxy.getFolders().size());
         assertEquals(4, rootFolderProxy.getPages().size());
         assertEquals(2, rootFolderProxy.getLinks().size());
         rootPage0Proxy = rootFolderProxy.getPage("page0.psml");
@@ -271,7 +272,7 @@ public class TestPortalSite extends Abst
         assertEquals("/page0.psml", extractFileSystemPathFromId(rootPage0Proxy.getId()));
         List rootPage0ProxyMenus = rootPage0Proxy.getMenuDefinitions();
         assertNotNull(rootPage0ProxyMenus);
-        assertEquals(2 + aggregateView.getStandardMenuNames().size(), rootPage0ProxyMenus.size());
+        assertEquals(3 + aggregateView.getStandardMenuNames().size(), rootPage0ProxyMenus.size());
         Iterator menusIter = rootPage0ProxyMenus.iterator();
         MenuDefinition rootPage0ProxyTopMenu = (MenuDefinition)menusIter.next();
         assertEquals("top", rootPage0ProxyTopMenu.getName());
@@ -282,6 +283,11 @@ public class TestPortalSite extends Abst
         assertEquals("bread-crumbs", rootPage0ProxyBreadCrumbMenu.getName());
         assertEquals("./", rootPage0ProxyBreadCrumbMenu.getOptions());
         assertEquals(true, rootPage0ProxyBreadCrumbMenu.isPaths());
+        MenuDefinition rootPage0SiteNavigationsMenu = (MenuDefinition)menusIter.next();
+        assertEquals("site-navigations", rootPage0SiteNavigationsMenu.getName());       

+        assertTrue(rootPage0SiteNavigationsMenu.isRegexp());        
+        assertEquals("/*/,/*.psml", rootPage0SiteNavigationsMenu.getOptions());        
+        assertEquals(-1, rootPage0SiteNavigationsMenu.getDepth());        
         for (int i = 0; (i < aggregateView.getStandardMenuNames().size()); i++)
         {
             assertTrue(aggregateView.getStandardMenuNames().contains(((MenuDefinition)menusIter.next()).getName()));
@@ -293,7 +299,7 @@ public class TestPortalSite extends Abst
         assertEquals("/_user/user/page2.psml", extractFileSystemPathFromId(rootPage2Proxy.getId()));
         List rootPage2ProxyMenus = rootPage2Proxy.getMenuDefinitions();
         assertNotNull(rootPage2ProxyMenus);
-        assertEquals(2 + aggregateView.getStandardMenuNames().size(), rootPage2ProxyMenus.size());
+        assertEquals(3 + aggregateView.getStandardMenuNames().size(), rootPage2ProxyMenus.size());
         menusIter = rootPage2ProxyMenus.iterator();
         MenuDefinition rootPage2ProxyTopMenu = (MenuDefinition)menusIter.next();
         assertEquals("top", rootPage2ProxyTopMenu.getName());
@@ -301,6 +307,8 @@ public class TestPortalSite extends Abst
         assertEquals(1, rootPage2ProxyTopMenu.getDepth());
         MenuDefinition rootPage2ProxyBreadCrumbMenu = (MenuDefinition)menusIter.next();
         assertEquals("bread-crumbs", rootPage2ProxyBreadCrumbMenu.getName());
+        MenuDefinition rootPage2SiteNavigationsMenu = (MenuDefinition)menusIter.next();
+        assertEquals("site-navigations", rootPage2SiteNavigationsMenu.getName());       

         for (int i = 0; (i < aggregateView.getStandardMenuNames().size()); i++)
         {
             assertTrue(aggregateView.getStandardMenuNames().contains(((MenuDefinition)menusIter.next()).getName()));
@@ -478,13 +486,15 @@ public class TestPortalSite extends Abst
         assertNull(requestParentFolderProxy);
         NodeSet requestSiblingFolderProxies = requestContext.getSiblingFolders();
         assertNotNull(requestSiblingFolderProxies);
-        assertEquals(3, requestSiblingFolderProxies.size());
+        assertEquals(4, requestSiblingFolderProxies.size());
         assertNotNull(requestSiblingFolderProxies.get("folder0"));
         assertEquals("/folder0", extractFileSystemPathFromId(requestSiblingFolderProxies.get("folder0").getId()));
         assertNotNull(requestSiblingFolderProxies.get("folder1"));
         assertEquals("/_user/user/folder1", extractFileSystemPathFromId(requestSiblingFolderProxies.get("folder1").getId()));
         assertNotNull(requestSiblingFolderProxies.get("folder2"));
         assertEquals("/folder2", extractFileSystemPathFromId(requestSiblingFolderProxies.get("folder2").getId()));
+        assertNotNull(requestSiblingFolderProxies.get("folder4"));
+        assertEquals("/folder4", extractFileSystemPathFromId(requestSiblingFolderProxies.get("folder4").getId()));
         Folder requestRootFolderProxy = requestContext.getRootFolder();
         assertNotNull(requestRootFolderProxy);
         assertEquals("/", requestRootFolderProxy.getName());
@@ -615,9 +625,10 @@ public class TestPortalSite extends Abst
         assertNotNull(requestContext);
         Set customMenuNames = requestContext.getCustomMenuNames();
         assertNotNull(customMenuNames);
-        assertEquals(2, customMenuNames.size());
+        assertEquals(3, customMenuNames.size());
         assertTrue(customMenuNames.contains("top"));
         assertTrue(customMenuNames.contains("bread-crumbs"));
+        assertTrue(customMenuNames.contains("site-navigations"));
         Menu topMenu = requestContext.getMenu("top");
         assertNotNull(topMenu);
         assertEquals(MenuElement.MENU_ELEMENT_TYPE, topMenu.getElementType());
@@ -630,7 +641,7 @@ public class TestPortalSite extends Abst
         assertFalse(topMenu.isEmpty());
         List topMenuElements = topMenu.getElements();
         assertNotNull(topMenuElements);
-        assertEquals(7, topMenuElements.size());
+        assertEquals(8, topMenuElements.size());
         Iterator menuElementsIter = topMenuElements.iterator();
         while (menuElementsIter.hasNext())
         {
@@ -662,6 +673,18 @@ public class TestPortalSite extends Abst
                 assertTrue(elements.get(1) instanceof MenuOption);
                 assertEquals("/folder1/page1.psml", ((MenuOption)elements.get(1)).getTitle());
             }
+            else if (element.getElementType().equals(MenuElement.MENU_ELEMENT_TYPE) &&
element.getTitle().equals("Folder4"))
+            {
+                assertTrue(element instanceof Menu);
+                assertEquals("/folder4", ((Menu)element).getUrl());
+                assertTrue(((Menu)element).getParentMenu() == topMenu);
+                assertFalse(((Menu)element).isEmpty());
+                List elements = ((Menu)element).getElements();
+                assertNotNull(elements);
+                assertEquals(1, elements.size());
+                assertTrue(elements.get(0) instanceof MenuOption);
+                assertEquals("Folder", ((MenuOption)elements.get(0)).getTitle());
+            }
             else if (element.getElementType().equals(MenuElement.OPTION_ELEMENT_TYPE) &&
element.getTitle().equals("/page2.psml"))
             {
                 assertTrue(element instanceof MenuOption);
@@ -718,6 +741,84 @@ public class TestPortalSite extends Abst
         assertEquals("/", ((MenuOption)breadCrumbsElements.get(0)).getUrl());
         assertEquals(MenuOption.FOLDER_OPTION_TYPE, ((MenuOption)breadCrumbsElements.get(0)).getType());
         assertTrue(((MenuImpl)breadCrumbsMenu).isElementRelative());
+        Menu siteNavigationsMenu = requestContext.getMenu("site-navigations");
+        assertEquals("site-navigations", siteNavigationsMenu.getName());
+        assertFalse(siteNavigationsMenu.isEmpty());
+        List siteNavigationsElements = siteNavigationsMenu.getElements();
+        assertNotNull(siteNavigationsElements);
+        assertEquals(6, siteNavigationsElements.size());
+        menuElementsIter = siteNavigationsElements.iterator();
+        while (menuElementsIter.hasNext())
+        {
+            MenuElement element = (MenuElement)menuElementsIter.next();
+            if (element.getElementType().equals(MenuElement.MENU_ELEMENT_TYPE) &&
element.getTitle().equals("folder0"))
+            {
+                assertTrue(element instanceof Menu);
+                assertEquals("/folder0", ((Menu)element).getUrl());
+                assertTrue(((Menu)element).getParentMenu() == siteNavigationsMenu);
+                assertFalse(((Menu)element).isEmpty());
+                List elements = ((Menu)element).getElements();
+                assertNotNull(elements);
+                assertEquals(1, elements.size());
+                assertTrue(elements.get(0) instanceof MenuOption);
+                assertEquals("/folder0/page0.psml", ((MenuOption)elements.get(0)).getUrl());
+            }
+            else if (element.getElementType().equals(MenuElement.MENU_ELEMENT_TYPE) &&
element.getTitle().equals("group folder1"))
+            {
+                assertTrue(element instanceof Menu);
+                assertEquals("/folder1", ((Menu)element).getUrl());
+                assertTrue(((Menu)element).getParentMenu() == siteNavigationsMenu);
+                assertFalse(((Menu)element).isEmpty());
+                List elements = ((Menu)element).getElements();
+                assertNotNull(elements);
+                assertEquals(2, elements.size());
+                assertTrue(elements.get(0) instanceof MenuOption);
+                assertEquals("/folder1/page0.psml", ((MenuOption)elements.get(0)).getTitle());
+                assertTrue(elements.get(1) instanceof MenuOption);
+                assertEquals("/folder1/page1.psml", ((MenuOption)elements.get(1)).getTitle());
+            }
+            else if (element.getElementType().equals(MenuElement.MENU_ELEMENT_TYPE) &&
element.getTitle().equals("Folder4"))
+            {
+                assertTrue(element instanceof Menu);
+                assertEquals("/folder4", ((Menu)element).getUrl());
+                assertTrue(((Menu)element).getParentMenu() == siteNavigationsMenu);
+                Menu menuElement = (Menu)element;
+                assertFalse(menuElement.isEmpty());
+                List elements = menuElement.getElements();
+                assertNotNull(elements);
+                assertEquals(1, elements.size());
+                assertTrue(elements.get(0) instanceof Menu);
+                Menu subFolderMenuElement = (Menu)elements.get(0);
+                assertEquals("Folder", subFolderMenuElement.getTitle());
+                elements = subFolderMenuElement.getElements();
+                assertNotNull(elements);
+                assertEquals(1, elements.size());
+                assertTrue(elements.get(0) instanceof MenuOption);
+                MenuOption subFolderMenuOptionElement = (MenuOption)elements.get(0);
+                assertEquals("/folder4/folder/page0.psml", subFolderMenuOptionElement.getUrl());
+                assertEquals(MenuOption.PAGE_OPTION_TYPE, subFolderMenuOptionElement.getType());
+            }
+            else if (element.getElementType().equals(MenuElement.OPTION_ELEMENT_TYPE) &&
element.getTitle().equals("/page2.psml"))
+            {
+                assertTrue(element instanceof MenuOption);
+                assertEquals("/page2.psml", ((MenuOption)element).getUrl());
+                assertEquals(MenuOption.PAGE_OPTION_TYPE, ((MenuOption)element).getType());
+            }
+            else if (element.getElementType().equals(MenuElement.OPTION_ELEMENT_TYPE) &&
element.getTitle().equals("/page1.psml"))
+            {
+                assertTrue(element instanceof MenuOption);
+                assertEquals("/page1.psml", ((MenuOption)element).getUrl());
+            }
+            else if (element.getElementType().equals(MenuElement.OPTION_ELEMENT_TYPE) &&
element.getTitle().equals("/page0.psml"))
+            {
+                assertTrue(element instanceof MenuOption);
+                assertEquals("/page0.psml", ((MenuOption)element).getUrl());
+            }
+            else
+            {
+                fail("Unexpected menu element type/title: "+element.getElementType()+"/"+element.getTitle());
+            }
+        }
 
         // second request at /folder0
         locator = new JetspeedProfileLocator();
@@ -760,6 +861,8 @@ public class TestPortalSite extends Abst
         Menu navigationsMenu = requestContext.getMenu("navigations");
         assertNotNull(navigationsMenu);
         assertTrue(navigationsMenu.isEmpty());
+        siteNavigationsMenu = requestContext.getMenu("site-navigations");
+        assertEquals("site-navigations", siteNavigationsMenu.getName());
 
         // third request at /page1.psml
         locator = new JetspeedProfileLocator();
@@ -804,7 +907,7 @@ public class TestPortalSite extends Abst
         assertFalse(navigationsMenu.isEmpty());
         List navigationsElements = navigationsMenu.getElements();
         assertNotNull(navigationsElements);
-        assertEquals(6, navigationsElements.size());
+        assertEquals(7, navigationsElements.size());
         menuElementsIter = navigationsElements.iterator();
         while (menuElementsIter.hasNext())
         {
@@ -824,6 +927,11 @@ public class TestPortalSite extends Abst
                 assertTrue(element instanceof MenuOption);
                 assertEquals(MenuOption.FOLDER_OPTION_TYPE, ((MenuOption)element).getType());
             }
+            else if (element.getElementType().equals(MenuElement.OPTION_ELEMENT_TYPE) &&
element.getTitle().equals("Folder4"))
+            {
+                assertTrue(element instanceof MenuOption);
+                assertEquals(MenuOption.FOLDER_OPTION_TYPE, ((MenuOption)element).getType());
+            }
             else if (element.getElementType().equals(MenuElement.SEPARATOR_ELEMENT_TYPE)
&&
                      (element instanceof MenuSeparator) &&
                      ((MenuSeparator)element).getText().equals("Additional Links"))

Modified: portals/jetspeed-2/portal/branches/JETSPEED-2.1.4/components/portal-site/testdata/pages/folder.metadata
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JETSPEED-2.1.4/components/portal-site/testdata/pages/folder.metadata?rev=921083&r1=921082&r2=921083&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JETSPEED-2.1.4/components/portal-site/testdata/pages/folder.metadata
(original)
+++ portals/jetspeed-2/portal/branches/JETSPEED-2.1.4/components/portal-site/testdata/pages/folder.metadata
Tue Mar  9 19:51:38 2010
@@ -34,5 +34,6 @@ limitations under the License.
   <document-order>link0.link</document-order>
 
   <menu name="bread-crumbs" options="./" paths="true"/>
+  <menu name="site-navigations" regexp="true" options="/*/,/*.psml" depth="-1"/>
 
 </folder>

Added: portals/jetspeed-2/portal/branches/JETSPEED-2.1.4/components/portal-site/testdata/pages/folder4/folder/page0.psml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JETSPEED-2.1.4/components/portal-site/testdata/pages/folder4/folder/page0.psml?rev=921083&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JETSPEED-2.1.4/components/portal-site/testdata/pages/folder4/folder/page0.psml
(added)
+++ portals/jetspeed-2/portal/branches/JETSPEED-2.1.4/components/portal-site/testdata/pages/folder4/folder/page0.psml
Tue Mar  9 19:51:38 2010
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+
+<page id="folder4-folder-page0"
+    xmlns="http://portals.apache.org/jetspeed"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+    xsi:schemaLocation="http://portals.apache.org/jetspeed http://portals.apache.org/jetspeed-2/2.1/schemas/psml.xsd">
+
+  <title>/folder4/folder/page0.psml</title>
+  <fragment id="fake" name="fake" type="fake"/>
+</page>



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message