refactor: rename test user account fields

0.7.1-dev
Justin Clark-Casey (justincc) 2011-03-10 22:52:41 +00:00
parent 9ecb745ed7
commit 8d69e68311
3 changed files with 35 additions and 35 deletions

View File

@ -63,17 +63,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
/// </summary> /// </summary>
protected MemoryStream m_iarStream; protected MemoryStream m_iarStream;
protected UserAccount m_ua1 protected UserAccount m_uaMT
= new UserAccount { = new UserAccount {
PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000555"), PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000555"),
FirstName = "Mr", FirstName = "Mr",
LastName = "Tiddles" }; LastName = "Tiddles" };
protected UserAccount m_ua2 protected UserAccount m_uaLL1
= new UserAccount { = new UserAccount {
PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000666"), PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000666"),
FirstName = "Lord", FirstName = "Lord",
LastName = "Lucan" }; LastName = "Lucan" };
protected UserAccount m_ua3 protected UserAccount m_uaLL2
= new UserAccount { = new UserAccount {
PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000777"), PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000777"),
FirstName = "Lord", FirstName = "Lord",
@ -100,7 +100,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
Scene scene = SceneSetupHelpers.SetupScene("Inventory"); Scene scene = SceneSetupHelpers.SetupScene("Inventory");
SceneSetupHelpers.SetupSceneModules(scene, archiverModule); SceneSetupHelpers.SetupSceneModules(scene, archiverModule);
UserProfileTestUtils.CreateUserWithInventory(scene, m_ua2, "hampshire"); UserProfileTestUtils.CreateUserWithInventory(scene, m_uaLL1, "hampshire");
MemoryStream archiveWriteStream = new MemoryStream(); MemoryStream archiveWriteStream = new MemoryStream();
@ -134,13 +134,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
item1.ID = UUID.Parse("00000000-0000-0000-0000-000000000020"); item1.ID = UUID.Parse("00000000-0000-0000-0000-000000000020");
item1.AssetID = asset1.FullID; item1.AssetID = asset1.FullID;
item1.GroupID = UUID.Random(); item1.GroupID = UUID.Random();
item1.CreatorIdAsUuid = m_ua2.PrincipalID; item1.CreatorIdAsUuid = m_uaLL1.PrincipalID;
item1.Owner = m_ua2.PrincipalID; item1.Owner = m_uaLL1.PrincipalID;
item1.Folder = scene.InventoryService.GetRootFolder(m_ua2.PrincipalID).ID; item1.Folder = scene.InventoryService.GetRootFolder(m_uaLL1.PrincipalID).ID;
scene.AddInventoryItem(item1); scene.AddInventoryItem(item1);
archiverModule.ArchiveInventory( archiverModule.ArchiveInventory(
Guid.NewGuid(), m_ua2.FirstName, m_ua2.LastName, m_item1Name, "hampshire", archiveWriteStream); Guid.NewGuid(), m_uaLL1.FirstName, m_uaLL1.LastName, m_item1Name, "hampshire", archiveWriteStream);
m_iarStreamBytes = archiveWriteStream.ToArray(); m_iarStreamBytes = archiveWriteStream.ToArray();
} }

View File

