Created
July 7, 2011 10:24
-
-
Save vietj/1069258 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserNode.java b/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserNode.java | |
index d8eb31a..10a0445 100644 | |
--- a/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserNode.java | |
+++ b/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserNode.java | |
@@ -88,6 +88,7 @@ public class UserNode | |
public void setName(String name) | |
{ | |
+ uri = null; | |
context.setName(name); | |
} | |
diff --git a/component/portal/src/test/java/org/exoplatform/portal/mop/user/TestUserPortal.java b/component/portal/src/test/java/org/exoplatform/portal/mop/user/TestUserPortal.java | |
index 6fdde13..8dca369 100644 | |
--- a/component/portal/src/test/java/org/exoplatform/portal/mop/user/TestUserPortal.java | |
+++ b/component/portal/src/test/java/org/exoplatform/portal/mop/user/TestUserPortal.java | |
@@ -659,6 +659,67 @@ public class TestUserPortal extends AbstractPortalTest | |
}.execute("root"); | |
} | |
+ public void testBuildURI() | |
+ { | |
+ new UnitTest() | |
+ { | |
+ public void execute() throws Exception | |
+ { | |
+ storage_.create(new PortalConfig("portal", "usernode_URI")); | |
+ end(true); | |
+ | |
+ // | |
+ begin(); | |
+ Site site = mgr.getPOMService().getModel().getWorkspace().getSite(ObjectType.PORTAL_SITE, "usernode_URI"); | |
+ site.getRootNavigation().addChild("default"); | |
+ end(true); | |
+ | |
+ // | |
+ begin(); | |
+ UserPortalConfig userPortalCfg = userPortalConfigSer_.getUserPortalConfig("usernode_URI", getUserId()); | |
+ UserPortal userPortal = userPortalCfg.getUserPortal(); | |
+ UserNavigation navigation = userPortal.getNavigation(SiteKey.portal("usernode_URI")); | |
+ UserNode root = userPortal.getNode(navigation, Scope.ALL, null, null); | |
+ UserNode foo = root.addChild("foo"); | |
+ UserNode bar = root.addChild("bar"); | |
+ | |
+ assertEquals("foo", foo.getURI()); | |
+ assertEquals("bar", bar.getURI()); | |
+ userPortal.saveNode(root, null); | |
+ end(true); | |
+ | |
+ begin(); | |
+ //Move node --> change URI | |
+ foo.addChild(bar); | |
+ assertEquals("foo/bar", bar.getURI()); | |
+ | |
+ //Rename node --> URI should be changed too | |
+ bar.setName("bar2"); | |
+ assertEquals("foo/bar2", bar.getURI()); | |
+ | |
+ userPortal.saveNode(bar, null); | |
+ end(true); | |
+ | |
+ begin(); | |
+ UserNode root2 = userPortal.getNode(navigation, Scope.ALL, null, null); | |
+ UserNode foo2 = root2.getChild("foo"); | |
+ foo2.setName("foo2"); | |
+ | |
+ UserNode bar2 = foo2.getChild("bar2"); | |
+ root2.addChild(bar2); | |
+ | |
+ userPortal.saveNode(bar2, null); | |
+ end(true); | |
+ | |
+ begin(); | |
+ //Changes from other session : foo has been renamed, and bar has been moved | |
+ userPortal.updateNode(root, Scope.ALL, null); | |
+ assertEquals("foo2", foo.getURI()); | |
+ assertEquals("bar2", bar.getURI()); | |
+ } | |
+ }.execute("root"); | |
+ } | |
+ | |
public void testNodeExtension() | |
{ | |
new UnitTest() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment