diff options
author | Justin Clarke Casey | 2008-12-11 20:36:46 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-12-11 20:36:46 +0000 |
commit | f23856a575bf6c72de56a1eee60eca72f1724df0 (patch) | |
tree | 718c0825cae4a9ba99b799363e64ce3aa45d8b7f /OpenSim | |
parent | after much discussion, and overwhelming +1 on the -dev list, switch the (diff) | |
download | opensim-SC-f23856a575bf6c72de56a1eee60eca72f1724df0.zip opensim-SC-f23856a575bf6c72de56a1eee60eca72f1724df0.tar.gz opensim-SC-f23856a575bf6c72de56a1eee60eca72f1724df0.tar.bz2 opensim-SC-f23856a575bf6c72de56a1eee60eca72f1724df0.tar.xz |
* Add get child folder test
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Framework/Communications/Cache/InventoryFolderImpl.cs | 17 | ||||
-rw-r--r-- | OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs | 27 |
2 files changed, 44 insertions, 0 deletions
diff --git a/OpenSim/Framework/Communications/Cache/InventoryFolderImpl.cs b/OpenSim/Framework/Communications/Cache/InventoryFolderImpl.cs index ad55c44..933d40a 100644 --- a/OpenSim/Framework/Communications/Cache/InventoryFolderImpl.cs +++ b/OpenSim/Framework/Communications/Cache/InventoryFolderImpl.cs | |||
@@ -107,6 +107,23 @@ namespace OpenSim.Framework.Communications.Cache | |||
107 | } | 107 | } |
108 | 108 | ||
109 | /// <summary> | 109 | /// <summary> |
110 | /// Get a child folder | ||
111 | /// </summary> | ||
112 | /// <param name="folderID"></param> | ||
113 | /// <returns>The folder if it exists, null if it doesn't</returns> | ||
114 | public InventoryFolderImpl GetChildFolder(UUID folderID) | ||
115 | { | ||
116 | InventoryFolderImpl folder = null; | ||
117 | |||
118 | lock (SubFolders) | ||
119 | { | ||
120 | SubFolders.TryGetValue(folderID, out folder); | ||
121 | } | ||
122 | |||
123 | return folder; | ||
124 | } | ||
125 | |||
126 | /// <summary> | ||
110 | /// Removes the given child subfolder. | 127 | /// Removes the given child subfolder. |
111 | /// </summary> | 128 | /// </summary> |
112 | /// <param name="folderID"></param> | 129 | /// <param name="folderID"></param> |
diff --git a/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs b/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs index d73d3d5..f209fd4 100644 --- a/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs +++ b/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs | |||
@@ -112,5 +112,32 @@ namespace OpenSim.Framework.Communications.Tests | |||
112 | Assert.That(inventoryDataPlugin.getInventoryFolder(folderId), Is.Not.Null); | 112 | Assert.That(inventoryDataPlugin.getInventoryFolder(folderId), Is.Not.Null); |
113 | Assert.That(userInfo.RootFolder.SubFolders.ContainsKey(folderId), Is.True); | 113 | Assert.That(userInfo.RootFolder.SubFolders.ContainsKey(folderId), Is.True); |
114 | } | 114 | } |
115 | |||
116 | /// <summary> | ||
117 | /// Test retrieving a child folder | ||
118 | /// </summary> | ||
119 | [Test] | ||
120 | public void TestGetChildFolder() | ||
121 | { | ||
122 | UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000005"); | ||
123 | |||
124 | CommunicationsManager commsManager = new TestCommunicationsManager(); | ||
125 | LocalUserServices lus = (LocalUserServices)commsManager.UserService; | ||
126 | lus.AddPlugin(new TestUserDataPlugin()); | ||
127 | ((LocalInventoryService)commsManager.InventoryService).AddPlugin(new TestInventoryDataPlugin()); | ||
128 | |||
129 | lus.AddUser("Bill", "Bailey", "troll", "bill@bailey.com", 1000, 1000, userId); | ||
130 | |||
131 | commsManager.UserProfileCacheService.RequestInventoryForUser(userId); | ||
132 | |||
133 | CachedUserInfo userInfo = commsManager.UserProfileCacheService.GetUserDetails(userId); | ||
134 | |||
135 | UUID folderId = UUID.Parse("00000000-0000-0000-0000-000000000011"); | ||
136 | |||
137 | Assert.That(userInfo.RootFolder.GetChildFolder(folderId), Is.Null); | ||
138 | userInfo.CreateFolder("testFolder", folderId, (ushort)AssetType.Animation, userInfo.RootFolder.ID); | ||
139 | |||
140 | Assert.That(userInfo.RootFolder.GetChildFolder(folderId), Is.Not.Null); | ||
141 | } | ||
115 | } | 142 | } |
116 | } | 143 | } |