aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-12-12 20:43:42 +0000
committerJustin Clarke Casey2008-12-12 20:43:42 +0000
commitb1f018aa2600281cc379128f17c3c141b478f39d (patch)
treeb7830bc43f57acd44e98b02c57d2ac2cc368bd18 /OpenSim
parent* Actually add the new user profile cache tests to the bamboo ci build (diff)
downloadopensim-SC_OLD-b1f018aa2600281cc379128f17c3c141b478f39d.zip
opensim-SC_OLD-b1f018aa2600281cc379128f17c3c141b478f39d.tar.gz
opensim-SC_OLD-b1f018aa2600281cc379128f17c3c141b478f39d.tar.bz2
opensim-SC_OLD-b1f018aa2600281cc379128f17c3c141b478f39d.tar.xz
* Create update folder test
* Correct small logic elidation
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/Communications/Cache/CachedUserInfo.cs1
-rw-r--r--OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs32
-rw-r--r--OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs7
3 files changed, 38 insertions, 2 deletions
diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
index 80fd1ae..dcf63cc 100644
--- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
+++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
@@ -436,6 +436,7 @@ namespace OpenSim.Framework.Communications.Cache
436 if (folder != null) 436 if (folder != null)
437 { 437 {
438 folder.Name = name; 438 folder.Name = name;
439 folder.Type = (short)type;
439 folder.ParentID = parentID; 440 folder.ParentID = parentID;
440 } 441 }
441 } 442 }
diff --git a/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs b/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs
index 0914bfb..41c8e3c 100644
--- a/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs
+++ b/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs
@@ -122,6 +122,38 @@ namespace OpenSim.Framework.Communications.Tests
122 Assert.That(inventoryDataPlugin.getInventoryFolder(folderId), Is.Not.Null); 122 Assert.That(inventoryDataPlugin.getInventoryFolder(folderId), Is.Not.Null);
123 Assert.That(userInfo.RootFolder.ContainsChildFolder(folderId), Is.True); 123 Assert.That(userInfo.RootFolder.ContainsChildFolder(folderId), Is.True);
124 } 124 }
125
126 /// <summary>
127 /// Test updating a folder
128 /// </summary>
129 [Test]
130 public void TestUpdateFolder()
131 {
132 IUserDataPlugin userDataPlugin = new TestUserDataPlugin();
133 IInventoryDataPlugin inventoryDataPlugin = new TestInventoryDataPlugin();
134
135 CommunicationsManager commsManager
136 = UserProfileTestUtils.SetupServices(userDataPlugin, inventoryDataPlugin);
137 CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager);
138
139 UUID folder1Id = UUID.Parse("00000000-0000-0000-0000-000000000060");
140 InventoryFolderImpl rootFolder = userInfo.RootFolder;
141
142 userInfo.CreateFolder("folder1", folder1Id, (ushort)AssetType.Animation, rootFolder.ID);
143
144 // 1: Test updates that don't involve moving the folder
145 string newFolderName1 = "newFolderName1";
146 ushort folderType1 = (ushort)AssetType.Texture;
147 userInfo.UpdateFolder(newFolderName1, folder1Id, folderType1, rootFolder.ID);
148
149 InventoryFolderImpl folder1 = rootFolder.GetChildFolder(folder1Id);
150 Assert.That(newFolderName1, Is.EqualTo(folder1.Name));
151 Assert.That(folderType1, Is.EqualTo((ushort)folder1.Type));
152
153 InventoryFolderBase dataFolder1 = inventoryDataPlugin.getInventoryFolder(folder1Id);
154 Assert.That(newFolderName1, Is.EqualTo(dataFolder1.Name));
155 Assert.That(folderType1, Is.EqualTo((ushort)dataFolder1.Type));
156 }
125 157
126 /// <summary> 158 /// <summary>
127 /// Test moving an inventory folder 159 /// Test moving an inventory folder
diff --git a/OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs b/OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs
index 808c212..8e19aec 100644
--- a/OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs
+++ b/OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs
@@ -122,12 +122,15 @@ namespace OpenSim.Tests.Common.Mock
122 m_rootFolders[folder.Owner] = folder; 122 m_rootFolders[folder.Owner] = folder;
123 } 123 }
124 124
125 public void updateInventoryFolder(InventoryFolderBase folder) {} 125 public void updateInventoryFolder(InventoryFolderBase folder)
126 {
127 m_folders[folder.ID] = folder;
128 }
126 129
127 public void moveInventoryFolder(InventoryFolderBase folder) 130 public void moveInventoryFolder(InventoryFolderBase folder)
128 { 131 {
129 // Simple replace 132 // Simple replace
130 m_folders[folder.ID] = folder; 133 updateInventoryFolder(folder);
131 } 134 }
132 135
133 public void deleteInventoryFolder(UUID folderId) 136 public void deleteInventoryFolder(UUID folderId)