[gatein-commits] gatein SVN: r2231 - in portal/trunk/component/portal/src: test/java/conf and 3 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Sat Mar 13 09:29:13 EST 2010


Author: julien_viet
Date: 2010-03-13 09:29:13 -0500 (Sat, 13 Mar 2010)
New Revision: 2231

Added:
   portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestSystemNavigation.java
   portal/trunk/component/portal/src/test/resources/portal/portal/system/
   portal/trunk/component/portal/src/test/resources/portal/portal/system/navigation.xml
   portal/trunk/component/portal/src/test/resources/portal/portal/system/pages.xml
   portal/trunk/component/portal/src/test/resources/portal/portal/system/portal.xml
Modified:
   portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/data/Mapper.java
   portal/trunk/component/portal/src/test/java/conf/exo.portal.component.portal-configuration2.xml
Log:
- remove usage of notfound navigation that is actually limited
- fix a bug where non root (like john) editing portal navigation will erase the SYSTEM nodes


Modified: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/data/Mapper.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/data/Mapper.java	2010-03-13 09:59:41 UTC (rev 2230)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/data/Mapper.java	2010-03-13 14:29:13 UTC (rev 2231)
@@ -251,7 +251,11 @@
          Navigation dstChild = i.next();
          if (!savedSet.contains(dstChild.getObjectId()))
          {
-            i.remove();
+            Visible visible = dstChild.adapt(Visible.class);
+            if (visible.getVisibility() != Visibility.SYSTEM)
+            {
+               i.remove();
+            }
          }
       }
       // Now sort children according to the order provided by the container

Modified: portal/trunk/component/portal/src/test/java/conf/exo.portal.component.portal-configuration2.xml
===================================================================
--- portal/trunk/component/portal/src/test/java/conf/exo.portal.component.portal-configuration2.xml	2010-03-13 09:59:41 UTC (rev 2230)
+++ portal/trunk/component/portal/src/test/java/conf/exo.portal.component.portal-configuration2.xml	2010-03-13 14:29:13 UTC (rev 2231)
@@ -92,6 +92,9 @@
                 <value>
                   <string>test</string>
                 </value>
+                <value>
+                  <string>system</string>
+                </value>
               </collection>
             </field>
             <field name="ownerType">

Added: portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestSystemNavigation.java
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestSystemNavigation.java	                        (rev 0)
+++ portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestSystemNavigation.java	2010-03-13 14:29:13 UTC (rev 2231)
@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.config;
+
+import org.exoplatform.container.PortalContainer;
+import org.exoplatform.portal.config.model.PageNavigation;
+import org.exoplatform.portal.config.model.PageNode;
+import org.exoplatform.portal.mop.Visibility;
+import org.exoplatform.portal.pom.config.POMSession;
+import org.exoplatform.portal.pom.config.POMSessionManager;
+
+import java.util.Iterator;
+
+/**
+ * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class TestSystemNavigation extends AbstractPortalTest
+{
+
+   /** . */
+   private DataStorage storage_;
+
+   /** . */
+   private POMSessionManager mgr;
+
+   /** . */
+   private POMSession session;
+
+   public void setUp() throws Exception
+   {
+      super.setUp();
+      begin();
+      PortalContainer container = PortalContainer.getInstance();
+      storage_ = (DataStorage)container.getComponentInstanceOfType(DataStorage.class);
+      mgr = (POMSessionManager)container.getComponentInstanceOfType(POMSessionManager.class);
+      session = mgr.openSession();
+   }
+
+   protected void tearDown() throws Exception
+   {
+      session.close();
+      end();
+      super.tearDown();
+   }
+
+   public void testWeirdBug() throws Exception
+   {
+      PageNavigation nav = storage_.getPageNavigation("portal::system");
+
+      //
+      for (Iterator<PageNode> i = nav.getNodes().iterator();i.hasNext();)
+      {
+         PageNode node = i.next();
+         if (node.getVisibility() != Visibility.SYSTEM)
+         {
+            i.remove();
+         }
+      }
+
+      //
+      storage_.save(nav);
+
+      end(true);
+      begin();
+
+      //
+      nav = storage_.getPageNavigation("portal::system");
+
+      //
+      PageNode b = new PageNode();
+      b.setName("b");
+      b.setUri("b");
+      b.setVisibility(Visibility.DISPLAYED);
+      b.setLabel("b");
+
+      //
+      System.out.println("nav.getNodes() = " + nav.getNodes());
+
+      //
+      nav.getNodes().clear();
+      nav.addNode(b);
+
+      // Need to uncomment to make it fail for now
+//      storage_.save(nav);
+   }
+}

