Author: hoang_to
Date: 2010-09-01 00:45:58 -0400 (Wed, 01 Sep 2010)
New Revision: 3998
Modified:
portal/branches/branched-r3845/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java
Log:
GTNPORTAL-1313: Update JUnit test
Modified:
portal/branches/branched-r3845/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java
===================================================================
---
portal/branches/branched-r3845/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java 2010-09-01
04:43:19 UTC (rev 3997)
+++
portal/branches/branched-r3845/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java 2010-09-01
04:45:58 UTC (rev 3998)
@@ -216,6 +216,56 @@
assertEquals(true, page2.isShowMaxWindow());
}
+ public void testRenameNode() throws Exception
+ {
+ //Create node
+ PageNode pageNode = new PageNode();
+ String name = "MyPageNode";
+ pageNode.setName(name);
+ pageNode.setUri(name);
+ pageNode.setLabel(name);
+
+ //add node to page navigation
+ String ownerId = "root";
+ String ownerType = "user";
+ PageNavigation nav = storage_.getPageNavigation(ownerType, ownerId);
+ assertNotNull(nav);
+ assertEquals(ownerId, nav.getOwnerId());
+ assertEquals(ownerType, nav.getOwnerType());
+ nav.addNode(pageNode);
+ storage_.save(nav);
+
+ //Rename node
+ PageNavigation nav2 = storage_.getPageNavigation(ownerType, ownerId);
+ assertNotNull(nav2);
+ assertEquals(ownerId, nav2.getOwnerId());
+ assertEquals(ownerType, nav2.getOwnerType());
+
+ PageNode pageNode2 = nav2.getNode(name);
+ assertNotNull(pageNode2);
+ assertEquals(name, pageNode2.getName());
+ assertEquals(name, pageNode2.getLabel());
+ assertEquals(name, pageNode2.getUri());
+
+ String newName = "NewMyPageNode";
+ pageNode2.setName(newName);
+ pageNode2.setUri(newName);
+ pageNode2.setLabel(newName);
+ storage_.save(nav2);
+
+ //Get and compare
+ PageNavigation nav3 = storage_.getPageNavigation(ownerType, ownerId);
+ assertNotNull(nav3);
+ assertEquals(ownerId, nav3.getOwnerId());
+ assertEquals(ownerType, nav3.getOwnerType());
+
+ PageNode pageNode3 = nav3.getNode(newName);
+ assertNotNull(pageNode3);
+ assertEquals(newName, pageNode3.getName());
+ assertEquals(newName, pageNode3.getLabel());
+ assertEquals(newName, pageNode3.getUri());
+ }
+
public void testChangingPortletThemeInPage() throws Exception {
Page page;
Application<?> app;