* Create update folder test

* Correct small logic elidation
0.6.1-post-fixes
Justin Clarke Casey 2008-12-12 20:43:42 +00:00
parent 6c83702f15
commit b1f018aa26
3 changed files with 38 additions and 2 deletions

View File

@ -436,6 +436,7 @@ namespace OpenSim.Framework.Communications.Cache
if (folder != null)
{
folder.Name = name;
folder.Type = (short)type;
folder.ParentID = parentID;
}
}

View File

@ -123,6 +123,38 @@ namespace OpenSim.Framework.Communications.Tests
Assert.That(userInfo.RootFolder.ContainsChildFolder(folderId), Is.True);
}
/// <summary>
/// Test updating a folder
/// </summary>
[Test]
public void TestUpdateFolder()
{
IUserDataPlugin userDataPlugin = new TestUserDataPlugin();
IInventoryDataPlugin inventoryDataPlugin = new TestInventoryDataPlugin();
CommunicationsManager commsManager
= UserProfileTestUtils.SetupServices(userDataPlugin, inventoryDataPlugin);
CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager);
UUID folder1Id = UUID.Parse("00000000-0000-0000-0000-000000000060");
InventoryFolderImpl rootFolder = userInfo.RootFolder;
userInfo.CreateFolder("folder1", folder1Id, (ushort)AssetType.Animation, rootFolder.ID);
// 1: Test updates that don't involve moving the folder
string newFolderName1 = "newFolderName1";
ushort folderType1 = (ushort)AssetType.Texture;
userInfo.UpdateFolder(newFolderName1, folder1Id, folderType1, rootFolder.ID);
InventoryFolderImpl folder1 = rootFolder.GetChildFolder(folder1Id);
Assert.That(newFolderName1, Is.EqualTo(folder1.Name));
Assert.That(folderType1, Is.EqualTo((ushort)folder1.Type));
InventoryFolderBase dataFolder1 = inventoryDataPlugin.getInventoryFolder(folder1Id);
Assert.That(newFolderName1, Is.EqualTo(dataFolder1.Name));
Assert.That(folderType1, Is.EqualTo((ushort)dataFolder1.Type));
}
/// <summary>
/// Test moving an inventory folder
/// </summary>

View File

@ -122,12 +122,15 @@ namespace OpenSim.Tests.Common.Mock
m_rootFolders[folder.Owner] = folder;
}
public void updateInventoryFolder(InventoryFolderBase folder) {}
public void updateInventoryFolder(InventoryFolderBase folder)
{
m_folders[folder.ID] = folder;
}
public void moveInventoryFolder(InventoryFolderBase folder)
{
// Simple replace
m_folders[folder.ID] = folder;
updateInventoryFolder(folder);
}
public void deleteInventoryFolder(UUID folderId)