When setting up default iar for testing, use iar archiving code rather than constructing the tar manually

0.7.1-dev
Justin Clark-Casey (justincc) 2011-03-10 19:40:19 +00:00
parent 4dd60b7dce
commit a151afebe3
3 changed files with 17 additions and 13 deletions

View File

@ -96,11 +96,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
{ {
// log4net.Config.XmlConfigurator.Configure(); // log4net.Config.XmlConfigurator.Configure();
InventoryArchiverModule archiverModule = new InventoryArchiverModule();
Scene scene = SceneSetupHelpers.SetupScene("Inventory"); Scene scene = SceneSetupHelpers.SetupScene("Inventory");
SceneSetupHelpers.SetupSceneModules(scene, archiverModule);
UserProfileTestUtils.CreateUserWithInventory(scene, m_ua2, "hampshire"); UserProfileTestUtils.CreateUserWithInventory(scene, m_ua2, "hampshire");
MemoryStream archiveWriteStream = new MemoryStream(); MemoryStream archiveWriteStream = new MemoryStream();
TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream);
// Create asset // Create asset
SceneObjectGroup object1; SceneObjectGroup object1;
@ -129,18 +131,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
// Create item // Create item
InventoryItemBase item1 = new InventoryItemBase(); InventoryItemBase item1 = new InventoryItemBase();
item1.Name = m_item1Name; item1.Name = m_item1Name;
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_ua2.PrincipalID;
item1.Owner = UUID.Zero; item1.Owner = m_ua2.PrincipalID;
item1.Folder = scene.InventoryService.GetRootFolder(m_ua2.PrincipalID).ID;
string archiveItem1Name = InventoryArchiveWriteRequest.CreateArchiveItemName(m_item1Name, UUID.Random()); scene.AddInventoryItem(item1);
string archiveItem1Path = string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItem1Name);
tar.WriteFile( archiverModule.ArchiveInventory(
archiveItem1Path, Guid.NewGuid(), m_ua2.FirstName, m_ua2.LastName, m_item1Name, "hampshire", archiveWriteStream);
UserInventoryItemSerializer.Serialize(
item1, new Dictionary<string, object>(), scene.UserAccountService));
tar.Close();
m_iarStreamBytes = archiveWriteStream.ToArray(); m_iarStreamBytes = archiveWriteStream.ToArray();
} }

View File

@ -206,6 +206,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
"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_ua1.PrincipalID),
"Loaded item owner doesn't match inventory reciever"); "Loaded item owner doesn't match inventory reciever");
// AssetBase asset1 = scene.AssetService.Get(foundItem1.AssetID.ToString());
// string xmlData = Utils.BytesToString(asset1.Data);
// SceneObjectGroup sog1 = SceneObjectSerializer.FromOriginalXmlFormat(xmlData);
//
// Assert.That(sog1.RootPart.CreatorID, Is.EqualTo(m_ua3.PrincipalID.ToString()));
} }
/// <summary> /// <summary>

View File

@ -84,9 +84,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
Quaternion rotationOffset = new Quaternion(20, 30, 40, 50); Quaternion rotationOffset = new Quaternion(20, 30, 40, 50);
Vector3 offsetPosition = new Vector3(5, 10, 15); Vector3 offsetPosition = new Vector3(5, 10, 15);
part1 part1 = new SceneObjectPart(ownerId, shape, groupPosition, rotationOffset, offsetPosition);
= new SceneObjectPart(
ownerId, shape, groupPosition, rotationOffset, offsetPosition);
part1.Name = partName; part1.Name = partName;
object1 = new SceneObjectGroup(part1); object1 = new SceneObjectGroup(part1);