* Add get child folder test

0.6.1-post-fixes
Justin Clarke Casey 2008-12-11 20:36:46 +00:00
parent a02efe6dcc
commit f23856a575
2 changed files with 44 additions and 0 deletions

View File

@ -106,6 +106,23 @@ namespace OpenSim.Framework.Communications.Cache
}
}
/// <summary>
/// Get a child folder
/// </summary>
/// <param name="folderID"></param>
/// <returns>The folder if it exists, null if it doesn't</returns>
public InventoryFolderImpl GetChildFolder(UUID folderID)
{
InventoryFolderImpl folder = null;
lock (SubFolders)
{
SubFolders.TryGetValue(folderID, out folder);
}
return folder;
}
/// <summary>
/// Removes the given child subfolder.
/// </summary>

View File

@ -112,5 +112,32 @@ namespace OpenSim.Framework.Communications.Tests
Assert.That(inventoryDataPlugin.getInventoryFolder(folderId), Is.Not.Null);
Assert.That(userInfo.RootFolder.SubFolders.ContainsKey(folderId), Is.True);
}
/// <summary>
/// Test retrieving a child folder
/// </summary>
[Test]
public void TestGetChildFolder()
{
UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000005");
CommunicationsManager commsManager = new TestCommunicationsManager();
LocalUserServices lus = (LocalUserServices)commsManager.UserService;
lus.AddPlugin(new TestUserDataPlugin());
((LocalInventoryService)commsManager.InventoryService).AddPlugin(new TestInventoryDataPlugin());
lus.AddUser("Bill", "Bailey", "troll", "bill@bailey.com", 1000, 1000, userId);
commsManager.UserProfileCacheService.RequestInventoryForUser(userId);
CachedUserInfo userInfo = commsManager.UserProfileCacheService.GetUserDetails(userId);
UUID folderId = UUID.Parse("00000000-0000-0000-0000-000000000011");
Assert.That(userInfo.RootFolder.GetChildFolder(folderId), Is.Null);
userInfo.CreateFolder("testFolder", folderId, (ushort)AssetType.Animation, userInfo.RootFolder.ID);
Assert.That(userInfo.RootFolder.GetChildFolder(folderId), Is.Not.Null);
}
}
}