diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Serialiser')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs | 132 |
2 files changed, 129 insertions, 5 deletions
diff --git a/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs b/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs index c2a693a..79062da 100644 --- a/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs +++ b/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs | |||
@@ -128,7 +128,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser | |||
128 | return SceneXmlLoader.DeserializeGroupFromXml2(xmlString); | 128 | return SceneXmlLoader.DeserializeGroupFromXml2(xmlString); |
129 | } | 129 | } |
130 | 130 | ||
131 | public string SaveGroupToXml2(SceneObjectGroup grp) | 131 | public string SerializeGroupToXml2(SceneObjectGroup grp) |
132 | { | 132 | { |
133 | return SceneXmlLoader.SaveGroupToXml2(grp); | 133 | return SceneXmlLoader.SaveGroupToXml2(grp); |
134 | } | 134 | } |
diff --git a/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs b/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs index 832c99e..617cc25 100644 --- a/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs +++ b/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs | |||
@@ -9,7 +9,7 @@ | |||
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSimulator Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
@@ -41,6 +41,114 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests | |||
41 | [TestFixture] | 41 | [TestFixture] |
42 | public class SerialiserTests | 42 | public class SerialiserTests |
43 | { | 43 | { |
44 | private string xml = @" | ||
45 | <SceneObjectGroup> | ||
46 | <RootPart> | ||
47 | <SceneObjectPart xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema""> | ||
48 | <AllowedDrop>false</AllowedDrop> | ||
49 | <CreatorID><Guid>a6dacf01-4636-4bb9-8a97-30609438af9d</Guid></CreatorID> | ||
50 | <FolderID><Guid>e6a5a05e-e8cc-4816-8701-04165e335790</Guid></FolderID> | ||
51 | <InventorySerial>1</InventorySerial> | ||
52 | <TaskInventory /> | ||
53 | <ObjectFlags>0</ObjectFlags> | ||
54 | <UUID><Guid>e6a5a05e-e8cc-4816-8701-04165e335790</Guid></UUID> | ||
55 | <LocalId>2698615125</LocalId> | ||
56 | <Name>Primitive</Name> | ||
57 | <Material>0</Material> | ||
58 | <PassTouches>false</PassTouches> | ||
59 | <RegionHandle>1099511628032000</RegionHandle> | ||
60 | <ScriptAccessPin>0</ScriptAccessPin> | ||
61 | <GroupPosition><X>147.23</X><Y>92.698</Y><Z>22.78084</Z></GroupPosition> | ||
62 | <OffsetPosition><X>0</X><Y>0</Y><Z>0</Z></OffsetPosition> | ||
63 | <RotationOffset><X>-4.371139E-08</X><Y>-1</Y><Z>-4.371139E-08</Z><W>0</W></RotationOffset> | ||
64 | <Velocity><X>0</X><Y>0</Y><Z>0</Z></Velocity> | ||
65 | <RotationalVelocity><X>0</X><Y>0</Y><Z>0</Z></RotationalVelocity> | ||
66 | <AngularVelocity><X>0</X><Y>0</Y><Z>0</Z></AngularVelocity> | ||
67 | <Acceleration><X>0</X><Y>0</Y><Z>0</Z></Acceleration> | ||
68 | <Description /> | ||
69 | <Color /> | ||
70 | <Text /> | ||
71 | <SitName /> | ||
72 | <TouchName /> | ||
73 | <LinkNum>0</LinkNum> | ||
74 | <ClickAction>0</ClickAction> | ||
75 | <Shape> | ||
76 | <ProfileCurve>1</ProfileCurve> | ||
77 | <TextureEntry>AAAAAAAAERGZmQAAAAAABQCVlZUAAAAAQEAAAABAQAAAAAAAAAAAAAAAAAAAAA==</TextureEntry> | ||
78 | <ExtraParams>AA==</ExtraParams> | ||
79 | <PathBegin>0</PathBegin> | ||
80 | <PathCurve>16</PathCurve> | ||
81 | <PathEnd>0</PathEnd> | ||
82 | <PathRadiusOffset>0</PathRadiusOffset> | ||
83 | <PathRevolutions>0</PathRevolutions> | ||
84 | <PathScaleX>100</PathScaleX> | ||
85 | <PathScaleY>100</PathScaleY> | ||
86 | <PathShearX>0</PathShearX> | ||
87 | <PathShearY>0</PathShearY> | ||
88 | <PathSkew>0</PathSkew> | ||
89 | <PathTaperX>0</PathTaperX> | ||
90 | <PathTaperY>0</PathTaperY> | ||
91 | <PathTwist>0</PathTwist> | ||
92 | <PathTwistBegin>0</PathTwistBegin> | ||
93 | <PCode>9</PCode> | ||
94 | <ProfileBegin>0</ProfileBegin> | ||
95 | <ProfileEnd>0</ProfileEnd> | ||
96 | <ProfileHollow>0</ProfileHollow> | ||
97 | <Scale><X>10</X><Y>10</Y><Z>0.5</Z></Scale> | ||
98 | <State>0</State> | ||
99 | <ProfileShape>Square</ProfileShape> | ||
100 | <HollowShape>Same</HollowShape> | ||
101 | <SculptTexture><Guid>00000000-0000-0000-0000-000000000000</Guid></SculptTexture> | ||
102 | <SculptType>0</SculptType><SculptData /> | ||
103 | <FlexiSoftness>0</FlexiSoftness> | ||
104 | <FlexiTension>0</FlexiTension> | ||
105 | <FlexiDrag>0</FlexiDrag> | ||
106 | <FlexiGravity>0</FlexiGravity> | ||
107 | <FlexiWind>0</FlexiWind> | ||
108 | <FlexiForceX>0</FlexiForceX> | ||
109 | <FlexiForceY>0</FlexiForceY> | ||
110 | <FlexiForceZ>0</FlexiForceZ> | ||
111 | <LightColorR>0</LightColorR> | ||
112 | <LightColorG>0</LightColorG> | ||
113 | <LightColorB>0</LightColorB> | ||
114 | <LightColorA>1</LightColorA> | ||
115 | <LightRadius>0</LightRadius> | ||
116 | <LightCutoff>0</LightCutoff> | ||
117 | <LightFalloff>0</LightFalloff> | ||
118 | <LightIntensity>1</LightIntensity> | ||
119 | <FlexiEntry>false</FlexiEntry> | ||
120 | <LightEntry>false</LightEntry> | ||
121 | <SculptEntry>false</SculptEntry> | ||
122 | </Shape> | ||
123 | <Scale><X>10</X><Y>10</Y><Z>0.5</Z></Scale> | ||
124 | <UpdateFlag>0</UpdateFlag> | ||
125 | <SitTargetOrientation><X>0</X><Y>0</Y><Z>0</Z><W>1</W></SitTargetOrientation> | ||
126 | <SitTargetPosition><X>0</X><Y>0</Y><Z>0</Z></SitTargetPosition> | ||
127 | <SitTargetPositionLL><X>0</X><Y>0</Y><Z>0</Z></SitTargetPositionLL> | ||
128 | <SitTargetOrientationLL><X>0</X><Y>0</Y><Z>0</Z><W>1</W></SitTargetOrientationLL> | ||
129 | <ParentID>0</ParentID> | ||
130 | <CreationDate>1211330445</CreationDate> | ||
131 | <Category>0</Category> | ||
132 | <SalePrice>0</SalePrice> | ||
133 | <ObjectSaleType>0</ObjectSaleType> | ||
134 | <OwnershipCost>0</OwnershipCost> | ||
135 | <GroupID><Guid>00000000-0000-0000-0000-000000000000</Guid></GroupID> | ||
136 | <OwnerID><Guid>a6dacf01-4636-4bb9-8a97-30609438af9d</Guid></OwnerID> | ||
137 | <LastOwnerID><Guid>a6dacf01-4636-4bb9-8a97-30609438af9d</Guid></LastOwnerID> | ||
138 | <BaseMask>2147483647</BaseMask> | ||
139 | <OwnerMask>2147483647</OwnerMask> | ||
140 | <GroupMask>0</GroupMask> | ||
141 | <EveryoneMask>0</EveryoneMask> | ||
142 | <NextOwnerMask>2147483647</NextOwnerMask> | ||
143 | <Flags>None</Flags> | ||
144 | <CollisionSound><Guid>00000000-0000-0000-0000-000000000000</Guid></CollisionSound> | ||
145 | <CollisionSoundVolume>0</CollisionSoundVolume> | ||
146 | </SceneObjectPart> | ||
147 | </RootPart> | ||
148 | <OtherParts /> | ||
149 | </SceneObjectGroup> | ||
150 | "; | ||
151 | |||
44 | private string xml2 = @" | 152 | private string xml2 = @" |
45 | <SceneObjectGroup> | 153 | <SceneObjectGroup> |
46 | <SceneObjectPart xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema""> | 154 | <SceneObjectPart xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema""> |
@@ -133,8 +241,24 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests | |||
133 | SceneSetupHelpers.SetupSceneModules(m_scene, m_serialiserModule); | 241 | SceneSetupHelpers.SetupSceneModules(m_scene, m_serialiserModule); |
134 | } | 242 | } |
135 | 243 | ||
244 | // [Test] | ||
245 | // public void TestLoadXml() | ||
246 | // { | ||
247 | // TestHelper.InMethod(); | ||
248 | // //log4net.Config.XmlConfigurator.Configure(); | ||
249 | // | ||
250 | // SceneObjectGroup so = m_serialiserModule.DeserializeGroupFromXml2(xml2); | ||
251 | // SceneObjectPart rootPart = so.RootPart; | ||
252 | // | ||
253 | // Assert.That(rootPart.UUID, Is.EqualTo(new UUID("9be68fdd-f740-4a0f-9675-dfbbb536b946"))); | ||
254 | // Assert.That(rootPart.CreatorID, Is.EqualTo(new UUID("b46ef588-411e-4a8b-a284-d7dcfe8e74ef"))); | ||
255 | // Assert.That(rootPart.Name, Is.EqualTo("PrimFun")); | ||
256 | // | ||
257 | // // TODO: Check other properties | ||
258 | // } | ||
259 | |||
136 | [Test] | 260 | [Test] |
137 | public void TestLoadXml2() | 261 | public void TestDeserializeXml2() |
138 | { | 262 | { |
139 | TestHelper.InMethod(); | 263 | TestHelper.InMethod(); |
140 | //log4net.Config.XmlConfigurator.Configure(); | 264 | //log4net.Config.XmlConfigurator.Configure(); |
@@ -150,7 +274,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests | |||
150 | } | 274 | } |
151 | 275 | ||
152 | [Test] | 276 | [Test] |
153 | public void TestSaveXml2() | 277 | public void TestSerializeXml2() |
154 | { | 278 | { |
155 | TestHelper.InMethod(); | 279 | TestHelper.InMethod(); |
156 | //log4net.Config.XmlConfigurator.Configure(); | 280 | //log4net.Config.XmlConfigurator.Configure(); |
@@ -174,7 +298,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests | |||
174 | // Need to add the object to the scene so that the request to get script state succeeds | 298 | // Need to add the object to the scene so that the request to get script state succeeds |
175 | m_scene.AddSceneObject(so); | 299 | m_scene.AddSceneObject(so); |
176 | 300 | ||
177 | string xml2 = m_serialiserModule.SaveGroupToXml2(so); | 301 | string xml2 = m_serialiserModule.SerializeGroupToXml2(so); |
178 | 302 | ||
179 | XmlTextReader xtr = new XmlTextReader(new StringReader(xml2)); | 303 | XmlTextReader xtr = new XmlTextReader(new StringReader(xml2)); |
180 | xtr.ReadStartElement("SceneObjectGroup"); | 304 | xtr.ReadStartElement("SceneObjectGroup"); |