* Adjust load iar unit test to check load of items with creator names that exist in the system but which are not the loading user

0.6.5-rc1
Justin Clarke Casey 2009-04-29 17:46:13 +00:00
parent d604cd284e
commit c56f928c80
2 changed files with 30 additions and 9 deletions

View File

@ -47,7 +47,18 @@ namespace OpenSim.Framework.Communications
public const string OSPA_NAME_VALUE_SEPARATOR = " ";
public const string OSPA_TUPLE_SEPARATOR = "|";
public static readonly char[] OSPA_TUPLE_SEPARATOR_ARRAY = OSPA_TUPLE_SEPARATOR.ToCharArray();
public const string OSPA_KEY_VALUE_PAIR_SEPARATOR = "=";
public const string OSPA_PAIR_SEPARATOR = "=";
/// <summary>
/// Make an OSPA given an avatar name
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
public static string MakeOspa(string firstName, string lastName)
{
return
OSPA_PREFIX + OSPA_NAME_KEY + OSPA_PAIR_SEPARATOR + firstName + OSPA_NAME_VALUE_SEPARATOR + lastName;
}
/// <summary>
/// Resolve an osp string into the most suitable internal OpenSim identifier.
@ -73,7 +84,7 @@ namespace OpenSim.Framework.Communications
foreach (string tuple in ospaTuples)
{
int tupleSeparatorIndex = tuple.IndexOf(OSPA_TUPLE_SEPARATOR);
int tupleSeparatorIndex = tuple.IndexOf(OSPA_PAIR_SEPARATOR);
if (tupleSeparatorIndex < 0)
{

View File

@ -198,13 +198,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
[Test]
public void TestLoadIarV0p1()
{
Console.WriteLine("Started TestLoadIarV0p1()");
Console.WriteLine("Started {0}", MethodBase.GetCurrentMethod());
log4net.Config.XmlConfigurator.Configure();
string userFirstName = "Mr";
string userLastName = "Tiddles";
UUID userUuid = UUID.Parse("00000000-0000-0000-0000-000000000555");
string user2FirstName = "Lord";
string user2LastName = "Lucan";
UUID user2Uuid = UUID.Parse("00000000-0000-0000-0000-000000000666");
string itemName = "b.lsl";
string archiveItemName
= string.Format("{0}{1}{2}", itemName, "_", UUID.Random());
@ -216,9 +220,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
item1.Name = itemName;
item1.AssetID = UUID.Random();
item1.GroupID = UUID.Random();
item1.CreatorId = userUuid.ToString();
item1.CreatorId = OspResolver.MakeOspa(user2FirstName, user2LastName);
//item1.CreatorId = userUuid.ToString();
//item1.CreatorId = "00000000-0000-0000-0000-000000000444";
item1.Owner = UUID.Parse(item1.CreatorId);
item1.Owner = UUID.Zero;
string item1FileName
= string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName);
@ -231,9 +236,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
// 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);
scene.CommsManager.UserAdminService.AddUser(
userAdminService.AddUser(
userFirstName, userLastName, "meowfood", String.Empty, 1000, 1000, userUuid);
userAdminService.AddUser(
user2FirstName, user2LastName, "hampshire", String.Empty, 1000, 1000, user2Uuid);
archiverModule.DearchiveInventory(userFirstName, userLastName, "/", archiveReadStream);
CachedUserInfo userInfo
@ -241,10 +251,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
InventoryItemBase foundItem = userInfo.RootFolder.FindItemByPath(itemName);
// Currently, creator and ownership both revert to the loader
Assert.That(foundItem.CreatorId, Is.EqualTo(userUuid.ToString()));
Assert.That(foundItem.CreatorId, Is.EqualTo(user2Uuid.ToString()));
Assert.That(foundItem.Owner, Is.EqualTo(userUuid));
Console.WriteLine("Finished TestLoadIarV0p1()");
Console.WriteLine("Successfully completed {0}", MethodBase.GetCurrentMethod());
}
/// <summary>