* extend load oar test to check that an object was actually loaded

0.6.3-post-fixes
Justin Clarke Casey 2009-02-10 16:56:35 +00:00
parent ecb29774ac
commit 879338499f
1 changed files with 36 additions and 4 deletions

View File

@ -57,7 +57,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
[Test]
public void TestSaveOarV0p2()
{
log4net.Config.XmlConfigurator.Configure();
//log4net.Config.XmlConfigurator.Configure();
ArchiverModule archiverModule = new ArchiverModule();
SerialiserModule serialiserModule = new SerialiserModule();
@ -162,27 +162,59 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
}
/// <summary>
/// Test loading a V0.2 OpenSim Region Archive. Does not yet do what it says on the tin.
/// Test loading a V0.2 OpenSim Region Archive.
/// </summary>
[Test]
public void TestLoadOarV0p2()
{
log4net.Config.XmlConfigurator.Configure();
MemoryStream archiveWriteStream = new MemoryStream();
TarArchiveWriter tar = new TarArchiveWriter();
tar.AddFile(ArchiveConstants.CONTROL_FILE_PATH, ArchiveWriteRequestExecution.Create0p2ControlFile());
UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000020");
string part1Name = "object1";
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);
SceneObjectPart part1
= new SceneObjectPart(
UUID.Zero, shape, groupPosition, rotationOffset, offsetPosition);
part1.Name = part1Name;
SceneObjectGroup object1 = new SceneObjectGroup(part1);
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.AddFile(ArchiveConstants.OBJECTS_PATH + object1FileName, object1.ToXmlString2());
tar.WriteTar(archiveWriteStream);
MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray());
SerialiserModule serialiserModule = new SerialiserModule();
ArchiverModule archiverModule = new ArchiverModule();
Scene scene = SceneSetupHelpers.SetupScene();
SceneSetupHelpers.SetupSceneModules(scene, archiverModule);
SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
archiverModule.DearchiveRegion(archiveReadStream);
SceneObjectPart object1PartLoaded = scene.GetSceneObjectPart(part1Name);
// TODO: Okay, so nothing is tested yet apart from the fact that it doesn't blow up
Assert.That(object1PartLoaded, Is.Not.Null, "object1 was not loaded");
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");
}
}
}