@ -188,27 +188,27 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
TestHelper.InMethod(); TestHelper.InMethod();
// log4net.Config.XmlConfigurator.Configure(); // log4net.Config.XmlConfigurator.Configure();
UserProfileTestUtils.CreateUserWithInventory(m_scene, m_ua1, "meowfood"); UserProfileTestUtils.CreateUserWithInventory(m_scene, m_uaMT, "meowfood");
UserProfileTestUtils.CreateUserWithInventory(m_scene, m_ua3, "hampshire"); UserProfileTestUtils.CreateUserWithInventory(m_scene, m_uaLL2, "hampshire");
m_archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "/", "meowfood", m_iarStream); m_archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "/", "meowfood", m_iarStream);
InventoryItemBase foundItem1 InventoryItemBase foundItem1
= InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_ua1.PrincipalID, m_item1Name); = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_uaMT.PrincipalID, m_item1Name);
Assert.That( Assert.That(
foundItem1.CreatorId, Is.EqualTo(m_ua3.PrincipalID.ToString()), foundItem1.CreatorId, Is.EqualTo(m_uaLL2.PrincipalID.ToString()),
"Loaded item non-uuid creator doesn't match original"); "Loaded item non-uuid creator doesn't match original");
Assert.That( Assert.That(
foundItem1.CreatorIdAsUuid, Is.EqualTo(m_ua3.PrincipalID), foundItem1.CreatorIdAsUuid, Is.EqualTo(m_uaLL2.PrincipalID),
"Loaded item uuid creator doesn't match original"); "Loaded item uuid creator doesn't match original");
Assert.That(foundItem1.Owner, Is.EqualTo(m_ua1.PrincipalID), Assert.That(foundItem1.Owner, Is.EqualTo(m_uaMT.PrincipalID),
"Loaded item owner doesn't match inventory reciever"); "Loaded item owner doesn't match inventory reciever");
AssetBase asset1 = m_scene.AssetService.Get(foundItem1.AssetID.ToString()); AssetBase asset1 = m_scene.AssetService.Get(foundItem1.AssetID.ToString());
string xmlData = Utils.BytesToString(asset1.Data); string xmlData = Utils.BytesToString(asset1.Data);
SceneObjectGroup sog1 = SceneObjectSerializer.FromOriginalXmlFormat(xmlData); SceneObjectGroup sog1 = SceneObjectSerializer.FromOriginalXmlFormat(xmlData);
Assert.That(sog1.RootPart.CreatorID, Is.EqualTo(m_ua3.PrincipalID)); Assert.That(sog1.RootPart.CreatorID, Is.EqualTo(m_uaLL2.PrincipalID));
} }
/// <summary> /// <summary>
@ -221,25 +221,25 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
TestHelper.InMethod(); TestHelper.InMethod();
// log4net.Config.XmlConfigurator.Configure(); // log4net.Config.XmlConfigurator.Configure();
UserProfileTestUtils.CreateUserWithInventory(m_scene, m_ua1, "password"); UserProfileTestUtils.CreateUserWithInventory(m_scene, m_uaMT, "password");
m_archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "/", "password", m_iarStream); m_archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "/", "password", m_iarStream);
InventoryItemBase foundItem1 InventoryItemBase foundItem1
= InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_ua1.PrincipalID, m_item1Name); = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_uaMT.PrincipalID, m_item1Name);
Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1"); Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1");
Assert.That( Assert.That(
foundItem1.CreatorId, Is.EqualTo(m_ua1.PrincipalID.ToString()), foundItem1.CreatorId, Is.EqualTo(m_uaMT.PrincipalID.ToString()),
"Loaded item non-uuid creator doesn't match that of the loading user"); "Loaded item non-uuid creator doesn't match that of the loading user");
Assert.That( Assert.That(
foundItem1.CreatorIdAsUuid, Is.EqualTo(m_ua1.PrincipalID), foundItem1.CreatorIdAsUuid, Is.EqualTo(m_uaMT.PrincipalID),
"Loaded item uuid creator doesn't match that of the loading user"); "Loaded item uuid creator doesn't match that of the loading user");
AssetBase asset1 = m_scene.AssetService.Get(foundItem1.AssetID.ToString()); AssetBase asset1 = m_scene.AssetService.Get(foundItem1.AssetID.ToString());
string xmlData = Utils.BytesToString(asset1.Data); string xmlData = Utils.BytesToString(asset1.Data);
SceneObjectGroup sog1 = SceneObjectSerializer.FromOriginalXmlFormat(xmlData); SceneObjectGroup sog1 = SceneObjectSerializer.FromOriginalXmlFormat(xmlData);
Assert.That(sog1.RootPart.CreatorID, Is.EqualTo(m_ua1.PrincipalID)); Assert.That(sog1.RootPart.CreatorID, Is.EqualTo(m_uaMT.PrincipalID));
} }
} }
} }

