Fixed ETHREEOH-1719: Renaming 'Web Project' makes it a DM space and the AVMstore gets corrupted

- An injected list of namespaces determine whether a node's association path QName is modified
   during a rename or not:
      <property name="systemNamespaces">
         <list>
            <value>http://www.alfresco.org/model/application/1.0</value>
            <value>http://www.alfresco.org/model/site/1.0</value>
         </list>
      </property>

 - Added a method to FileFolderService to specify the association QName on creation
   This is used by the tests, but can be used by apps as well.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@14262 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2009-05-11 12:04:55 +00:00
parent db96926f4b
commit 4ed216c5e6
4 changed files with 94 additions and 10 deletions

View File

@@ -299,6 +299,35 @@ public class FileFolderServiceImplTest extends TestCase
assertNotNull("Folder info for new name is not present", checkInfo);
}
public void testRenameWithoutAssocQNameChange() throws Exception
{
FileInfo folderInfo = getByName(NAME_L0_FOLDER_A, true);
assertNotNull(folderInfo);
NodeRef folderNodeRef = folderInfo.getNodeRef();
// Create a child file
QName assocQName = QName.createQName(NamespaceService.APP_MODEL_1_0_URI, "abc");
NodeRef newFileNodeRef = fileFolderService.create(
folderNodeRef,
"AnotherFile.txt",
ContentModel.TYPE_CONTENT,
assocQName).getNodeRef();
// Make sure that the correct association QName was used
QName checkQName = nodeService.getPrimaryParent(newFileNodeRef).getQName();
assertEquals(
"The given assoc QName was not used for the path",
assocQName,
checkQName);
// Rename
String newName = "AnotherFile-new.txt";
folderInfo = fileFolderService.rename(newFileNodeRef, newName);
// Make sure that the association QName did not change
checkQName = nodeService.getPrimaryParent(newFileNodeRef).getQName();
assertEquals(
"The given assoc QName was not used for the path after a rename",
assocQName,
nodeService.getPrimaryParent(newFileNodeRef).getQName());
}
public void testRenameDuplicate() throws Exception
{
FileInfo folderInfo = getByName(NAME_L0_FOLDER_A, true);