aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Communications
diff options
context:
space:
mode:
authorMike Mazur2009-02-03 05:20:26 +0000
committerMike Mazur2009-02-03 05:20:26 +0000
commit9377c6f2b28c75a093fa554d64e0d63e6bdf2fa5 (patch)
tree8dbd671990b4d6c5a40d369b0d026df8851b3e1f /OpenSim/Framework/Communications
parent- move IAssetDataPlugin from OpenSim/Framework/IAssetProvider.cs to (diff)
downloadopensim-SC-9377c6f2b28c75a093fa554d64e0d63e6bdf2fa5.zip
opensim-SC-9377c6f2b28c75a093fa554d64e0d63e6bdf2fa5.tar.gz
opensim-SC-9377c6f2b28c75a093fa554d64e0d63e6bdf2fa5.tar.bz2
opensim-SC-9377c6f2b28c75a093fa554d64e0d63e6bdf2fa5.tar.xz
- move OpenSim/Framework/IInventoryData.cs to
OpenSim/Data/IInventoryData.cs - trim trailing whitespace
Diffstat (limited to 'OpenSim/Framework/Communications')
-rw-r--r--OpenSim/Framework/Communications/InventoryServiceBase.cs6
-rw-r--r--OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs111
2 files changed, 60 insertions, 57 deletions
diff --git a/OpenSim/Framework/Communications/InventoryServiceBase.cs b/OpenSim/Framework/Communications/InventoryServiceBase.cs
index 7a44420..ec5c493 100644
--- a/OpenSim/Framework/Communications/InventoryServiceBase.cs
+++ b/OpenSim/Framework/Communications/InventoryServiceBase.cs
@@ -33,6 +33,8 @@ using System.Threading;
33using OpenMetaverse; 33using OpenMetaverse;
34using log4net; 34using log4net;
35 35
36using OpenSim.Data;
37
36namespace OpenSim.Framework.Communications 38namespace OpenSim.Framework.Communications
37{ 39{
38 /// <summary> 40 /// <summary>
@@ -50,12 +52,12 @@ namespace OpenSim.Framework.Communications
50 /// <summary> 52 /// <summary>
51 /// Add a new inventory data plugin - plugins will be requested in the order they were added. 53 /// Add a new inventory data plugin - plugins will be requested in the order they were added.
52 /// </summary> 54 /// </summary>
53 /// <param name="plugin">The plugin that will provide data</param> 55 /// <param name="plugin">The plugin that will provide data</param>
54 public void AddPlugin(IInventoryDataPlugin plugin) 56 public void AddPlugin(IInventoryDataPlugin plugin)
55 { 57 {
56 m_plugins.Add(plugin); 58 m_plugins.Add(plugin);
57 } 59 }
58 60
59 /// <summary> 61 /// <summary>
60 /// Adds a new inventory data plugin - plugins will be requested in the order they were loaded. 62 /// Adds a new inventory data plugin - plugins will be requested in the order they were loaded.
61 /// </summary> 63 /// </summary>
diff --git a/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs b/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs
index 827a03b..86d85b1 100644
--- a/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs
+++ b/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs
@@ -30,19 +30,20 @@ using log4net;
30using NUnit.Framework; 30using NUnit.Framework;
31using NUnit.Framework.SyntaxHelpers; 31using NUnit.Framework.SyntaxHelpers;
32using OpenMetaverse; 32using OpenMetaverse;
33using OpenSim.Framework; 33//using OpenSim.Framework;
34using OpenSim.Framework.Communications.Cache; 34using OpenSim.Framework.Communications.Cache;
35using OpenSim.Region.Communications.Local; 35using OpenSim.Region.Communications.Local;
36using OpenSim.Tests.Common.Mock; 36using OpenSim.Tests.Common.Mock;
37using OpenSim.Data;
37 38
38namespace OpenSim.Framework.Communications.Tests 39namespace OpenSim.Framework.Communications.Tests
39{ 40{
40 /// <summary> 41 /// <summary>
41 /// User profile cache service tests 42 /// User profile cache service tests
42 /// </summary> 43 /// </summary>
43 [TestFixture] 44 [TestFixture]
44 public class UserProfileCacheServiceTests 45 public class UserProfileCacheServiceTests
45 { 46 {
46 /// <summary> 47 /// <summary>
47 /// Test user details get. 48 /// Test user details get.
48 /// </summary> 49 /// </summary>
@@ -51,17 +52,17 @@ namespace OpenSim.Framework.Communications.Tests
51 { 52 {
52 UUID nonExistingUserId = UUID.Parse("00000000-0000-0000-0000-000000000001"); 53 UUID nonExistingUserId = UUID.Parse("00000000-0000-0000-0000-000000000001");
53 UUID existingUserId = UUID.Parse("00000000-0000-0000-0000-000000000002"); 54 UUID existingUserId = UUID.Parse("00000000-0000-0000-0000-000000000002");
54 55
55 TestCommunicationsManager commsManager = new TestCommunicationsManager(); 56 TestCommunicationsManager commsManager = new TestCommunicationsManager();
56 CachedUserInfo existingUserInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager, existingUserId); 57 CachedUserInfo existingUserInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager, existingUserId);
57 58
58 Assert.That(existingUserInfo, Is.Not.Null, "Existing user info unexpectedly not found"); 59 Assert.That(existingUserInfo, Is.Not.Null, "Existing user info unexpectedly not found");
59 60
60 CachedUserInfo nonExistingUserInfo = commsManager.UserProfileCacheService.GetUserDetails(nonExistingUserId); 61 CachedUserInfo nonExistingUserInfo = commsManager.UserProfileCacheService.GetUserDetails(nonExistingUserId);
61 62
62 Assert.That(nonExistingUserInfo, Is.Null, "Non existing user info unexpectedly found"); 63 Assert.That(nonExistingUserInfo, Is.Null, "Non existing user info unexpectedly found");
63 } 64 }
64 65
65 /// <summary> 66 /// <summary>
66 /// Test requesting inventory for a user 67 /// Test requesting inventory for a user
67 /// </summary> 68 /// </summary>
@@ -69,11 +70,11 @@ namespace OpenSim.Framework.Communications.Tests
69 public void TestRequestInventoryForUser() 70 public void TestRequestInventoryForUser()
70 { 71 {
71 TestCommunicationsManager commsManager = new TestCommunicationsManager(); 72 TestCommunicationsManager commsManager = new TestCommunicationsManager();
72 CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager); 73 CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager);
73 74
74 Assert.That(userInfo.HasReceivedInventory, Is.True); 75 Assert.That(userInfo.HasReceivedInventory, Is.True);
75 } 76 }
76 77
77 /// <summary> 78 /// <summary>
78 /// Test retrieving a child folder 79 /// Test retrieving a child folder
79 /// </summary> 80 /// </summary>
@@ -82,45 +83,45 @@ namespace OpenSim.Framework.Communications.Tests
82 { 83 {
83 TestCommunicationsManager commsManager = new TestCommunicationsManager(); 84 TestCommunicationsManager commsManager = new TestCommunicationsManager();
84 CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager); 85 CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager);
85 86
86 UUID folderId = UUID.Parse("00000000-0000-0000-0000-000000000011"); 87 UUID folderId = UUID.Parse("00000000-0000-0000-0000-000000000011");
87 88
88 Assert.That(userInfo.RootFolder.GetChildFolder(folderId), Is.Null); 89 Assert.That(userInfo.RootFolder.GetChildFolder(folderId), Is.Null);
89 userInfo.CreateFolder("testFolder", folderId, (ushort)AssetType.Animation, userInfo.RootFolder.ID); 90 userInfo.CreateFolder("testFolder", folderId, (ushort)AssetType.Animation, userInfo.RootFolder.ID);
90 91
91 Assert.That(userInfo.RootFolder.GetChildFolder(folderId), Is.Not.Null); 92 Assert.That(userInfo.RootFolder.GetChildFolder(folderId), Is.Not.Null);
92 } 93 }
93 94
94 /// <summary> 95 /// <summary>
95 /// Test creating an inventory folder 96 /// Test creating an inventory folder
96 /// </summary> 97 /// </summary>
97 [Test] 98 [Test]
98 public void TestCreateFolder() 99 public void TestCreateFolder()
99 { 100 {
100 TestCommunicationsManager commsManager = new TestCommunicationsManager(); 101 TestCommunicationsManager commsManager = new TestCommunicationsManager();
101 IInventoryDataPlugin inventoryDataPlugin = commsManager.InventoryDataPlugin; 102 IInventoryDataPlugin inventoryDataPlugin = commsManager.InventoryDataPlugin;
102 103
103 CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager); 104 CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager);
104 105
105 UUID folderId = UUID.Parse("00000000-0000-0000-0000-000000000010"); 106 UUID folderId = UUID.Parse("00000000-0000-0000-0000-000000000010");
106 Assert.That(userInfo.RootFolder.ContainsChildFolder(folderId), Is.False); 107 Assert.That(userInfo.RootFolder.ContainsChildFolder(folderId), Is.False);
107 108
108 // 1: Try a folder create that should fail because the parent id given does not exist 109 // 1: Try a folder create that should fail because the parent id given does not exist
109 UUID missingFolderId = UUID.Random(); 110 UUID missingFolderId = UUID.Random();
110 111
111 Assert.That( 112 Assert.That(
112 userInfo.CreateFolder("testFolder1", folderId, (ushort)AssetType.Animation, missingFolderId), Is.False); 113 userInfo.CreateFolder("testFolder1", folderId, (ushort)AssetType.Animation, missingFolderId), Is.False);
113 Assert.That(inventoryDataPlugin.getInventoryFolder(folderId), Is.Null); 114 Assert.That(inventoryDataPlugin.getInventoryFolder(folderId), Is.Null);
114 Assert.That(userInfo.RootFolder.ContainsChildFolder(missingFolderId), Is.False); 115 Assert.That(userInfo.RootFolder.ContainsChildFolder(missingFolderId), Is.False);
115 Assert.That(userInfo.RootFolder.FindFolder(folderId), Is.Null); 116 Assert.That(userInfo.RootFolder.FindFolder(folderId), Is.Null);
116 117
117 // 2: Try a folder create that should work 118 // 2: Try a folder create that should work
118 Assert.That( 119 Assert.That(
119 userInfo.CreateFolder("testFolder2", folderId, (ushort)AssetType.Animation, userInfo.RootFolder.ID), Is.True); 120 userInfo.CreateFolder("testFolder2", folderId, (ushort)AssetType.Animation, userInfo.RootFolder.ID), Is.True);
120 Assert.That(inventoryDataPlugin.getInventoryFolder(folderId), Is.Not.Null); 121 Assert.That(inventoryDataPlugin.getInventoryFolder(folderId), Is.Not.Null);
121 Assert.That(userInfo.RootFolder.ContainsChildFolder(folderId), Is.True); 122 Assert.That(userInfo.RootFolder.ContainsChildFolder(folderId), Is.True);
122 } 123 }
123 124
124 /// <summary> 125 /// <summary>
125 /// Test updating a folder 126 /// Test updating a folder
126 /// </summary> 127 /// </summary>
@@ -129,54 +130,54 @@ namespace OpenSim.Framework.Communications.Tests
129 { 130 {
130 TestCommunicationsManager commsManager = new TestCommunicationsManager(); 131 TestCommunicationsManager commsManager = new TestCommunicationsManager();
131 IInventoryDataPlugin inventoryDataPlugin = commsManager.InventoryDataPlugin; 132 IInventoryDataPlugin inventoryDataPlugin = commsManager.InventoryDataPlugin;
132 133
133 CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager); 134 CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager);
134 135
135 UUID folder1Id = UUID.Parse("00000000-0000-0000-0000-000000000060"); 136 UUID folder1Id = UUID.Parse("00000000-0000-0000-0000-000000000060");
136 InventoryFolderImpl rootFolder = userInfo.RootFolder; 137 InventoryFolderImpl rootFolder = userInfo.RootFolder;
137 138
138 userInfo.CreateFolder("folder1", folder1Id, (ushort)AssetType.Animation, rootFolder.ID); 139 userInfo.CreateFolder("folder1", folder1Id, (ushort)AssetType.Animation, rootFolder.ID);
139 140
140 // 1: Test updates that don't involve moving the folder 141 // 1: Test updates that don't involve moving the folder
141 { 142 {
142 string newFolderName1 = "newFolderName1"; 143 string newFolderName1 = "newFolderName1";
143 ushort folderType1 = (ushort)AssetType.Texture; 144 ushort folderType1 = (ushort)AssetType.Texture;
144 userInfo.UpdateFolder(newFolderName1, folder1Id, folderType1, rootFolder.ID); 145 userInfo.UpdateFolder(newFolderName1, folder1Id, folderType1, rootFolder.ID);
145 146
146 InventoryFolderImpl folder1 = rootFolder.GetChildFolder(folder1Id); 147 InventoryFolderImpl folder1 = rootFolder.GetChildFolder(folder1Id);
147 Assert.That(newFolderName1, Is.EqualTo(folder1.Name)); 148 Assert.That(newFolderName1, Is.EqualTo(folder1.Name));
148 Assert.That(folderType1, Is.EqualTo((ushort)folder1.Type)); 149 Assert.That(folderType1, Is.EqualTo((ushort)folder1.Type));
149 150
150 InventoryFolderBase dataFolder1 = inventoryDataPlugin.getInventoryFolder(folder1Id); 151 InventoryFolderBase dataFolder1 = inventoryDataPlugin.getInventoryFolder(folder1Id);
151 Assert.That(newFolderName1, Is.EqualTo(dataFolder1.Name)); 152 Assert.That(newFolderName1, Is.EqualTo(dataFolder1.Name));
152 Assert.That(folderType1, Is.EqualTo((ushort)dataFolder1.Type)); 153 Assert.That(folderType1, Is.EqualTo((ushort)dataFolder1.Type));
153 } 154 }
154 155
155 // 2: Test an update that also involves moving the folder 156 // 2: Test an update that also involves moving the folder
156 { 157 {
157 UUID folder2Id = UUID.Parse("00000000-0000-0000-0000-000000000061"); 158 UUID folder2Id = UUID.Parse("00000000-0000-0000-0000-000000000061");
158 userInfo.CreateFolder("folder2", folder2Id, (ushort)AssetType.Animation, rootFolder.ID); 159 userInfo.CreateFolder("folder2", folder2Id, (ushort)AssetType.Animation, rootFolder.ID);
159 InventoryFolderImpl folder2 = rootFolder.GetChildFolder(folder2Id); 160 InventoryFolderImpl folder2 = rootFolder.GetChildFolder(folder2Id);
160 161
161 string newFolderName2 = "newFolderName2"; 162 string newFolderName2 = "newFolderName2";
162 ushort folderType2 = (ushort)AssetType.Bodypart; 163 ushort folderType2 = (ushort)AssetType.Bodypart;
163 userInfo.UpdateFolder(newFolderName2, folder1Id, folderType2, folder2Id); 164 userInfo.UpdateFolder(newFolderName2, folder1Id, folderType2, folder2Id);
164 165
165 InventoryFolderImpl folder1 = folder2.GetChildFolder(folder1Id); 166 InventoryFolderImpl folder1 = folder2.GetChildFolder(folder1Id);
166 Assert.That(newFolderName2, Is.EqualTo(folder1.Name)); 167 Assert.That(newFolderName2, Is.EqualTo(folder1.Name));
167 Assert.That(folderType2, Is.EqualTo((ushort)folder1.Type)); 168 Assert.That(folderType2, Is.EqualTo((ushort)folder1.Type));
168 Assert.That(folder2Id, Is.EqualTo(folder1.ParentID)); 169 Assert.That(folder2Id, Is.EqualTo(folder1.ParentID));
169 170
170 Assert.That(folder2.ContainsChildFolder(folder1Id), Is.True); 171 Assert.That(folder2.ContainsChildFolder(folder1Id), Is.True);
171 Assert.That(rootFolder.ContainsChildFolder(folder1Id), Is.False); 172 Assert.That(rootFolder.ContainsChildFolder(folder1Id), Is.False);
172 173
173 InventoryFolderBase dataFolder1 = inventoryDataPlugin.getInventoryFolder(folder1Id); 174 InventoryFolderBase dataFolder1 = inventoryDataPlugin.getInventoryFolder(folder1Id);
174 Assert.That(newFolderName2, Is.EqualTo(dataFolder1.Name)); 175 Assert.That(newFolderName2, Is.EqualTo(dataFolder1.Name));
175 Assert.That(folderType2, Is.EqualTo((ushort)dataFolder1.Type)); 176 Assert.That(folderType2, Is.EqualTo((ushort)dataFolder1.Type));
176 Assert.That(folder2Id, Is.EqualTo(dataFolder1.ParentID)); 177 Assert.That(folder2Id, Is.EqualTo(dataFolder1.ParentID));
177 } 178 }
178 179
179 } 180 }
180 181
181 /// <summary> 182 /// <summary>
182 /// Test moving an inventory folder 183 /// Test moving an inventory folder
@@ -186,32 +187,32 @@ namespace OpenSim.Framework.Communications.Tests
186 { 187 {
187 TestCommunicationsManager commsManager = new TestCommunicationsManager(); 188 TestCommunicationsManager commsManager = new TestCommunicationsManager();
188 IInventoryDataPlugin inventoryDataPlugin = commsManager.InventoryDataPlugin; 189 IInventoryDataPlugin inventoryDataPlugin = commsManager.InventoryDataPlugin;
189 190
190 CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager); 191 CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager);
191 192
192 UUID folder1Id = UUID.Parse("00000000-0000-0000-0000-000000000020"); 193 UUID folder1Id = UUID.Parse("00000000-0000-0000-0000-000000000020");
193 UUID folder2Id = UUID.Parse("00000000-0000-0000-0000-000000000021"); 194 UUID folder2Id = UUID.Parse("00000000-0000-0000-0000-000000000021");
194 UUID folderToMoveId = UUID.Parse("00000000-0000-0000-0000-000000000030"); 195 UUID folderToMoveId = UUID.Parse("00000000-0000-0000-0000-000000000030");
195 InventoryFolderImpl rootFolder = userInfo.RootFolder; 196 InventoryFolderImpl rootFolder = userInfo.RootFolder;
196 197
197 userInfo.CreateFolder("folder1", folder1Id, (ushort)AssetType.Animation, rootFolder.ID); 198 userInfo.CreateFolder("folder1", folder1Id, (ushort)AssetType.Animation, rootFolder.ID);
198 InventoryFolderImpl folder1 = rootFolder.GetChildFolder(folder1Id); 199 InventoryFolderImpl folder1 = rootFolder.GetChildFolder(folder1Id);
199 userInfo.CreateFolder("folder2", folder2Id, (ushort)AssetType.Animation, rootFolder.ID); 200 userInfo.CreateFolder("folder2", folder2Id, (ushort)AssetType.Animation, rootFolder.ID);
200 InventoryFolderImpl folder2 = rootFolder.GetChildFolder(folder2Id); 201 InventoryFolderImpl folder2 = rootFolder.GetChildFolder(folder2Id);
201 202
202 // Check folder is currently in folder1 203 // Check folder is currently in folder1
203 userInfo.CreateFolder("folderToMove", folderToMoveId, (ushort)AssetType.Animation, folder1Id); 204 userInfo.CreateFolder("folderToMove", folderToMoveId, (ushort)AssetType.Animation, folder1Id);
204 Assert.That(folder1.ContainsChildFolder(folderToMoveId), Is.True); 205 Assert.That(folder1.ContainsChildFolder(folderToMoveId), Is.True);
205 206
206 userInfo.MoveFolder(folderToMoveId, folder2Id); 207 userInfo.MoveFolder(folderToMoveId, folder2Id);
207 208
208 // Check folder is now in folder2 and no trace remains in folder1 209 // Check folder is now in folder2 and no trace remains in folder1
209 Assert.That(folder2.ContainsChildFolder(folderToMoveId), Is.True); 210 Assert.That(folder2.ContainsChildFolder(folderToMoveId), Is.True);
210 Assert.That(inventoryDataPlugin.getInventoryFolder(folderToMoveId).ParentID, Is.EqualTo(folder2Id)); 211 Assert.That(inventoryDataPlugin.getInventoryFolder(folderToMoveId).ParentID, Is.EqualTo(folder2Id));
211 212
212 Assert.That(folder1.ContainsChildFolder(folderToMoveId), Is.False); 213 Assert.That(folder1.ContainsChildFolder(folderToMoveId), Is.False);
213 } 214 }
214 215
215 /// <summary> 216 /// <summary>
216 /// Test purging an inventory folder 217 /// Test purging an inventory folder
217 /// </summary> 218 /// </summary>
@@ -219,21 +220,21 @@ namespace OpenSim.Framework.Communications.Tests
219 public void TestPurgeFolder() 220 public void TestPurgeFolder()
220 { 221 {
221 //log4net.Config.XmlConfigurator.Configure(); 222 //log4net.Config.XmlConfigurator.Configure();
222 223
223 TestCommunicationsManager commsManager = new TestCommunicationsManager(); 224 TestCommunicationsManager commsManager = new TestCommunicationsManager();
224 IInventoryDataPlugin inventoryDataPlugin = commsManager.InventoryDataPlugin; 225 IInventoryDataPlugin inventoryDataPlugin = commsManager.InventoryDataPlugin;
225 226
226 CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager); 227 CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager);
227 228
228 UUID folder1Id = UUID.Parse("00000000-0000-0000-0000-000000000070"); 229 UUID folder1Id = UUID.Parse("00000000-0000-0000-0000-000000000070");
229 InventoryFolderImpl rootFolder = userInfo.RootFolder; 230 InventoryFolderImpl rootFolder = userInfo.RootFolder;
230 231
231 userInfo.CreateFolder("folder1", folder1Id, (ushort)AssetType.Animation, rootFolder.ID); 232 userInfo.CreateFolder("folder1", folder1Id, (ushort)AssetType.Animation, rootFolder.ID);
232 Assert.That(inventoryDataPlugin.getInventoryFolder(folder1Id), Is.Not.Null); 233 Assert.That(inventoryDataPlugin.getInventoryFolder(folder1Id), Is.Not.Null);
233 234
234 // Test purge 235 // Test purge
235 userInfo.PurgeFolder(rootFolder.ID); 236 userInfo.PurgeFolder(rootFolder.ID);
236 237
237 Assert.That(rootFolder.RequestListOfFolders(), Is.Empty); 238 Assert.That(rootFolder.RequestListOfFolders(), Is.Empty);
238 Assert.That(inventoryDataPlugin.getInventoryFolder(folder1Id), Is.Null); 239 Assert.That(inventoryDataPlugin.getInventoryFolder(folder1Id), Is.Null);
239 } 240 }