View File

@ -184,31 +184,31 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
UserProfileTestUtils.CreateUserWithInventory(scene, m_ua1, "meowfood"); UserProfileTestUtils.CreateUserWithInventory(scene, m_uaMT, "meowfood");
UserProfileTestUtils.CreateUserWithInventory(scene, m_ua2, "hampshire"); UserProfileTestUtils.CreateUserWithInventory(scene, m_uaLL1, "hampshire");
archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "/", "meowfood", m_iarStream); archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "/", "meowfood", m_iarStream);
InventoryItemBase foundItem1 InventoryItemBase foundItem1
= InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_ua1.PrincipalID, m_item1Name); = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_uaMT.PrincipalID, m_item1Name);
Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1"); Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1");
// Now try loading to a root child folder // Now try loading to a root child folder
UserInventoryTestUtils.CreateInventoryFolder(scene.InventoryService, m_ua1.PrincipalID, "xA"); UserInventoryTestUtils.CreateInventoryFolder(scene.InventoryService, m_uaMT.PrincipalID, "xA");
MemoryStream archiveReadStream = new MemoryStream(m_iarStream.ToArray()); MemoryStream archiveReadStream = new MemoryStream(m_iarStream.ToArray());
archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "xA", "meowfood", archiveReadStream); archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "xA", "meowfood", archiveReadStream);
InventoryItemBase foundItem2 InventoryItemBase foundItem2
= InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_ua1.PrincipalID, "xA/" + m_item1Name); = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_uaMT.PrincipalID, "xA/" + m_item1Name);
Assert.That(foundItem2, Is.Not.Null, "Didn't find loaded item 2"); Assert.That(foundItem2, Is.Not.Null, "Didn't find loaded item 2");
// Now try loading to a more deeply nested folder // Now try loading to a more deeply nested folder
UserInventoryTestUtils.CreateInventoryFolder(scene.InventoryService, m_ua1.PrincipalID, "xB/xC"); UserInventoryTestUtils.CreateInventoryFolder(scene.InventoryService, m_uaMT.PrincipalID, "xB/xC");
archiveReadStream = new MemoryStream(archiveReadStream.ToArray()); archiveReadStream = new MemoryStream(archiveReadStream.ToArray());
archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "xB/xC", "meowfood", archiveReadStream); archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "xB/xC", "meowfood", archiveReadStream);
InventoryItemBase foundItem3 InventoryItemBase foundItem3
= InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_ua1.PrincipalID, "xB/xC/" + m_item1Name); = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_uaMT.PrincipalID, "xB/xC/" + m_item1Name);
Assert.That(foundItem3, Is.Not.Null, "Didn't find loaded item 3"); Assert.That(foundItem3, Is.Not.Null, "Didn't find loaded item 3");
} }
@ -226,12 +226,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
Scene scene = SceneSetupHelpers.SetupScene("inventory"); Scene scene = SceneSetupHelpers.SetupScene("inventory");
SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
UserProfileTestUtils.CreateUserWithInventory(scene, m_ua1, "password"); UserProfileTestUtils.CreateUserWithInventory(scene, m_uaMT, "password");
archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "/Objects", "password", m_iarStream); archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "/Objects", "password", m_iarStream);
InventoryItemBase foundItem1 InventoryItemBase foundItem1
= InventoryArchiveUtils.FindItemByPath( = InventoryArchiveUtils.FindItemByPath(
scene.InventoryService, m_ua1.PrincipalID, "/Objects/" + m_item1Name); scene.InventoryService, m_uaMT.PrincipalID, "/Objects/" + m_item1Name);
Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1 in TestLoadIarFolderStartsWithSlash()"); Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1 in TestLoadIarFolderStartsWithSlash()");
} }