* Fix my own unit test

* Disable folder iar creation code for now (though this wasn't actually causing the test failure)
GenericGridServerConcept
Justin Clarke Casey 2009-02-25 18:32:39 +00:00
parent 17a336f21f
commit 50dcd66896
2 changed files with 19 additions and 7 deletions

View File

@ -222,6 +222,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
item.Creator = m_userInfo.UserProfile.ID; item.Creator = m_userInfo.UserProfile.ID;
item.Owner = m_userInfo.UserProfile.ID; item.Owner = m_userInfo.UserProfile.ID;
/*
filePath = filePath.Substring(InventoryArchiveConstants.INVENTORY_PATH.Length); filePath = filePath.Substring(InventoryArchiveConstants.INVENTORY_PATH.Length);
string[] rawFolders = filePath.Split(new char[] { '/' }); string[] rawFolders = filePath.Split(new char[] { '/' });
@ -231,23 +232,33 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
InventoryFolderImpl foundFolder = rootDestinationFolder; InventoryFolderImpl foundFolder = rootDestinationFolder;
while (!noFolder && i < rawFolders.Length) while (!noFolder && i < rawFolders.Length)
{ {
foundFolder = foundFolder.FindFolderByPath(rawFolders[i]); InventoryFolderImpl folder = foundFolder.FindFolderByPath(rawFolders[i]);
if (null == foundFolder) if (null != folder)
noFolder = true; {
else m_log.DebugFormat("[INVENTORY ARCHIVER]: Found folder {0}", folder.Name);
foundFolder = folder;
i++; i++;
}
else
{
noFolder = true;
}
} }
// Create any folders that did not previously exist // Create any folders that did not previously exist
while (i < rawFolders.Length) while (i < rawFolders.Length)
{ {
foundFolder.CreateChildFolder(UUID.Random(), rawFolders[i++], (ushort)AssetType.Folder); m_log.DebugFormat("[INVENTORY ARCHIVER]: Creating folder {0}", rawFolders[i]);
foundFolder.CreateChildFolder(UUID.Random(), rawFolders[i++], (ushort)AssetType.Folder);
} }
// Reset folder ID to the one in which we want to load it // Reset folder ID to the one in which we want to load it
// TODO: Properly restore entire folder structure. At the moment all items are dumped in this // TODO: Properly restore entire folder structure. At the moment all items are dumped in this
// single folder no matter where in the saved folder structure they are. // single folder no matter where in the saved folder structure they are.
item.Folder = foundFolder.ID; item.Folder = foundFolder.ID;
*/
item.Folder = rootDestinationFolder.ID;
m_userInfo.AddItem(item); m_userInfo.AddItem(item);
successfulItemRestores++; successfulItemRestores++;

View File

@ -128,7 +128,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
bool gotObject1File = false; bool gotObject1File = false;
//bool gotObject2File = false; //bool gotObject2File = false;
string expectedObject1FilePath = string.Format( string expectedObject1FilePath = string.Format(
"{0}{1}_{2}.xml", "{0}{1}{2}_{3}.xml",
InventoryArchiveConstants.INVENTORY_PATH,
"Objects/", "Objects/",
item1.Name, item1.Name,
item1Id); item1Id);
@ -151,7 +152,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
gotControlFile = true; gotControlFile = true;
} }
*/ */
if (filePath.StartsWith("Objects/") && filePath.EndsWith(".xml")) if (filePath.StartsWith(InventoryArchiveConstants.INVENTORY_PATH) && filePath.EndsWith(".xml"))
{ {
//string fileName = filePath.Remove(0, "Objects/".Length); //string fileName = filePath.Remove(0, "Objects/".Length);