diff options
author | Justin Clarke Casey | 2009-04-29 18:52:10 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2009-04-29 18:52:10 +0000 |
commit | 1bf0bc8bb3c3d78f2616397b7a4f048ae5ea1ac3 (patch) | |
tree | 163b606708688dfcd147cf47494e976cd125e968 /OpenSim/Region/CoreModules/Avatar/Inventory/Archiver | |
parent | * Apply http://opensimulator.org/mantis/view.php?id=3557 (diff) | |
download | opensim-SC_OLD-1bf0bc8bb3c3d78f2616397b7a4f048ae5ea1ac3.zip opensim-SC_OLD-1bf0bc8bb3c3d78f2616397b7a4f048ae5ea1ac3.tar.gz opensim-SC_OLD-1bf0bc8bb3c3d78f2616397b7a4f048ae5ea1ac3.tar.bz2 opensim-SC_OLD-1bf0bc8bb3c3d78f2616397b7a4f048ae5ea1ac3.tar.xz |
* Apply further groups xmlrpc to stop an exception in the exception handler
* Thanks mcortez
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/Inventory/Archiver')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs | 76 |
1 files changed, 73 insertions, 3 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index 20d4e47..9bec7ed 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs | |||
@@ -194,14 +194,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
194 | } | 194 | } |
195 | 195 | ||
196 | /// <summary> | 196 | /// <summary> |
197 | /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet). | 197 | /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where |
198 | /// an account exists with the creator name. | ||
198 | /// </summary> | 199 | /// </summary> |
199 | [Test] | 200 | [Test] |
200 | public void TestLoadIarV0p1() | 201 | public void TestLoadIarV0p1ExistingUsers() |
201 | { | 202 | { |
202 | Console.WriteLine("Started {0}", MethodBase.GetCurrentMethod()); | 203 | Console.WriteLine("Started {0}", MethodBase.GetCurrentMethod()); |
203 | 204 | ||
204 | log4net.Config.XmlConfigurator.Configure(); | 205 | //log4net.Config.XmlConfigurator.Configure(); |
205 | 206 | ||
206 | string userFirstName = "Mr"; | 207 | string userFirstName = "Mr"; |
207 | string userLastName = "Tiddles"; | 208 | string userLastName = "Tiddles"; |
@@ -256,6 +257,75 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
256 | 257 | ||
257 | Console.WriteLine("Successfully completed {0}", MethodBase.GetCurrentMethod()); | 258 | Console.WriteLine("Successfully completed {0}", MethodBase.GetCurrentMethod()); |
258 | } | 259 | } |
260 | |||
261 | /* | ||
262 | /// <summary> | ||
263 | /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where | ||
264 | /// no account exists with the creator name | ||
265 | /// </summary> | ||
266 | [Test] | ||
267 | public void TestLoadIarV0p1TempProfiles() | ||
268 | { | ||
269 | Console.WriteLine("### Started {0} ###", MethodBase.GetCurrentMethod()); | ||
270 | |||
271 | log4net.Config.XmlConfigurator.Configure(); | ||
272 | |||
273 | string userFirstName = "Dennis"; | ||
274 | string userLastName = "Menace"; | ||
275 | UUID userUuid = UUID.Parse("00000000-0000-0000-0000-000000000aaa"); | ||
276 | string user2FirstName = "Walter"; | ||
277 | string user2LastName = "Mitty"; | ||
278 | |||
279 | string itemName = "b.lsl"; | ||
280 | string archiveItemName | ||
281 | = string.Format("{0}{1}{2}", itemName, "_", UUID.Random()); | ||
282 | |||
283 | MemoryStream archiveWriteStream = new MemoryStream(); | ||
284 | TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream); | ||
285 | |||
286 | InventoryItemBase item1 = new InventoryItemBase(); | ||
287 | item1.Name = itemName; | ||
288 | item1.AssetID = UUID.Random(); | ||
289 | item1.GroupID = UUID.Random(); | ||
290 | item1.CreatorId = OspResolver.MakeOspa(user2FirstName, user2LastName); | ||
291 | item1.Owner = UUID.Zero; | ||
292 | |||
293 | string item1FileName | ||
294 | = string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName); | ||
295 | tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1)); | ||
296 | tar.Close(); | ||
297 | |||
298 | MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray()); | ||
299 | SerialiserModule serialiserModule = new SerialiserModule(); | ||
300 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(); | ||
301 | |||
302 | // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene | ||
303 | Scene scene = SceneSetupHelpers.SetupScene(); | ||
304 | IUserAdminService userAdminService = scene.CommsManager.UserAdminService; | ||
305 | |||
306 | SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); | ||
307 | userAdminService.AddUser( | ||
308 | userFirstName, userLastName, "meowfood", String.Empty, 1000, 1000, userUuid); | ||
309 | |||
310 | archiverModule.DearchiveInventory(userFirstName, userLastName, "/", archiveReadStream); | ||
311 | |||
312 | // Check that a suitable temporary user profile has been created. | ||
313 | UserProfileData user2Profile | ||
314 | = scene.CommsManager.UserService.GetUserProfile(user2FirstName, user2LastName); | ||
315 | Assert.That(user2Profile, Is.Not.Null); | ||
316 | Assert.That(user2Profile.FirstName == user2FirstName); | ||
317 | Assert.That(user2Profile.SurName == user2LastName); | ||
318 | |||
319 | CachedUserInfo userInfo | ||
320 | = scene.CommsManager.UserProfileCacheService.GetUserDetails(userFirstName, userLastName); | ||
321 | InventoryItemBase foundItem = userInfo.RootFolder.FindItemByPath(itemName); | ||
322 | |||
323 | Assert.That(foundItem.CreatorId, Is.EqualTo(user2Profile.ID.ToString())); | ||
324 | Assert.That(foundItem.Owner, Is.EqualTo(userUuid)); | ||
325 | |||
326 | Console.WriteLine("### Successfully completed {0} ###", MethodBase.GetCurrentMethod()); | ||
327 | } | ||
328 | */ | ||
259 | 329 | ||
260 | /// <summary> | 330 | /// <summary> |
261 | /// Test replication of an archive path to the user's inventory. | 331 | /// Test replication of an archive path to the user's inventory. |