29 using System.Collections.Generic;
30 using System.Reflection;
31 using System.Threading;
35 using NUnit.Framework;
37 using OpenSim.Framework;
38 using OpenSim.Framework.Serialization.External;
39 using OpenSim.Region.Framework.Scenes;
40 using OpenSim.Region.Framework.Scenes.Serialization;
41 using OpenSim.Services.Interfaces;
42 using OpenSim.Tests.Common;
44 namespace OpenSim.
Region.Framework.Scenes.Tests
59 TestHelpers.InMethod();
62 int partsToTestCount = 3;
65 = SceneHelpers.CreateSceneObject(partsToTestCount, TestHelpers.ParseTail(0x1),
"obj1", 0x10);
68 so.Description =
"xpto";
70 string xml = SceneObjectSerializer.ToXml2Format(so);
71 Assert.That(!string.IsNullOrEmpty(xml),
"SOG serialization resulted in empty or null string");
73 XmlDocument doc =
new XmlDocument();
75 XmlNodeList nodes = doc.GetElementsByTagName(
"SceneObjectPart");
76 Assert.That(nodes.Count, Is.EqualTo(3),
"SOG serialization resulted in wrong number of SOPs");
79 Assert.IsNotNull(so2,
"SOG deserialization resulted in null object");
80 Assert.That(so2.Name == so.Name,
"Name of deserialized object does not match original name");
81 Assert.That(so2.Description == so.Description,
"Description of deserialized object does not match original name");
90 TestHelpers.InMethod();
94 scene.UserAccountService.StoreUserAccount(account);
95 int partsToTestCount = 1;
98 = SceneHelpers.CreateSceneObject(partsToTestCount, TestHelpers.ParseTail(0x1),
"obj1", 0x10);
101 so.Description =
"xpto";
102 so.OwnerID = account.PrincipalID;
103 so.RootPart.CreatorID = so.OwnerID;
105 string xml = SceneObjectSerializer.ToXml2Format(so);
106 Assert.That(!string.IsNullOrEmpty(xml),
"SOG serialization resulted in empty or null string");
108 xml = ExternalRepresentationUtils.RewriteSOP(xml,
"Test Scene",
"http://localhost", scene.UserAccountService, UUID.Zero);
111 XmlDocument doc =
new XmlDocument();
114 XmlNodeList nodes = doc.GetElementsByTagName(
"SceneObjectPart");
115 Assert.That(nodes.Count, Is.GreaterThan(0),
"SOG serialization resulted in no SOPs");
116 foreach (XmlAttribute a
in nodes[0].Attributes)
118 int count = a.Name.Count(c => c ==
':');
119 Assert.That(count, Is.EqualTo(1),
"Cannot have multiple ':' in attribute name in SOP");
121 nodes = doc.GetElementsByTagName(
"CreatorData");
122 Assert.That(nodes.Count, Is.GreaterThan(0),
"SOG serialization resulted in no CreatorData");
123 foreach (XmlAttribute a
in nodes[0].Attributes)
125 int count = a.Name.Count(c => c ==
':');
126 Assert.That(count, Is.EqualTo(1),
"Cannot have multiple ':' in attribute name in CreatorData");
130 Assert.IsNotNull(so2,
"SOG deserialization resulted in null object");
131 Assert.AreNotEqual(so.RootPart.CreatorIdentification, so2.RootPart.CreatorIdentification,
"RewriteSOP failed to transform CreatorData.");
132 Assert.That(so2.RootPart.CreatorIdentification.Contains(
"http://"),
"RewriteSOP failed to add the homeURL to CreatorData");
A scene object group is conceptually an object in the scene. The object is constituted of SceneObject...
void TestSerialDeserial()
Serialize and deserialize.
Basic scene object serialization tests.
Helpers for setting up scenes.
void TestNamespaceAttribute()
This checks for a bug reported in mantis #7514