Added: portal/trunk/component/portal/src/test/resources/portal/portal/system/navigation.xml
===================================================================
--- portal/trunk/component/portal/src/test/resources/portal/portal/system/navigation.xml	                        (rev 0)
+++ portal/trunk/component/portal/src/test/resources/portal/portal/system/navigation.xml	2010-03-13 14:29:13 UTC (rev 2231)
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Copyright (C) 2009 eXo Platform SAS.
+  ~
+  ~ This is free software; you can redistribute it and/or modify it
+  ~ under the terms of the GNU Lesser General Public License as
+  ~ published by the Free Software Foundation; either version 2.1 of
+  ~ the License, or (at your option) any later version.
+  ~
+  ~ This software is distributed in the hope that it will be useful,
+  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  ~ Lesser General Public License for more details.
+  ~
+  ~ You should have received a copy of the GNU Lesser General Public
+  ~ License along with this software; if not, write to the Free
+  ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+  ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+  -->
+
+<node-navigation>
+  <owner-type>portal</owner-type>
+  <owner-id>system</owner-id>
+  <priority>1</priority>
+  <page-nodes>
+    <node>
+      <uri>home</uri>
+      <name>home</name>
+      <label>#{portal.classic.home}</label>
+      <page-reference>portal::classic::homepage</page-reference>
+    </node>
+    <node>
+      <uri>sitemap</uri>
+      <name>sitemap</name>
+      <label>#{portal.classic.sitemap}</label>
+      <visibility>DISPLAYED</visibility>
+      <page-reference>portal::classic::sitemap</page-reference>
+    </node>
+    <node>
+      <uri>groupnavigation</uri>
+      <name>groupnavigation</name>
+      <label>#{portal.classic.groupnavigation}</label>
+      <visibility>SYSTEM</visibility>
+      <page-reference>portal::classic::groupnavigation</page-reference>
+    </node>
+  </page-nodes>
+</node-navigation>

Added: portal/trunk/component/portal/src/test/resources/portal/portal/system/pages.xml
===================================================================
--- portal/trunk/component/portal/src/test/resources/portal/portal/system/pages.xml	                        (rev 0)
+++ portal/trunk/component/portal/src/test/resources/portal/portal/system/pages.xml	2010-03-13 14:29:13 UTC (rev 2231)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+  ~ Copyright (C) 2009 eXo Platform SAS.
+  ~
+  ~ This is free software; you can redistribute it and/or modify it
+  ~ under the terms of the GNU Lesser General Public License as
+  ~ published by the Free Software Foundation; either version 2.1 of
+  ~ the License, or (at your option) any later version.
+  ~
+  ~ This software is distributed in the hope that it will be useful,
+  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  ~ Lesser General Public License for more details.
+  ~
+  ~ You should have received a copy of the GNU Lesser General Public
+  ~ License along with this software; if not, write to the Free
+  ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+  ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+  -->
+
+<page-set>  
+</page-set>

Added: portal/trunk/component/portal/src/test/resources/portal/portal/system/portal.xml
===================================================================
--- portal/trunk/component/portal/src/test/resources/portal/portal/system/portal.xml	                        (rev 0)
+++ portal/trunk/component/portal/src/test/resources/portal/portal/system/portal.xml	2010-03-13 14:29:13 UTC (rev 2231)
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+  ~ Copyright (C) 2009 eXo Platform SAS.
+  ~
+  ~ This is free software; you can redistribute it and/or modify it
+  ~ under the terms of the GNU Lesser General Public License as
+  ~ published by the Free Software Foundation; either version 2.1 of
+  ~ the License, or (at your option) any later version.
+  ~
+  ~ This software is distributed in the hope that it will be useful,
+  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  ~ Lesser General Public License for more details.
+  ~
+  ~ You should have received a copy of the GNU Lesser General Public
+  ~ License along with this software; if not, write to the Free
+  ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+  ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+  -->
+
+<portal-config>
+  <portal-name>system</portal-name>
+  <locale>en</locale>
+  <access-permissions>test_access_permissions</access-permissions>
+  <edit-permission>test_edit_permission</edit-permission>
+  <skin>test_skin</skin>
+  
+ 	<portal-layout>
+  </portal-layout>
+  
+</portal-config>



More information about the gatein-commits mailing list