diff options
author | Justin Clark-Casey (justincc) | 2013-02-16 01:57:42 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2013-02-16 01:57:42 +0000 |
commit | 7d7736dc738c92261bbdcbe2873fd669f51219ce (patch) | |
tree | dfcb0f1c3bc0b29dea052ee53e3784185306ceb9 /OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveSaveTests.cs | |
parent | Make it so that "load iar / ..." does not save the 'root' "My Inventory" folder. (diff) | |
download | opensim-SC_OLD-7d7736dc738c92261bbdcbe2873fd669f51219ce.zip opensim-SC_OLD-7d7736dc738c92261bbdcbe2873fd669f51219ce.tar.gz opensim-SC_OLD-7d7736dc738c92261bbdcbe2873fd669f51219ce.tar.bz2 opensim-SC_OLD-7d7736dc738c92261bbdcbe2873fd669f51219ce.tar.xz |
Separate IAR tests into separate files for load/save/loadpath tests
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveSaveTests.cs (renamed from OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs) | 128 |
1 files changed, 1 insertions, 127 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveSaveTests.cs index 7ff29e5..5e7e24c 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveSaveTests.cs | |||
@@ -48,7 +48,7 @@ using OpenSim.Tests.Common.Mock; | |||
48 | namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | 48 | namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests |
49 | { | 49 | { |
50 | [TestFixture] | 50 | [TestFixture] |
51 | public class InventoryArchiverTests : InventoryArchiveTestCase | 51 | public class InventoryArchiveSaveTests : InventoryArchiveTestCase |
52 | { | 52 | { |
53 | protected TestScene m_scene; | 53 | protected TestScene m_scene; |
54 | protected InventoryArchiverModule m_archiverModule; | 54 | protected InventoryArchiverModule m_archiverModule; |
@@ -64,36 +64,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
64 | m_scene = new SceneHelpers().SetupScene(); | 64 | m_scene = new SceneHelpers().SetupScene(); |
65 | SceneHelpers.SetupSceneModules(m_scene, serialiserModule, m_archiverModule); | 65 | SceneHelpers.SetupSceneModules(m_scene, serialiserModule, m_archiverModule); |
66 | } | 66 | } |
67 | |||
68 | [Test] | ||
69 | public void TestLoadCoalesecedItem() | ||
70 | { | ||
71 | TestHelpers.InMethod(); | ||
72 | // TestHelpers.EnableLogging(); | ||
73 | |||
74 | UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaLL1, "password"); | ||
75 | m_archiverModule.DearchiveInventory(m_uaLL1.FirstName, m_uaLL1.LastName, "/", "password", m_iarStream); | ||
76 | |||
77 | InventoryItemBase coaItem | ||
78 | = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_uaLL1.PrincipalID, m_coaItemName); | ||
79 | |||
80 | Assert.That(coaItem, Is.Not.Null, "Didn't find loaded item 1"); | ||
81 | |||
82 | string assetXml = AssetHelpers.ReadAssetAsString(m_scene.AssetService, coaItem.AssetID); | ||
83 | |||
84 | CoalescedSceneObjects coa; | ||
85 | bool readResult = CoalescedSceneObjectsSerializer.TryFromXml(assetXml, out coa); | ||
86 | |||
87 | Assert.That(readResult, Is.True); | ||
88 | Assert.That(coa.Count, Is.EqualTo(2)); | ||
89 | |||
90 | List<SceneObjectGroup> coaObjects = coa.Objects; | ||
91 | Assert.That(coaObjects[0].UUID, Is.EqualTo(UUID.Parse("00000000-0000-0000-0000-000000000120"))); | ||
92 | Assert.That(coaObjects[0].AbsolutePosition, Is.EqualTo(new Vector3(15, 30, 45))); | ||
93 | |||
94 | Assert.That(coaObjects[1].UUID, Is.EqualTo(UUID.Parse("00000000-0000-0000-0000-000000000140"))); | ||
95 | Assert.That(coaObjects[1].AbsolutePosition, Is.EqualTo(new Vector3(25, 50, 75))); | ||
96 | } | ||
97 | 67 | ||
98 | /// <summary> | 68 | /// <summary> |
99 | /// Test that the IAR has the required files in the right order. | 69 | /// Test that the IAR has the required files in the right order. |
@@ -450,101 +420,5 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
450 | 420 | ||
451 | // TODO: Test presence of more files and contents of files. | 421 | // TODO: Test presence of more files and contents of files. |
452 | } | 422 | } |
453 | |||
454 | /// <summary> | ||
455 | /// Test case where a creator account exists for the creator UUID embedded in item metadata and serialized | ||
456 | /// objects. | ||
457 | /// </summary> | ||
458 | [Test] | ||
459 | public void TestLoadIarCreatorAccountPresent() | ||
460 | { | ||
461 | TestHelpers.InMethod(); | ||
462 | // log4net.Config.XmlConfigurator.Configure(); | ||
463 | |||
464 | UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaLL1, "meowfood"); | ||
465 | |||
466 | m_archiverModule.DearchiveInventory(m_uaLL1.FirstName, m_uaLL1.LastName, "/", "meowfood", m_iarStream); | ||
467 | InventoryItemBase foundItem1 | ||
468 | = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_uaLL1.PrincipalID, m_item1Name); | ||
469 | |||
470 | Assert.That( | ||
471 | foundItem1.CreatorId, Is.EqualTo(m_uaLL1.PrincipalID.ToString()), | ||
472 | "Loaded item non-uuid creator doesn't match original"); | ||
473 | Assert.That( | ||
474 | foundItem1.CreatorIdAsUuid, Is.EqualTo(m_uaLL1.PrincipalID), | ||
475 | "Loaded item uuid creator doesn't match original"); | ||
476 | Assert.That(foundItem1.Owner, Is.EqualTo(m_uaLL1.PrincipalID), | ||
477 | "Loaded item owner doesn't match inventory reciever"); | ||
478 | |||
479 | AssetBase asset1 = m_scene.AssetService.Get(foundItem1.AssetID.ToString()); | ||
480 | string xmlData = Utils.BytesToString(asset1.Data); | ||
481 | SceneObjectGroup sog1 = SceneObjectSerializer.FromOriginalXmlFormat(xmlData); | ||
482 | |||
483 | Assert.That(sog1.RootPart.CreatorID, Is.EqualTo(m_uaLL1.PrincipalID)); | ||
484 | } | ||
485 | |||
486 | // /// <summary> | ||
487 | // /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where | ||
488 | // /// an account exists with the same name as the creator, though not the same id. | ||
489 | // /// </summary> | ||
490 | // [Test] | ||
491 | // public void TestLoadIarV0_1SameNameCreator() | ||
492 | // { | ||
493 | // TestHelpers.InMethod(); | ||
494 | // TestHelpers.EnableLogging(); | ||
495 | // | ||
496 | // UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaMT, "meowfood"); | ||
497 | // UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaLL2, "hampshire"); | ||
498 | // | ||
499 | // m_archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "/", "meowfood", m_iarStream); | ||
500 | // InventoryItemBase foundItem1 | ||
501 | // = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_uaMT.PrincipalID, m_item1Name); | ||
502 | // | ||
503 | // Assert.That( | ||
504 | // foundItem1.CreatorId, Is.EqualTo(m_uaLL2.PrincipalID.ToString()), | ||
505 | // "Loaded item non-uuid creator doesn't match original"); | ||
506 | // Assert.That( | ||
507 | // foundItem1.CreatorIdAsUuid, Is.EqualTo(m_uaLL2.PrincipalID), | ||
508 | // "Loaded item uuid creator doesn't match original"); | ||
509 | // Assert.That(foundItem1.Owner, Is.EqualTo(m_uaMT.PrincipalID), | ||
510 | // "Loaded item owner doesn't match inventory reciever"); | ||
511 | // | ||
512 | // AssetBase asset1 = m_scene.AssetService.Get(foundItem1.AssetID.ToString()); | ||
513 | // string xmlData = Utils.BytesToString(asset1.Data); | ||
514 | // SceneObjectGroup sog1 = SceneObjectSerializer.FromOriginalXmlFormat(xmlData); | ||
515 | // | ||
516 | // Assert.That(sog1.RootPart.CreatorID, Is.EqualTo(m_uaLL2.PrincipalID)); | ||
517 | // } | ||
518 | |||
519 | /// <summary> | ||
520 | /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where | ||
521 | /// the creator or an account with the creator's name does not exist within the system. | ||
522 | /// </summary> | ||
523 | [Test] | ||
524 | public void TestLoadIarV0_1AbsentCreator() | ||
525 | { | ||
526 | TestHelpers.InMethod(); | ||
527 | // log4net.Config.XmlConfigurator.Configure(); | ||
528 | |||
529 | UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaMT, "password"); | ||
530 | m_archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "/", "password", m_iarStream); | ||
531 | |||
532 | InventoryItemBase foundItem1 | ||
533 | = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_uaMT.PrincipalID, m_item1Name); | ||
534 | |||
535 | Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1"); | ||
536 | Assert.That( | ||
537 | foundItem1.CreatorId, Is.EqualTo(m_uaMT.PrincipalID.ToString()), | ||
538 | "Loaded item non-uuid creator doesn't match that of the loading user"); | ||
539 | Assert.That( | ||
540 | foundItem1.CreatorIdAsUuid, Is.EqualTo(m_uaMT.PrincipalID), | ||
541 | "Loaded item uuid creator doesn't match that of the loading user"); | ||
542 | |||
543 | AssetBase asset1 = m_scene.AssetService.Get(foundItem1.AssetID.ToString()); | ||
544 | string xmlData = Utils.BytesToString(asset1.Data); | ||
545 | SceneObjectGroup sog1 = SceneObjectSerializer.FromOriginalXmlFormat(xmlData); | ||
546 | |||
547 | Assert.That(sog1.RootPart.CreatorID, Is.EqualTo(m_uaMT.PrincipalID)); | ||
548 | } | ||
549 | } | 423 | } |
550 | } \ No newline at end of file | 424 | } \ No newline at end of file |