From 0683cf6e0d541571d04d6511dc0ecabb17dd1e1e Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 9 Sep 2009 18:03:49 +0100
Subject: Add test to check behaviour if an iar is loaded where no user profile
exists for the creators Disable generation of temporary profiles for now,
instead record loading user as creator
---
.../Framework/Communications/Osp/OspResolver.cs | 7 +-
.../Archiver/InventoryArchiveReadRequest.cs | 2 +
.../Archiver/Tests/InventoryArchiverTests.cs | 79 +++++++++++++++++++++-
OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 22 ++----
4 files changed, 90 insertions(+), 20 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Framework/Communications/Osp/OspResolver.cs b/OpenSim/Framework/Communications/Osp/OspResolver.cs
index 502fee3..e98317a 100644
--- a/OpenSim/Framework/Communications/Osp/OspResolver.cs
+++ b/OpenSim/Framework/Communications/Osp/OspResolver.cs
@@ -153,7 +153,9 @@ namespace OpenSim.Framework.Communications.Osp
CachedUserInfo userInfo = commsManager.UserProfileCacheService.GetUserDetails(firstName, lastName);
if (userInfo != null)
return userInfo.UserProfile.ID;
-
+
+ // XXX: Disable temporary user profile creation for now as implementation is incomplete - justincc
+ /*
UserProfileData tempUserProfile = new UserProfileData();
tempUserProfile.FirstName = firstName;
tempUserProfile.SurName = lastName;
@@ -164,6 +166,9 @@ namespace OpenSim.Framework.Communications.Osp
commsManager.UserService.AddTemporaryUserProfile(tempUserProfile);
return tempUserProfile.ID;
+ */
+
+ return UUID.Zero;
}
}
}
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
index 50c0f93..2a1c82e 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
@@ -177,6 +177,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
UUID ospResolvedId = OspResolver.ResolveOspa(item.CreatorId, m_scene.CommsManager);
if (UUID.Zero != ospResolvedId)
item.CreatorIdAsUuid = ospResolvedId;
+ else
+ item.CreatorIdAsUuid = m_userInfo.UserProfile.ID;
item.Owner = m_userInfo.UserProfile.ID;
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
index 384a1f2..9c5f8f3 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
@@ -81,7 +81,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
public void TestSaveIarV0_1()
{
TestHelper.InMethod();
- log4net.Config.XmlConfigurator.Configure();
+ //log4net.Config.XmlConfigurator.Configure();
InventoryArchiverModule archiverModule = new InventoryArchiverModule(true);
@@ -202,12 +202,14 @@ 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) where
/// an account exists with the creator name.
///
+ ///
+ /// This test also does some deeper probing of loading into nested inventory structures
[Test]
public void TestLoadIarV0_1ExistingUsers()
{
TestHelper.InMethod();
- log4net.Config.XmlConfigurator.Configure();
+ //log4net.Config.XmlConfigurator.Configure();
string userFirstName = "Mr";
string userLastName = "Tiddles";
@@ -291,6 +293,77 @@ 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) where
+ /// embedded creators do not exist in the system
+ ///
+ ///
+ /// This may possibly one day get overtaken by the as yet incomplete temporary profiles feature
+ /// (as tested in the a later commented out test)
+ [Test]
+ public void TestLoadIarV0_1AbsentUsers()
+ {
+ TestHelper.InMethod();
+
+ log4net.Config.XmlConfigurator.Configure();
+
+ string userFirstName = "Charlie";
+ string userLastName = "Chan";
+ UUID userUuid = UUID.Parse("00000000-0000-0000-0000-000000000999");
+ string userItemCreatorFirstName = "Bat";
+ string userItemCreatorLastName = "Man";
+ //UUID userItemCreatorUuid = UUID.Parse("00000000-0000-0000-0000-000000008888");
+
+ 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(userItemCreatorFirstName, userItemCreatorLastName);
+ //item1.CreatorId = userUuid.ToString();
+ //item1.CreatorId = "00000000-0000-0000-0000-000000000444";
+ 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(true);
+
+ // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene
+ Scene scene = SceneSetupHelpers.SetupScene("inventory");
+ 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);
+
+ CachedUserInfo userInfo
+ = scene.CommsManager.UserProfileCacheService.GetUserDetails(userFirstName, userLastName);
+
+ InventoryItemBase foundItem1
+ = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userInfo.UserProfile.ID, itemName);
+
+ Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1");
+// Assert.That(
+// foundItem1.CreatorId, Is.EqualTo(userUuid),
+// "Loaded item non-uuid creator doesn't match that of the loading user");
+ Assert.That(
+ foundItem1.CreatorIdAsUuid, Is.EqualTo(userUuid),
+ "Loaded item uuid creator doesn't match that of the loading user");
+ }
+
+ ///
+ /// 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
///
/// Disabled since temporary profiles have not yet been implemented.
@@ -376,7 +449,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
{
TestHelper.InMethod();
- log4net.Config.XmlConfigurator.Configure();
+ //log4net.Config.XmlConfigurator.Configure();
Scene scene = SceneSetupHelpers.SetupScene("inventory");
CommunicationsManager commsManager = scene.CommsManager;
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index fea288e..94223d8 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -3488,7 +3488,7 @@ namespace OpenSim.Region.Physics.OdePlugin
{
if (geom == localGround)
{
- localHeightfield = TerrainHeightFieldHeights[geom];
+ //localHeightfield = TerrainHeightFieldHeights[geom];
proceed = true;
}
else
@@ -3510,7 +3510,7 @@ namespace OpenSim.Region.Physics.OdePlugin
// memory corruption
if (TerrainHeightFieldHeights.ContainsKey(g))
{
- float[] removingHeightField = TerrainHeightFieldHeights[g];
+ //float[] removingHeightField = TerrainHeightFieldHeights[g];
TerrainHeightFieldHeights.Remove(g);
if (RegionTerrain.ContainsKey(g))
@@ -3519,27 +3519,17 @@ namespace OpenSim.Region.Physics.OdePlugin
}
d.GeomDestroy(g);
- removingHeightField = new float[0];
-
-
-
- }
-
+ //removingHeightField = new float[0];
+ }
}
-
}
else
{
m_log.Warn("[PHYSICS]: Couldn't proceed with UnCombine. Region has inconsistant data.");
-
}
-
- }
-
+ }
}
- }
-
-
+ }
public override void SetWaterLevel(float baseheight)
{
--
cgit v1.1