diff --git a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs index 129d6d3156..c459a66122 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs @@ -101,7 +101,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver } } - private bool done = false; /// /// Called back by the asset cache when it has the asset /// @@ -127,14 +126,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver if (m_foundAssetUuids.Count + m_notFoundAssetUuids.Count == m_repliesRequired) { - if (done) - throw new Exception("AArgh"); - m_log.DebugFormat( - "[ARCHIVER]: Successfully added {0} assets ({1} assets missing)", + "[ARCHIVER]: Successfully added {0} assets ({1} assets notified missing)", m_foundAssetUuids.Count, m_notFoundAssetUuids.Count); - - done = true; // We want to stop using the asset cache thread asap // as we now need to do the work of producing the rest of the archive @@ -146,7 +140,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver } catch (Exception e) { - m_log.ErrorFormat("[ARCHIVER]: AssetRequestCallback failed with {0}", e); + m_log.ErrorFormat("[ARCHIVER]: AssetRequestCallback failed with {0}", e); } } diff --git a/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs b/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs index d028360621..c894d8e2be 100644 --- a/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs +++ b/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs @@ -147,8 +147,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests - - "; + "; private string xml2 = @" @@ -243,7 +242,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests } [Test] - public void TestSerializeXml() + public void TestDeserializeXml() { TestHelper.InMethod(); //log4net.Config.XmlConfigurator.Configure(); @@ -256,6 +255,77 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests Assert.That(rootPart.Name, Is.EqualTo("PrimMyRide")); // TODO: Check other properties + } + + [Test] + public void TestSerializeXml() + { + TestHelper.InMethod(); + //log4net.Config.XmlConfigurator.Configure(); + + string rpName = "My Little Donkey"; + UUID rpUuid = UUID.Parse("00000000-0000-0000-0000-000000000964"); + UUID rpCreatorId = UUID.Parse("00000000-0000-0000-0000-000000000915"); + PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere(); +// Vector3 groupPosition = new Vector3(10, 20, 30); +// Quaternion rotationOffset = new Quaternion(20, 30, 40, 50); +// Vector3 offsetPosition = new Vector3(5, 10, 15); + + SceneObjectPart rp = new SceneObjectPart(); + rp.UUID = rpUuid; + rp.Name = rpName; + rp.CreatorID = rpCreatorId; + rp.Shape = shape; + + SceneObjectGroup so = new SceneObjectGroup(rp); + + // Need to add the object to the scene so that the request to get script state succeeds + m_scene.AddSceneObject(so); + + string xml = SceneObjectSerializer.ToOriginalXmlFormat(so); + + XmlTextReader xtr = new XmlTextReader(new StringReader(xml)); + xtr.ReadStartElement("SceneObjectGroup"); + xtr.ReadStartElement("RootPart"); + xtr.ReadStartElement("SceneObjectPart"); + + UUID uuid = UUID.Zero; + string name = null; + UUID creatorId = UUID.Zero; + + while (xtr.Read() && xtr.Name != "SceneObjectPart") + { + if (xtr.NodeType != XmlNodeType.Element) + continue; + + switch (xtr.Name) + { + case "UUID": + xtr.ReadStartElement("UUID"); + uuid = UUID.Parse(xtr.ReadElementString("Guid")); + xtr.ReadEndElement(); + break; + case "Name": + name = xtr.ReadElementContentAsString(); + break; + case "CreatorID": + xtr.ReadStartElement("CreatorID"); + creatorId = UUID.Parse(xtr.ReadElementString("Guid")); + xtr.ReadEndElement(); + break; + } + } + + xtr.ReadEndElement(); + xtr.ReadEndElement(); + xtr.ReadStartElement("OtherParts"); + xtr.ReadEndElement(); + xtr.Close(); + + // TODO: More checks + Assert.That(uuid, Is.EqualTo(rpUuid)); + Assert.That(name, Is.EqualTo(rpName)); + Assert.That(creatorId, Is.EqualTo(rpCreatorId)); } [Test]