* Write basic, incomplete load iar test
parent
de1aef9499
commit
d69a018ba8
|
@ -76,9 +76,7 @@ namespace OpenSim.Framework.Serialization.External
|
||||||
reader.ReadStartElement("InvType");
|
reader.ReadStartElement("InvType");
|
||||||
item.InvType = Convert.ToInt32(reader.ReadString());
|
item.InvType = Convert.ToInt32(reader.ReadString());
|
||||||
reader.ReadEndElement();
|
reader.ReadEndElement();
|
||||||
reader.ReadStartElement("CreatorUUID");
|
item.CreatorId = reader.ReadElementString("CreatorUUID");
|
||||||
item.CreatorId = reader.ReadString();
|
|
||||||
reader.ReadEndElement();
|
|
||||||
reader.ReadStartElement("CreationDate");
|
reader.ReadStartElement("CreationDate");
|
||||||
item.CreationDate = Convert.ToInt32(reader.ReadString());
|
item.CreationDate = Convert.ToInt32(reader.ReadString());
|
||||||
reader.ReadEndElement();
|
reader.ReadEndElement();
|
||||||
|
|
|
@ -35,17 +35,18 @@ using OpenMetaverse;
|
||||||
using OpenSim.Data;
|
using OpenSim.Data;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Serialization;
|
using OpenSim.Framework.Serialization;
|
||||||
|
using OpenSim.Framework.Serialization.External;
|
||||||
using OpenSim.Framework.Communications;
|
using OpenSim.Framework.Communications;
|
||||||
using OpenSim.Framework.Communications.Cache;
|
using OpenSim.Framework.Communications.Cache;
|
||||||
using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver;
|
using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver;
|
||||||
using OpenSim.Region.CoreModules.World.Archiver;
|
using OpenSim.Region.CoreModules.World.Serialiser;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
using OpenSim.Tests.Common;
|
using OpenSim.Tests.Common;
|
||||||
using OpenSim.Tests.Common.Setup;
|
using OpenSim.Tests.Common.Setup;
|
||||||
|
|
||||||
namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
||||||
{
|
{
|
||||||
[TestFixture, LongRunning]
|
[TestFixture]
|
||||||
public class InventoryArchiverTests
|
public class InventoryArchiverTests
|
||||||
{
|
{
|
||||||
private void SaveCompleted(
|
private void SaveCompleted(
|
||||||
|
@ -189,72 +190,57 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
||||||
// TODO: Test presence of more files and contents of files.
|
// TODO: Test presence of more files and contents of files.
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 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).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void TestLoadIarV0p1()
|
public void TestLoadIarV0p1()
|
||||||
{
|
{
|
||||||
//log4net.Config.XmlConfigurator.Configure();
|
Console.WriteLine("Started TestLoadIarV0p1()");
|
||||||
|
|
||||||
|
log4net.Config.XmlConfigurator.Configure();
|
||||||
|
|
||||||
|
string userFirstName = "Mr";
|
||||||
|
string userLastName = "Tiddles";
|
||||||
|
string folderName = "a";
|
||||||
|
string archiveFolderName
|
||||||
|
= string.Format("{0}{1}{2}", folderName, ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR, UUID.Random());
|
||||||
|
string itemName = "b.lsl";
|
||||||
|
string archiveItemName
|
||||||
|
= string.Format("{0}{1}{2}", itemName, "_", UUID.Random());
|
||||||
|
|
||||||
MemoryStream archiveWriteStream = new MemoryStream();
|
MemoryStream archiveWriteStream = new MemoryStream();
|
||||||
TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream);
|
TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream);
|
||||||
|
|
||||||
string item1FileName = string.Format("{0}{1}/{2}", INVENTORY_PATH, "a", "b.lsl");
|
InventoryItemBase item1 = new InventoryItemBase();
|
||||||
tar.WriteFile(item1FileName, item1.
|
item1.Name = itemName;
|
||||||
|
item1.AssetID = UUID.Random();
|
||||||
string part1Name = "object1";
|
item1.GroupID = UUID.Random();
|
||||||
PrimitiveBaseShape shape = PrimitiveBaseShape.CreateCylinder();
|
|
||||||
Vector3 groupPosition = new Vector3(90, 80, 70);
|
|
||||||
Quaternion rotationOffset = new Quaternion(60, 70, 80, 90);
|
|
||||||
Vector3 offsetPosition = new Vector3(20, 25, 30);
|
|
||||||
|
|
||||||
SerialiserModule serialiserModule = new SerialiserModule();
|
|
||||||
ArchiverModule archiverModule = new ArchiverModule();
|
|
||||||
|
|
||||||
Scene scene = SceneSetupHelpers.SetupScene();
|
|
||||||
SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
|
|
||||||
|
|
||||||
SceneObjectPart part1
|
|
||||||
= new SceneObjectPart(
|
|
||||||
UUID.Zero, shape, groupPosition, rotationOffset, offsetPosition);
|
|
||||||
part1.Name = part1Name;
|
|
||||||
SceneObjectGroup object1 = new SceneObjectGroup(part1);
|
|
||||||
scene.AddNewSceneObject(object1, false);
|
|
||||||
|
|
||||||
string object1FileName = string.Format(
|
|
||||||
"{0}_{1:000}-{2:000}-{3:000}__{4}.xml",
|
|
||||||
part1Name,
|
|
||||||
Math.Round(groupPosition.X), Math.Round(groupPosition.Y), Math.Round(groupPosition.Z),
|
|
||||||
part1.UUID);
|
|
||||||
tar.WriteFile(ArchiveConstants.OBJECTS_PATH + object1FileName, object1.ToXmlString2());
|
|
||||||
|
|
||||||
|
string item1FileName
|
||||||
|
= string.Format("{0}{1}/{2}", ArchiveConstants.INVENTORY_PATH, archiveFolderName, archiveItemName);
|
||||||
|
tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1));
|
||||||
tar.Close();
|
tar.Close();
|
||||||
|
|
||||||
MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray());
|
MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray());
|
||||||
|
|
||||||
// SerialiserModule serialiserModule = new SerialiserModule();
|
SerialiserModule serialiserModule = new SerialiserModule();
|
||||||
// ArchiverModule archiverModule = new ArchiverModule();
|
InventoryArchiverModule archiverModule = new InventoryArchiverModule();
|
||||||
|
|
||||||
// Scene scene = SceneSetupHelpers.SetupScene();
|
// Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene
|
||||||
// SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
|
Scene scene = SceneSetupHelpers.SetupScene();
|
||||||
|
SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
|
||||||
|
scene.CommsManager.UserAdminService.AddUser(userFirstName, userLastName, "meowfood", String.Empty, 1000, 1000);
|
||||||
|
archiverModule.DearchiveInventory(userFirstName, userLastName, "/", archiveReadStream);
|
||||||
|
|
||||||
archiverModule.DearchiveRegion(archiveReadStream);
|
CachedUserInfo userInfo = scene.CommsManager.UserProfileCacheService.GetUserDetails(userFirstName, userLastName);
|
||||||
|
InventoryFolderImpl foundFolder = userInfo.RootFolder.FindFolderByPath(folderName);
|
||||||
|
Assert.That(foundFolder, Is.Not.Null, string.Format("Folder {0} not found on load", folderName));
|
||||||
|
|
||||||
SceneObjectPart object1PartLoaded = scene.GetSceneObjectPart(part1Name);
|
InventoryItemBase foundItem = foundFolder.FindItemByPath(itemName);
|
||||||
|
Assert.That(foundItem, Is.Not.Null, string.Format("Item {0} not found on load", itemName));
|
||||||
|
|
||||||
Assert.That(object1PartLoaded, Is.Not.Null, "object1 was not loaded");
|
Console.WriteLine("Finished TestLoadIarV0p1()");
|
||||||
Assert.That(object1PartLoaded.Name, Is.EqualTo(part1Name), "object1 names not identical");
|
|
||||||
Assert.That(object1PartLoaded.GroupPosition, Is.EqualTo(groupPosition), "object1 group position not equal");
|
|
||||||
Assert.That(
|
|
||||||
object1PartLoaded.RotationOffset, Is.EqualTo(rotationOffset), "object1 rotation offset not equal");
|
|
||||||
Assert.That(
|
|
||||||
object1PartLoaded.OffsetPosition, Is.EqualTo(offsetPosition), "object1 offset position not equal");
|
|
||||||
|
|
||||||
// Temporary
|
|
||||||
Console.WriteLine("Successfully completed {0}", MethodBase.GetCurrentMethod());
|
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -225,12 +225,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
|
||||||
|
|
||||||
MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray());
|
MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray());
|
||||||
|
|
||||||
// SerialiserModule serialiserModule = new SerialiserModule();
|
|
||||||
// ArchiverModule archiverModule = new ArchiverModule();
|
|
||||||
|
|
||||||
// Scene scene = SceneSetupHelpers.SetupScene();
|
|
||||||
// SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
|
|
||||||
|
|
||||||
archiverModule.DearchiveRegion(archiveReadStream);
|
archiverModule.DearchiveRegion(archiveReadStream);
|
||||||
|
|
||||||
SceneObjectPart object1PartLoaded = scene.GetSceneObjectPart(part1Name);
|
SceneObjectPart object1PartLoaded = scene.GetSceneObjectPart(part1Name);
|
||||||
|
|
Loading…
Reference in New Issue