aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2009-11-05 19:32:24 +0000
committerJustin Clark-Casey (justincc)2009-11-05 19:32:24 +0000
commitf8f1e94cf88fe5894366b1b11ebc3c000078cb2a (patch)
tree06e3ecae0e88375710640bcdd3e3ee6486ec44e1 /OpenSim/Region/CoreModules
parentminor test var name tweak (diff)
downloadopensim-SC-f8f1e94cf88fe5894366b1b11ebc3c000078cb2a.zip
opensim-SC-f8f1e94cf88fe5894366b1b11ebc3c000078cb2a.tar.gz
opensim-SC-f8f1e94cf88fe5894366b1b11ebc3c000078cb2a.tar.bz2
opensim-SC-f8f1e94cf88fe5894366b1b11ebc3c000078cb2a.tar.xz
add unit test for iar & escaping
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs96
1 files changed, 94 insertions, 2 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
index 81c3b74..c366150 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
@@ -290,6 +290,98 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
290 Assert.That(foundItem3, Is.Not.Null, "Didn't find loaded item 3"); 290 Assert.That(foundItem3, Is.Not.Null, "Didn't find loaded item 3");
291 } 291 }
292 292
293 [Test]
294 public void TestIarV0_1WithEscapedChars()
295 {
296 TestHelper.InMethod();
297 log4net.Config.XmlConfigurator.Configure();
298
299 string itemName = "You & you are a mean man";
300 string userPassword = "meowfood";
301
302 InventoryArchiverModule archiverModule = new InventoryArchiverModule(true);
303
304 Scene scene = SceneSetupHelpers.SetupScene("Inventory");
305 SceneSetupHelpers.SetupSceneModules(scene, archiverModule);
306 CommunicationsManager cm = scene.CommsManager;
307
308 // Create user
309 string userFirstName = "Jock";
310 string userLastName = "Stirrup";
311 UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020");
312
313 lock (this)
314 {
315 UserProfileTestUtils.CreateUserWithInventory(
316 cm, userFirstName, userLastName, userPassword, userId, InventoryReceived);
317 Monitor.Wait(this, 60000);
318 }
319
320 // Create asset
321 SceneObjectGroup object1;
322 SceneObjectPart part1;
323 {
324 string partName = "part name";
325 UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040");
326 PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere();
327 Vector3 groupPosition = new Vector3(10, 20, 30);
328 Quaternion rotationOffset = new Quaternion(20, 30, 40, 50);
329 Vector3 offsetPosition = new Vector3(5, 10, 15);
330
331 part1
332 = new SceneObjectPart(
333 ownerId, shape, groupPosition, rotationOffset, offsetPosition);
334 part1.Name = partName;
335
336 object1 = new SceneObjectGroup(part1);
337 scene.AddNewSceneObject(object1, false);
338 }
339
340 UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060");
341 AssetBase asset1 = new AssetBase();
342 asset1.FullID = asset1Id;
343 asset1.Data = Encoding.ASCII.GetBytes(SceneObjectSerializer.ToXml2Format(object1));
344 scene.AssetService.Store(asset1);
345
346 // Create item
347 UUID item1Id = UUID.Parse("00000000-0000-0000-0000-000000000080");
348 InventoryItemBase item1 = new InventoryItemBase();
349 item1.Name = itemName;
350 item1.AssetID = asset1.FullID;
351 item1.ID = item1Id;
352 InventoryFolderBase objsFolder
353 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects");
354 item1.Folder = objsFolder.ID;
355 scene.AddInventoryItem(userId, item1);
356
357 MemoryStream archiveWriteStream = new MemoryStream();
358 archiverModule.OnInventoryArchiveSaved += SaveCompleted;
359
360 mre.Reset();
361 archiverModule.ArchiveInventory(
362 Guid.NewGuid(), userFirstName, userLastName, "Objects", userPassword, archiveWriteStream);
363 mre.WaitOne(60000, false);
364
365 /// LOAD ITEM
366 MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray());
367
368 archiverModule.DearchiveInventory(userFirstName, userLastName, "Scripts", userPassword, archiveReadStream);
369
370 CachedUserInfo userInfo
371 = scene.CommsManager.UserProfileCacheService.GetUserDetails(userFirstName, userLastName);
372
373 InventoryItemBase foundItem1
374 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userId, "Scripts/Objects/" + itemName);
375
376 Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1");
377// Assert.That(
378// foundItem1.CreatorId, Is.EqualTo(userUuid),
379// "Loaded item non-uuid creator doesn't match that of the loading user");
380 Assert.That(
381 foundItem1.Name, Is.EqualTo(itemName),
382 "Loaded item name doesn't match saved name");
383 }
384
293 /// <summary> 385 /// <summary>
294 /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where 386 /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where
295 /// embedded creators do not exist in the system 387 /// embedded creators do not exist in the system
@@ -302,7 +394,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
302 { 394 {
303 TestHelper.InMethod(); 395 TestHelper.InMethod();
304 396
305 log4net.Config.XmlConfigurator.Configure(); 397 //log4net.Config.XmlConfigurator.Configure();
306 398
307 string userFirstName = "Charlie"; 399 string userFirstName = "Charlie";
308 string userLastName = "Chan"; 400 string userLastName = "Chan";
@@ -370,7 +462,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
370 { 462 {
371 TestHelper.InMethod(); 463 TestHelper.InMethod();
372 464
373 log4net.Config.XmlConfigurator.Configure(); 465 //log4net.Config.XmlConfigurator.Configure();
374 466
375 string userFirstName = "Dennis"; 467 string userFirstName = "Dennis";
376 string userLastName = "Menace"; 468 string userLastName = "Menace";