aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Communications
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/Communications')
-rw-r--r--OpenSim/Framework/Communications/Cache/CachedUserInfo.cs15
-rw-r--r--OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs47
2 files changed, 45 insertions, 17 deletions
diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
index dcf63cc..a1b658f 100644
--- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
+++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
@@ -415,6 +415,12 @@ namespace OpenSim.Framework.Communications.Cache
415 415
416 if (m_hasReceivedInventory) 416 if (m_hasReceivedInventory)
417 { 417 {
418 InventoryFolderImpl folder = RootFolder.FindFolder(folderID);
419
420 // Delegate movement if updated parent id isn't the same as the existing parentId
421 if (folder.ParentID != parentID)
422 MoveFolder(folderID, parentID);
423
418 InventoryFolderBase baseFolder = new InventoryFolderBase(); 424 InventoryFolderBase baseFolder = new InventoryFolderBase();
419 baseFolder.Owner = m_userProfile.ID; 425 baseFolder.Owner = m_userProfile.ID;
420 baseFolder.ID = folderID; 426 baseFolder.ID = folderID;
@@ -432,13 +438,8 @@ namespace OpenSim.Framework.Communications.Cache
432 m_commsManager.InventoryService.UpdateFolder(baseFolder); 438 m_commsManager.InventoryService.UpdateFolder(baseFolder);
433 } 439 }
434 440
435 InventoryFolderImpl folder = RootFolder.FindFolder(folderID); 441 folder.Name = name;
436 if (folder != null) 442 folder.Type = (short)type;
437 {
438 folder.Name = name;
439 folder.Type = (short)type;
440 folder.ParentID = parentID;
441 }
442 } 443 }
443 else 444 else
444 { 445 {
diff --git a/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs b/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs
index 41c8e3c..807afcc 100644
--- a/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs
+++ b/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs
@@ -142,17 +142,44 @@ namespace OpenSim.Framework.Communications.Tests
142 userInfo.CreateFolder("folder1", folder1Id, (ushort)AssetType.Animation, rootFolder.ID); 142 userInfo.CreateFolder("folder1", folder1Id, (ushort)AssetType.Animation, rootFolder.ID);
143 143
144 // 1: Test updates that don't involve moving the folder 144 // 1: Test updates that don't involve moving the folder
145 string newFolderName1 = "newFolderName1"; 145 {
146 ushort folderType1 = (ushort)AssetType.Texture; 146 string newFolderName1 = "newFolderName1";
147 userInfo.UpdateFolder(newFolderName1, folder1Id, folderType1, rootFolder.ID); 147 ushort folderType1 = (ushort)AssetType.Texture;
148 148 userInfo.UpdateFolder(newFolderName1, folder1Id, folderType1, rootFolder.ID);
149 InventoryFolderImpl folder1 = rootFolder.GetChildFolder(folder1Id); 149
150 Assert.That(newFolderName1, Is.EqualTo(folder1.Name)); 150 InventoryFolderImpl folder1 = rootFolder.GetChildFolder(folder1Id);
151 Assert.That(folderType1, Is.EqualTo((ushort)folder1.Type)); 151 Assert.That(newFolderName1, Is.EqualTo(folder1.Name));
152 Assert.That(folderType1, Is.EqualTo((ushort)folder1.Type));
153
154 InventoryFolderBase dataFolder1 = inventoryDataPlugin.getInventoryFolder(folder1Id);
155 Assert.That(newFolderName1, Is.EqualTo(dataFolder1.Name));
156 Assert.That(folderType1, Is.EqualTo((ushort)dataFolder1.Type));
157 }
158
159 // 2: Test an update that also involves moving the folder
160 {
161 UUID folder2Id = UUID.Parse("00000000-0000-0000-0000-000000000061");
162 userInfo.CreateFolder("folder2", folder2Id, (ushort)AssetType.Animation, rootFolder.ID);
163 InventoryFolderImpl folder2 = rootFolder.GetChildFolder(folder2Id);
164
165 string newFolderName2 = "newFolderName2";
166 ushort folderType2 = (ushort)AssetType.Bodypart;
167 userInfo.UpdateFolder(newFolderName2, folder1Id, folderType2, folder2Id);
168
169 InventoryFolderImpl folder1 = folder2.GetChildFolder(folder1Id);
170 Assert.That(newFolderName2, Is.EqualTo(folder1.Name));
171 Assert.That(folderType2, Is.EqualTo((ushort)folder1.Type));
172 Assert.That(folder2Id, Is.EqualTo(folder1.ParentID));
173
174 Assert.That(folder2.ContainsChildFolder(folder1Id), Is.True);
175 Assert.That(rootFolder.ContainsChildFolder(folder1Id), Is.False);
176
177 InventoryFolderBase dataFolder1 = inventoryDataPlugin.getInventoryFolder(folder1Id);
178 Assert.That(newFolderName2, Is.EqualTo(dataFolder1.Name));
179 Assert.That(folderType2, Is.EqualTo((ushort)dataFolder1.Type));
180 Assert.That(folder2Id, Is.EqualTo(dataFolder1.ParentID));
181 }
152 182
153 InventoryFolderBase dataFolder1 = inventoryDataPlugin.getInventoryFolder(folder1Id);
154 Assert.That(newFolderName1, Is.EqualTo(dataFolder1.Name));
155 Assert.That(folderType1, Is.EqualTo((ushort)dataFolder1.Type));
156 } 183 }
157 184
158 /// <summary> 185 /// <summary>