From 1bf0bc8bb3c3d78f2616397b7a4f048ae5ea1ac3 Mon Sep 17 00:00:00 2001
From: Justin Clarke Casey
Date: Wed, 29 Apr 2009 18:52:10 +0000
Subject: * Apply further groups xmlrpc to stop an exception in the exception
handler * Thanks mcortez
---
.../Archiver/Tests/InventoryArchiverTests.cs | 76 +++++++++++++++++++++-
1 file changed, 73 insertions(+), 3 deletions(-)
(limited to 'OpenSim/Region/CoreModules/Avatar/Inventory')
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
}
///
- /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet).
+ /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where
+ /// an account exists with the creator name.
///
[Test]
- public void TestLoadIarV0p1()
+ public void TestLoadIarV0p1ExistingUsers()
{
Console.WriteLine("Started {0}", MethodBase.GetCurrentMethod());
- log4net.Config.XmlConfigurator.Configure();
+ //log4net.Config.XmlConfigurator.Configure();
string userFirstName = "Mr";
string userLastName = "Tiddles";
@@ -256,6 +257,75 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
Console.WriteLine("Successfully completed {0}", MethodBase.GetCurrentMethod());
}
+
+ /*
+ ///
+ /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where
+ /// no account exists with the creator name
+ ///
+ [Test]
+ public void TestLoadIarV0p1TempProfiles()
+ {
+ Console.WriteLine("### Started {0} ###", MethodBase.GetCurrentMethod());
+
+ log4net.Config.XmlConfigurator.Configure();
+
+ string userFirstName = "Dennis";
+ string userLastName = "Menace";
+ UUID userUuid = UUID.Parse("00000000-0000-0000-0000-000000000aaa");
+ string user2FirstName = "Walter";
+ string user2LastName = "Mitty";
+
+ string itemName = "b.lsl";
+ string archiveItemName
+ = string.Format("{0}{1}{2}", itemName, "_", UUID.Random());
+
+ MemoryStream archiveWriteStream = new MemoryStream();
+ TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream);
+
+ InventoryItemBase item1 = new InventoryItemBase();
+ item1.Name = itemName;
+ item1.AssetID = UUID.Random();
+ item1.GroupID = UUID.Random();
+ item1.CreatorId = OspResolver.MakeOspa(user2FirstName, user2LastName);
+ item1.Owner = UUID.Zero;
+
+ string item1FileName
+ = string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName);
+ tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1));
+ tar.Close();
+
+ MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray());
+ SerialiserModule serialiserModule = new SerialiserModule();
+ InventoryArchiverModule archiverModule = new InventoryArchiverModule();
+
+ // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene
+ Scene scene = SceneSetupHelpers.SetupScene();
+ IUserAdminService userAdminService = scene.CommsManager.UserAdminService;
+
+ SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
+ userAdminService.AddUser(
+ userFirstName, userLastName, "meowfood", String.Empty, 1000, 1000, userUuid);
+
+ archiverModule.DearchiveInventory(userFirstName, userLastName, "/", archiveReadStream);
+
+ // Check that a suitable temporary user profile has been created.
+ UserProfileData user2Profile
+ = scene.CommsManager.UserService.GetUserProfile(user2FirstName, user2LastName);
+ Assert.That(user2Profile, Is.Not.Null);
+ Assert.That(user2Profile.FirstName == user2FirstName);
+ Assert.That(user2Profile.SurName == user2LastName);
+
+ CachedUserInfo userInfo
+ = scene.CommsManager.UserProfileCacheService.GetUserDetails(userFirstName, userLastName);
+ InventoryItemBase foundItem = userInfo.RootFolder.FindItemByPath(itemName);
+
+ Assert.That(foundItem.CreatorId, Is.EqualTo(user2Profile.ID.ToString()));
+ Assert.That(foundItem.Owner, Is.EqualTo(userUuid));
+
+ Console.WriteLine("### Successfully completed {0} ###", MethodBase.GetCurrentMethod());
+ }
+ */
///
/// Test replication of an archive path to the user's inventory.
--
cgit v1.1