aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2010-06-04 21:15:25 +0100
committerJustin Clark-Casey (justincc)2010-06-04 21:15:25 +0100
commita08ace300ba1f81a524b209fe8fc5b3f4acfd28c (patch)
tree9ef5c9ffeed6422b71960ba7580531aa0eca8ed0
parentbring test TestLoadIarV0_1ExistingUsers() back online (diff)
downloadopensim-SC_OLD-a08ace300ba1f81a524b209fe8fc5b3f4acfd28c.zip
opensim-SC_OLD-a08ace300ba1f81a524b209fe8fc5b3f4acfd28c.tar.gz
opensim-SC_OLD-a08ace300ba1f81a524b209fe8fc5b3f4acfd28c.tar.bz2
opensim-SC_OLD-a08ace300ba1f81a524b209fe8fc5b3f4acfd28c.tar.xz
bring TestIarV0_1WithEscapedChars() back online
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs161
1 files changed, 72 insertions, 89 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
index d5fc666..3c4bc7b 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
@@ -55,14 +55,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
55 { 55 {
56 protected ManualResetEvent mre = new ManualResetEvent(false); 56 protected ManualResetEvent mre = new ManualResetEvent(false);
57 57
58 private void InventoryReceived(UUID userId)
59 {
60 lock (this)
61 {
62 Monitor.PulseAll(this);
63 }
64 }
65
66 private void SaveCompleted( 58 private void SaveCompleted(
67 Guid id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream, 59 Guid id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream,
68 Exception reportedException) 60 Exception reportedException)
@@ -198,8 +190,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
198 [Test] 190 [Test]
199 public void TestLoadIarV0_1ExistingUsers() 191 public void TestLoadIarV0_1ExistingUsers()
200 { 192 {
201 TestHelper.InMethod(); 193 TestHelper.InMethod();
202
203 //log4net.Config.XmlConfigurator.Configure(); 194 //log4net.Config.XmlConfigurator.Configure();
204 195
205 string userFirstName = "Mr"; 196 string userFirstName = "Mr";
@@ -284,95 +275,87 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
284 Assert.That(foundItem3, Is.Not.Null, "Didn't find loaded item 3"); 275 Assert.That(foundItem3, Is.Not.Null, "Didn't find loaded item 3");
285 } 276 }
286 277
287 // REFACTORING PROBLEM. Needs rewrite. 278 [Test]
288// [Test] 279 public void TestIarV0_1WithEscapedChars()
289// public void TestIarV0_1WithEscapedChars() 280 {
290// { 281 TestHelper.InMethod();
291// TestHelper.InMethod(); 282// log4net.Config.XmlConfigurator.Configure();
292//// log4net.Config.XmlConfigurator.Configure();
293 283
294// string itemName = "You & you are a mean/man/"; 284 string itemName = "You & you are a mean/man/";
295// string humanEscapedItemName = @"You & you are a mean\/man\/"; 285 string humanEscapedItemName = @"You & you are a mean\/man\/";
296// string userPassword = "meowfood"; 286 string userPassword = "meowfood";
297 287
298// InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); 288 InventoryArchiverModule archiverModule = new InventoryArchiverModule(true);
299 289
300// Scene scene = SceneSetupHelpers.SetupScene("Inventory"); 290 Scene scene = SceneSetupHelpers.SetupScene("Inventory");
301// SceneSetupHelpers.SetupSceneModules(scene, archiverModule); 291 SceneSetupHelpers.SetupSceneModules(scene, archiverModule);
302// CommunicationsManager cm = scene.CommsManager;
303
304// // Create user
305// string userFirstName = "Jock";
306// string userLastName = "Stirrup";
307// UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020");
308
309// lock (this)
310// {
311// UserProfileTestUtils.CreateUserWithInventory(
312// cm, userFirstName, userLastName, userPassword, userId, InventoryReceived);
313// Monitor.Wait(this, 60000);
314// }
315
316// // Create asset
317// SceneObjectGroup object1;
318// SceneObjectPart part1;
319// {
320// string partName = "part name";
321// UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040");
322// PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere();
323// Vector3 groupPosition = new Vector3(10, 20, 30);
324// Quaternion rotationOffset = new Quaternion(20, 30, 40, 50);
325// Vector3 offsetPosition = new Vector3(5, 10, 15);
326
327// part1
328// = new SceneObjectPart(
329// ownerId, shape, groupPosition, rotationOffset, offsetPosition);
330// part1.Name = partName;
331
332// object1 = new SceneObjectGroup(part1);
333// scene.AddNewSceneObject(object1, false);
334// }
335
336// UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060");
337// AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1);
338// scene.AssetService.Store(asset1);
339
340// // Create item
341// UUID item1Id = UUID.Parse("00000000-0000-0000-0000-000000000080");
342// InventoryItemBase item1 = new InventoryItemBase();
343// item1.Name = itemName;
344// item1.AssetID = asset1.FullID;
345// item1.ID = item1Id;
346// InventoryFolderBase objsFolder
347// = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects");
348// item1.Folder = objsFolder.ID;
349// scene.AddInventoryItem(userId, item1);
350 292
351// MemoryStream archiveWriteStream = new MemoryStream(); 293 // Create user
352// archiverModule.OnInventoryArchiveSaved += SaveCompleted; 294 string userFirstName = "Jock";
295 string userLastName = "Stirrup";
296 UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020");
297 UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userId, "meowfood");
298
299 // Create asset
300 SceneObjectGroup object1;
301 SceneObjectPart part1;
302 {
303 string partName = "part name";
304 UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040");
305 PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere();
306 Vector3 groupPosition = new Vector3(10, 20, 30);
307 Quaternion rotationOffset = new Quaternion(20, 30, 40, 50);
308 Vector3 offsetPosition = new Vector3(5, 10, 15);
353 309
354// mre.Reset(); 310 part1
355// archiverModule.ArchiveInventory( 311 = new SceneObjectPart(
356// Guid.NewGuid(), userFirstName, userLastName, "Objects", userPassword, archiveWriteStream); 312 ownerId, shape, groupPosition, rotationOffset, offsetPosition);
357// mre.WaitOne(60000, false); 313 part1.Name = partName;
358 314
359// // LOAD ITEM 315 object1 = new SceneObjectGroup(part1);
360// MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray()); 316 scene.AddNewSceneObject(object1, false);
317 }
318
319 UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060");
320 AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1);
321 scene.AssetService.Store(asset1);
322
323 // Create item
324 UUID item1Id = UUID.Parse("00000000-0000-0000-0000-000000000080");
325 InventoryItemBase item1 = new InventoryItemBase();
326 item1.Name = itemName;
327 item1.AssetID = asset1.FullID;
328 item1.ID = item1Id;
329 InventoryFolderBase objsFolder
330 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects");
331 item1.Folder = objsFolder.ID;
332 scene.AddInventoryItem(userId, item1);
333
334 MemoryStream archiveWriteStream = new MemoryStream();
335 archiverModule.OnInventoryArchiveSaved += SaveCompleted;
336
337 mre.Reset();
338 archiverModule.ArchiveInventory(
339 Guid.NewGuid(), userFirstName, userLastName, "Objects", userPassword, archiveWriteStream);
340 mre.WaitOne(60000, false);
341
342 // LOAD ITEM
343 MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray());
361 344
362// archiverModule.DearchiveInventory(userFirstName, userLastName, "Scripts", userPassword, archiveReadStream); 345 archiverModule.DearchiveInventory(userFirstName, userLastName, "Scripts", userPassword, archiveReadStream);
363 346
364// InventoryItemBase foundItem1 347 InventoryItemBase foundItem1
365// = InventoryArchiveUtils.FindItemByPath( 348 = InventoryArchiveUtils.FindItemByPath(
366// scene.InventoryService, userId, "Scripts/Objects/" + humanEscapedItemName); 349 scene.InventoryService, userId, "Scripts/Objects/" + humanEscapedItemName);
367 350
368// Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1"); 351 Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1");
369//// Assert.That(
370//// foundItem1.CreatorId, Is.EqualTo(userUuid),
371//// "Loaded item non-uuid creator doesn't match that of the loading user");
372// Assert.That( 352// Assert.That(
373// foundItem1.Name, Is.EqualTo(itemName), 353// foundItem1.CreatorId, Is.EqualTo(userUuid),
374// "Loaded item name doesn't match saved name"); 354// "Loaded item non-uuid creator doesn't match that of the loading user");
375// } 355 Assert.That(
356 foundItem1.Name, Is.EqualTo(itemName),
357 "Loaded item name doesn't match saved name");
358 }
376 359
377 /// <summary> 360 /// <summary>
378 /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where 361 /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where