clockwerk-opensim – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 vero 1 /*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27  
28 using System.Collections.Generic;
29 using System.IO;
30 using System.Text;
31 using System.Xml;
32 using log4net.Config;
33 using NUnit.Framework;
34 using OpenMetaverse;
35 using OpenSim.Framework;
36 using OpenSim.Region.Framework.Scenes;
37 using OpenSim.Region.Framework.Scenes.Serialization;
38 using OpenSim.Tests.Common;
39 using OpenMetaverse.StructuredData;
40  
41 namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
42 {
43 [TestFixture]
44 public class SerialiserTests : OpenSimTestCase
45 {
46 private const string ObjectRootPartStubXml =
47 @"<SceneObjectGroup>
48 <RootPart>
49 <SceneObjectPart xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"">
50 <AllowedDrop>false</AllowedDrop>
51 <CreatorID><Guid>a6dacf01-4636-4bb9-8a97-30609438af9d</Guid></CreatorID>
52 <FolderID><Guid>e6a5a05e-e8cc-4816-8701-04165e335790</Guid></FolderID>
53 <InventorySerial>1</InventorySerial>
54 <TaskInventory />
55 <ObjectFlags>0</ObjectFlags>
56 <UUID><Guid>e6a5a05e-e8cc-4816-8701-04165e335790</Guid></UUID>
57 <LocalId>2698615125</LocalId>
58 <Name>PrimMyRide</Name>
59 <Material>0</Material>
60 <PassTouches>false</PassTouches>
61 <RegionHandle>1099511628032000</RegionHandle>
62 <ScriptAccessPin>0</ScriptAccessPin>
63 <GroupPosition><X>147.23</X><Y>92.698</Y><Z>22.78084</Z></GroupPosition>
64 <OffsetPosition><X>0</X><Y>0</Y><Z>0</Z></OffsetPosition>
65 <RotationOffset><X>-4.371139E-08</X><Y>-1</Y><Z>-4.371139E-08</Z><W>0</W></RotationOffset>
66 <Velocity><X>0</X><Y>0</Y><Z>0</Z></Velocity>
67 <RotationalVelocity><X>0</X><Y>0</Y><Z>0</Z></RotationalVelocity>
68 <AngularVelocity><X>0</X><Y>0</Y><Z>0</Z></AngularVelocity>
69 <Acceleration><X>0</X><Y>0</Y><Z>0</Z></Acceleration>
70 <Description />
71 <Color />
72 <Text />
73 <SitName />
74 <TouchName />
75 <LinkNum>0</LinkNum>
76 <ClickAction>0</ClickAction>
77 <Shape>
78 <ProfileCurve>1</ProfileCurve>
79 <TextureEntry>AAAAAAAAERGZmQAAAAAABQCVlZUAAAAAQEAAAABAQAAAAAAAAAAAAAAAAAAAAA==</TextureEntry>
80 <ExtraParams>AA==</ExtraParams>
81 <PathBegin>0</PathBegin>
82 <PathCurve>16</PathCurve>
83 <PathEnd>0</PathEnd>
84 <PathRadiusOffset>0</PathRadiusOffset>
85 <PathRevolutions>0</PathRevolutions>
86 <PathScaleX>100</PathScaleX>
87 <PathScaleY>100</PathScaleY>
88 <PathShearX>0</PathShearX>
89 <PathShearY>0</PathShearY>
90 <PathSkew>0</PathSkew>
91 <PathTaperX>0</PathTaperX>
92 <PathTaperY>0</PathTaperY>
93 <PathTwist>0</PathTwist>
94 <PathTwistBegin>0</PathTwistBegin>
95 <PCode>9</PCode>
96 <ProfileBegin>0</ProfileBegin>
97 <ProfileEnd>0</ProfileEnd>
98 <ProfileHollow>0</ProfileHollow>
99 <Scale><X>10</X><Y>10</Y><Z>0.5</Z></Scale>
100 <State>0</State>
101 <ProfileShape>Square</ProfileShape>
102 <HollowShape>Same</HollowShape>
103 <SculptTexture><Guid>00000000-0000-0000-0000-000000000000</Guid></SculptTexture>
104 <SculptType>0</SculptType><SculptData />
105 <FlexiSoftness>0</FlexiSoftness>
106 <FlexiTension>0</FlexiTension>
107 <FlexiDrag>0</FlexiDrag>
108 <FlexiGravity>0</FlexiGravity>
109 <FlexiWind>0</FlexiWind>
110 <FlexiForceX>0</FlexiForceX>
111 <FlexiForceY>0</FlexiForceY>
112 <FlexiForceZ>0</FlexiForceZ>
113 <LightColorR>0</LightColorR>
114 <LightColorG>0</LightColorG>
115 <LightColorB>0</LightColorB>
116 <LightColorA>1</LightColorA>
117 <LightRadius>0</LightRadius>
118 <LightCutoff>0</LightCutoff>
119 <LightFalloff>0</LightFalloff>
120 <LightIntensity>1</LightIntensity>
121 <FlexiEntry>false</FlexiEntry>
122 <LightEntry>false</LightEntry>
123 <SculptEntry>false</SculptEntry>
124 </Shape>
125 <Scale><X>10</X><Y>10</Y><Z>0.5</Z></Scale>
126 <UpdateFlag>0</UpdateFlag>
127 <SitTargetOrientation><X>0</X><Y>0</Y><Z>0</Z><W>1</W></SitTargetOrientation>
128 <SitTargetPosition><X>0</X><Y>0</Y><Z>0</Z></SitTargetPosition>
129 <SitTargetPositionLL><X>0</X><Y>0</Y><Z>0</Z></SitTargetPositionLL>
130 <SitTargetOrientationLL><X>0</X><Y>0</Y><Z>0</Z><W>1</W></SitTargetOrientationLL>
131 <ParentID>0</ParentID>
132 <CreationDate>1211330445</CreationDate>
133 <Category>0</Category>
134 <SalePrice>0</SalePrice>
135 <ObjectSaleType>0</ObjectSaleType>
136 <OwnershipCost>0</OwnershipCost>
137 <GroupID><Guid>00000000-0000-0000-0000-000000000000</Guid></GroupID>
138 <OwnerID><Guid>a6dacf01-4636-4bb9-8a97-30609438af9d</Guid></OwnerID>
139 <LastOwnerID><Guid>a6dacf01-4636-4bb9-8a97-30609438af9d</Guid></LastOwnerID>
140 <BaseMask>2147483647</BaseMask>
141 <OwnerMask>2147483647</OwnerMask>
142 <GroupMask>0</GroupMask>
143 <EveryoneMask>0</EveryoneMask>
144 <NextOwnerMask>2147483647</NextOwnerMask>
145 <Flags>None</Flags>
146 <CollisionSound><Guid>00000000-0000-0000-0000-000000000000</Guid></CollisionSound>
147 <CollisionSoundVolume>0</CollisionSoundVolume>
148 <DynAttrs>
149 <llsd>
150 <map>
151 <key>MyNamespace</key>
152 <map>
153 <key>MyStore</key>
154 <map>
155 <key>the answer</key>
156 <integer>42</integer>
157 </map>
158 </map>
159 </map>
160 </llsd>
161 </DynAttrs>
162 </SceneObjectPart>
163 </RootPart>";
164  
165 private const string ObjectWithNoOtherPartsXml = ObjectRootPartStubXml +
166 @"
167 <OtherParts />
168 </SceneObjectGroup>";
169  
170 private const string ObjectWithOtherPartsXml = ObjectRootPartStubXml +
171 @"
172 <OtherParts>
173 <Part>
174 <SceneObjectPart xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"">
175 <AllowedDrop>false</AllowedDrop>
176 <CreatorID><Guid>a6dacf01-4636-4bb9-8a97-30609438af9d</Guid></CreatorID>
177 <FolderID><Guid>9958feb1-02a6-49e4-a4ce-eba6f578ee13</Guid></FolderID>
178 <InventorySerial>3</InventorySerial>
179 <UUID><Guid>9958feb1-02a6-49e4-a4ce-eba6f578ee13</Guid></UUID>
180 <LocalId>1154704500</LocalId>
181 <Name>Alien Head 1</Name>
182 <Material>3</Material>
183 <PassTouches>false</PassTouches>
184 <PassCollisions>false</PassCollisions>
185 <RegionHandle>21990232560640000</RegionHandle>
186 <ScriptAccessPin>0</ScriptAccessPin>
187 <GroupPosition><X>125.5655</X><Y>127.346</Y><Z>22.48036</Z></GroupPosition>
188 <OffsetPosition><X>-0.2171936</X><Y>0.1083984</Y><Z>0.0009994507</Z></OffsetPosition>
189 <RotationOffset><X>-0.5122106</X><Y>0.4851225</Y><Z>-0.4957454</Z><W>0.5064908</W></RotationOffset>
190 <Velocity><X>0</X><Y>0</Y><Z>0</Z></Velocity>
191 <AngularVelocity><X>0</X><Y>0</Y><Z>0</Z></AngularVelocity>
192 <Acceleration><X>0</X><Y>0</Y><Z>0</Z></Acceleration>
193 <Description>(No Description)</Description>
194 <Color><R>0</R><G>0</G><B>0</B><A>255</A></Color>
195 <Text/>
196 <SitName/>
197 <TouchName/>
198 <LinkNum>253</LinkNum>
199 <ClickAction>0</ClickAction>
200 <Shape>
201 <ProfileCurve>5</ProfileCurve>
202 <TextureEntry>Vw3dpvgTRUOiIUOGsnpWlAB/f38AAAAAgL8AAACAPwAAAAAAAAAF4ABAAAAAAAAAAAAAAAAAAAAAAAAAAAAA</TextureEntry>
203 <ExtraParams>AA==</ExtraParams>
204 <PathBegin>0</PathBegin>
205 <PathCurve>32</PathCurve>
206 <PathEnd>0</PathEnd>
207 <PathRadiusOffset>0</PathRadiusOffset>
208 <PathRevolutions>0</PathRevolutions>
209 <PathScaleX>100</PathScaleX>
210 <PathScaleY>100</PathScaleY>
211 <PathShearX>0</PathShearX>
212 <PathShearY>0</PathShearY>
213 <PathSkew>0</PathSkew>
214 <PathTaperX>0</PathTaperX>
215 <PathTaperY>0</PathTaperY>
216 <PathTwist>0</PathTwist>
217 <PathTwistBegin>0</PathTwistBegin>
218 <PCode>9</PCode>
219 <ProfileBegin>0</ProfileBegin>
220 <ProfileEnd>0</ProfileEnd>
221 <ProfileHollow>0</ProfileHollow>
222 <State>9</State>
223 <LastAttachPoint>0</LastAttachPoint>
224 <ProfileShape>HalfCircle</ProfileShape>
225 <HollowShape>Same</HollowShape>
226 <SculptTexture><Guid>00000000-0000-0000-0000-000000000000</Guid></SculptTexture>
227 <SculptType>0</SculptType>
228 <FlexiSoftness>0</FlexiSoftness>
229 <FlexiTension>0</FlexiTension>
230 <FlexiDrag>0</FlexiDrag>
231 <FlexiGravity>0</FlexiGravity>
232 <FlexiWind>0</FlexiWind>
233 <FlexiForceX>0</FlexiForceX>
234 <FlexiForceY>0</FlexiForceY>
235 <FlexiForceZ>0</FlexiForceZ>
236 <LightColorR>0</LightColorR>
237 <LightColorG>0</LightColorG>
238 <LightColorB>0</LightColorB>
239 <LightColorA>1</LightColorA>
240 <LightRadius>0</LightRadius>
241 <LightCutoff>0</LightCutoff>
242 <LightFalloff>0</LightFalloff>
243 <LightIntensity>1</LightIntensity>
244 <FlexiEntry>false</FlexiEntry>
245 <LightEntry>false</LightEntry>
246 <SculptEntry>false</SculptEntry>
247 </Shape>
248 <Scale><X>0.1148195</X><Y>0.0143891</Y><Z>0.02768878</Z></Scale>
249 <SitTargetOrientation><X>0</X><Y>0</Y><Z>0</Z><W>1</W></SitTargetOrientation>
250 <SitTargetPosition><X>0</X><Y>0</Y><Z>0</Z></SitTargetPosition>
251 <SitTargetPositionLL><X>0</X><Y>0</Y><Z>0</Z></SitTargetPositionLL>
252 <SitTargetOrientationLL><X>0</X><Y>0</Y><Z>0</Z><W>1</W></SitTargetOrientationLL>
253 <ParentID>1154704499</ParentID>
254 <CreationDate>1256611042</CreationDate>
255 <Category>0</Category>
256 <SalePrice>10</SalePrice>
257 <ObjectSaleType>0</ObjectSaleType>
258 <OwnershipCost>0</OwnershipCost>
259 <GroupID><Guid>00000000-0000-0000-0000-000000000000</Guid></GroupID>
260 <OwnerID><Guid>7b2022f0-5f19-488c-b7e5-829d8f96b448</Guid></OwnerID>
261 <LastOwnerID><Guid>7b2022f0-5f19-488c-b7e5-829d8f96b448</Guid></LastOwnerID>
262 <BaseMask>647168</BaseMask>
263 <OwnerMask>647168</OwnerMask>
264 <GroupMask>0</GroupMask>
265 <EveryoneMask>0</EveryoneMask>
266 <NextOwnerMask>581632</NextOwnerMask>
267 <Flags>None</Flags>
268 <CollisionSound><Guid>00000000-0000-0000-0000-000000000000</Guid></CollisionSound>
269 <CollisionSoundVolume>0</CollisionSoundVolume>
270 <AttachedPos><X>0</X><Y>0</Y><Z>0</Z></AttachedPos>
271 <TextureAnimation/>
272 <ParticleSystem/>
273 <PayPrice0>-2</PayPrice0>
274 <PayPrice1>-2</PayPrice1>
275 <PayPrice2>-2</PayPrice2>
276 <PayPrice3>-2</PayPrice3>
277 <PayPrice4>-2</PayPrice4>
278 </SceneObjectPart>
279 </Part>
280 <Part>
281 <SceneObjectPart xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"">
282 <AllowedDrop>false</AllowedDrop>
283 <CreatorID><Guid>a6dacf01-4636-4bb9-8a97-30609438af9d</Guid></CreatorID>
284 <FolderID><Guid>674b6b86-f5aa-439a-8e00-0d75bc08c80a</Guid></FolderID>
285 <InventorySerial>3</InventorySerial>
286 <UUID><Guid>674b6b86-f5aa-439a-8e00-0d75bc08c80a</Guid></UUID>
287 <LocalId>1154704501</LocalId>
288 <Name>Alien Head 2</Name>
289 <Material>3</Material>
290 <PassTouches>false</PassTouches>
291 <PassCollisions>false</PassCollisions>
292 <RegionHandle>21990232560640000</RegionHandle>
293 <ScriptAccessPin>0</ScriptAccessPin>
294 <GroupPosition><X>125.5655</X><Y>127.346</Y><Z>22.48036</Z></GroupPosition>
295 <OffsetPosition><X>-0.2490997</X><Y>0.08520126</Y><Z>0.0009002686</Z></OffsetPosition>
296 <RotationOffset><X>-0.4765368</X><Y>0.5194498</Y><Z>-0.5301372</Z><W>0.4712104</W></RotationOffset>
297 <Velocity><X>0</X><Y>0</Y><Z>0</Z></Velocity>
298 <AngularVelocity><X>0</X><Y>0</Y><Z>0</Z></AngularVelocity>
299 <Acceleration><X>0</X><Y>0</Y><Z>0</Z></Acceleration>
300 <Description>(No Description)</Description>
301 <Color><R>0</R><G>0</G><B>0</B><A>255</A></Color>
302 <Text/>
303 <SitName/>
304 <TouchName/>
305 <LinkNum>252</LinkNum>
306 <ClickAction>0</ClickAction>
307 <Shape>
308 <ProfileCurve>0</ProfileCurve>
309 <TextureEntry>Vw3dpvgTRUOiIUOGsnpWlAB/f38AAAAAgL8AAACAPwAAAAAAAAAF4ABAAAAAAAAAAAAAAAAAAAAAAAAAAAAA</TextureEntry>
310 <ExtraParams>AA==</ExtraParams>
311 <PathBegin>0</PathBegin>
312 <PathCurve>32</PathCurve>
313 <PathEnd>0</PathEnd>
314 <PathRadiusOffset>0</PathRadiusOffset>
315 <PathRevolutions>0</PathRevolutions>
316 <PathScaleX>100</PathScaleX>
317 <PathScaleY>150</PathScaleY>
318 <PathShearX>0</PathShearX>
319 <PathShearY>0</PathShearY>
320 <PathSkew>0</PathSkew>
321 <PathTaperX>0</PathTaperX>
322 <PathTaperY>0</PathTaperY>
323 <PathTwist>0</PathTwist>
324 <PathTwistBegin>0</PathTwistBegin>
325 <PCode>9</PCode>
326 <ProfileBegin>0</ProfileBegin>
327 <ProfileEnd>0</ProfileEnd>
328 <ProfileHollow>0</ProfileHollow>
329 <State>9</State>
330 <LastAttachPoint>0</LastAttachPoint>
331 <ProfileShape>Circle</ProfileShape>
332 <HollowShape>Same</HollowShape>
333 <SculptTexture><Guid>00000000-0000-0000-0000-000000000000</Guid></SculptTexture>
334 <SculptType>0</SculptType>
335 <FlexiSoftness>0</FlexiSoftness>
336 <FlexiTension>0</FlexiTension>
337 <FlexiDrag>0</FlexiDrag>
338 <FlexiGravity>0</FlexiGravity>
339 <FlexiWind>0</FlexiWind>
340 <FlexiForceX>0</FlexiForceX>
341 <FlexiForceY>0</FlexiForceY>
342 <FlexiForceZ>0</FlexiForceZ>
343 <LightColorR>0</LightColorR>
344 <LightColorG>0</LightColorG>
345 <LightColorB>0</LightColorB>
346 <LightColorA>1</LightColorA>
347 <LightRadius>0</LightRadius>
348 <LightCutoff>0</LightCutoff>
349 <LightFalloff>0</LightFalloff>
350 <LightIntensity>1</LightIntensity>
351 <FlexiEntry>false</FlexiEntry>
352 <LightEntry>false</LightEntry>
353 <SculptEntry>false</SculptEntry>
354 </Shape>
355 <Scale><X>0.03574385</X><Y>0.05958032</Y><Z>0.04764182</Z></Scale>
356 <SitTargetOrientation><X>0</X><Y>0</Y><Z>0</Z><W>1</W></SitTargetOrientation>
357 <SitTargetPosition><X>0</X><Y>0</Y><Z>0</Z></SitTargetPosition>
358 <SitTargetPositionLL><X>0</X><Y>0</Y><Z>0</Z></SitTargetPositionLL>
359 <SitTargetOrientationLL><X>0</X><Y>0</Y><Z>0</Z><W>1</W></SitTargetOrientationLL>
360 <ParentID>1154704499</ParentID>
361 <CreationDate>1256611042</CreationDate>
362 <Category>0</Category>
363 <SalePrice>10</SalePrice>
364 <ObjectSaleType>0</ObjectSaleType>
365 <OwnershipCost>0</OwnershipCost>
366 <GroupID><Guid>00000000-0000-0000-0000-000000000000</Guid></GroupID>
367 <OwnerID><Guid>7b2022f0-5f19-488c-b7e5-829d8f96b448</Guid></OwnerID>
368 <LastOwnerID><Guid>7b2022f0-5f19-488c-b7e5-829d8f96b448</Guid></LastOwnerID>
369 <BaseMask>647168</BaseMask>
370 <OwnerMask>647168</OwnerMask>
371 <GroupMask>0</GroupMask>
372 <EveryoneMask>0</EveryoneMask>
373 <NextOwnerMask>581632</NextOwnerMask>
374 <Flags>None</Flags>
375 <CollisionSound><Guid>00000000-0000-0000-0000-000000000000</Guid></CollisionSound>
376 <CollisionSoundVolume>0</CollisionSoundVolume>
377 <AttachedPos><X>0</X><Y>0</Y><Z>0</Z></AttachedPos>
378 <TextureAnimation/>
379 <ParticleSystem/>
380 <PayPrice0>-2</PayPrice0>
381 <PayPrice1>-2</PayPrice1>
382 <PayPrice2>-2</PayPrice2>
383 <PayPrice3>-2</PayPrice3>
384 <PayPrice4>-2</PayPrice4>
385 </SceneObjectPart>
386 </Part>
387 </OtherParts>
388 </SceneObjectGroup>";
389  
390 private const string ObjectWithBadFloatsXml = @"
391 <SceneObjectGroup>
392 <RootPart>
393 <SceneObjectPart xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"">
394 <AllowedDrop>false</AllowedDrop>
395 <CreatorID><Guid>a6dacf01-4636-4bb9-8a97-30609438af9d</Guid></CreatorID>
396 <FolderID><Guid>e6a5a05e-e8cc-4816-8701-04165e335790</Guid></FolderID>
397 <InventorySerial>1</InventorySerial>
398 <TaskInventory />
399 <ObjectFlags>0</ObjectFlags>
400 <UUID><Guid>e6a5a05e-e8cc-4816-8701-04165e335790</Guid></UUID>
401 <LocalId>2698615125</LocalId>
402 <Name>NaughtyPrim</Name>
403 <Material>0</Material>
404 <PassTouches>false</PassTouches>
405 <RegionHandle>1099511628032000</RegionHandle>
406 <ScriptAccessPin>0</ScriptAccessPin>
407 <GroupPosition><X>147.23</X><Y>92.698</Y><Z>22.78084</Z></GroupPosition>
408 <OffsetPosition><X>0</X><Y>0</Y><Z>0</Z></OffsetPosition>
409 <RotationOffset><X>-4.371139E-08</X><Y>-1</Y><Z>-4.371139E-08</Z><W>0</W></RotationOffset>
410 <Velocity><X>0</X><Y>0</Y><Z>0</Z></Velocity>
411 <RotationalVelocity><X>0</X><Y>0</Y><Z>0</Z></RotationalVelocity>
412 <AngularVelocity><X>0</X><Y>0</Y><Z>0</Z></AngularVelocity>
413 <Acceleration><X>0</X><Y>0</Y><Z>0</Z></Acceleration>
414 <Description />
415 <Color />
416 <Text />
417 <SitName />
418 <TouchName />
419 <LinkNum>0</LinkNum>
420 <ClickAction>0</ClickAction>
421 <Shape>
422 <ProfileCurve>1</ProfileCurve>
423 <TextureEntry>AAAAAAAAERGZmQAAAAAABQCVlZUAAAAAQEAAAABAQAAAAAAAAAAAAAAAAAAAAA==</TextureEntry>
424 <ExtraParams>AA==</ExtraParams>
425 <PathBegin>0</PathBegin>
426 <PathCurve>16</PathCurve>
427 <PathEnd>0</PathEnd>
428 <PathRadiusOffset>0</PathRadiusOffset>
429 <PathRevolutions>0</PathRevolutions>
430 <PathScaleX>100</PathScaleX>
431 <PathScaleY>100</PathScaleY>
432 <PathShearX>0</PathShearX>
433 <PathShearY>0</PathShearY>
434 <PathSkew>0</PathSkew>
435 <PathTaperX>0</PathTaperX>
436 <PathTaperY>0</PathTaperY>
437 <PathTwist>0</PathTwist>
438 <PathTwistBegin>0</PathTwistBegin>
439 <PCode>9</PCode>
440 <ProfileBegin>0</ProfileBegin>
441 <ProfileEnd>0</ProfileEnd>
442 <ProfileHollow>0</ProfileHollow>
443 <Scale><X>10</X><Y>10</Y><Z>0.5</Z></Scale>
444 <State>0</State>
445 <ProfileShape>Square</ProfileShape>
446 <HollowShape>Same</HollowShape>
447 <SculptTexture><Guid>00000000-0000-0000-0000-000000000000</Guid></SculptTexture>
448 <SculptType>0</SculptType><SculptData />
449 <FlexiSoftness>0</FlexiSoftness>
450 <FlexiTension>0,5</FlexiTension>
451 <FlexiDrag>yo mamma</FlexiDrag>
452 <FlexiGravity>0</FlexiGravity>
453 <FlexiWind>0</FlexiWind>
454 <FlexiForceX>0</FlexiForceX>
455 <FlexiForceY>0</FlexiForceY>
456 <FlexiForceZ>0</FlexiForceZ>
457 <LightColorR>0</LightColorR>
458 <LightColorG>0</LightColorG>
459 <LightColorB>0</LightColorB>
460 <LightColorA>1</LightColorA>
461 <LightRadius>0</LightRadius>
462 <LightCutoff>0</LightCutoff>
463 <LightFalloff>0</LightFalloff>
464 <LightIntensity>1</LightIntensity>
465 <FlexiEntry>false</FlexiEntry>
466 <LightEntry>false</LightEntry>
467 <SculptEntry>false</SculptEntry>
468 </Shape>
469 <Scale><X>10</X><Y>10</Y><Z>0.5</Z></Scale>
470 <UpdateFlag>0</UpdateFlag>
471 <SitTargetOrientation><X>0</X><Y>0</Y><Z>0</Z><W>1</W></SitTargetOrientation>
472 <SitTargetPosition><X>0</X><Y>0</Y><Z>0</Z></SitTargetPosition>
473 <SitTargetPositionLL><X>0</X><Y>0</Y><Z>0</Z></SitTargetPositionLL>
474 <SitTargetOrientationLL><X>0</X><Y>0</Y><Z>0</Z><W>1</W></SitTargetOrientationLL>
475 <ParentID>0</ParentID>
476 <CreationDate>1211330445</CreationDate>
477 <Category>0</Category>
478 <SalePrice>0</SalePrice>
479 <ObjectSaleType>0</ObjectSaleType>
480 <OwnershipCost>0</OwnershipCost>
481 <GroupID><Guid>00000000-0000-0000-0000-000000000000</Guid></GroupID>
482 <OwnerID><Guid>a6dacf01-4636-4bb9-8a97-30609438af9d</Guid></OwnerID>
483 <LastOwnerID><Guid>a6dacf01-4636-4bb9-8a97-30609438af9d</Guid></LastOwnerID>
484 <BaseMask>2147483647</BaseMask>
485 <OwnerMask>2147483647</OwnerMask>
486 <GroupMask>0</GroupMask>
487 <EveryoneMask>0</EveryoneMask>
488 <NextOwnerMask>2147483647</NextOwnerMask>
489 <Flags>None</Flags>
490 <CollisionSound><Guid>00000000-0000-0000-0000-000000000000</Guid></CollisionSound>
491 <CollisionSoundVolume>0</CollisionSoundVolume>
492 </SceneObjectPart>
493 </RootPart>
494 <OtherParts />
495 </SceneObjectGroup>";
496  
497 private const string ObjectWithNoPartsXml2 = @"
498 <SceneObjectGroup>
499 <SceneObjectPart xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"">
500 <CreatorID><UUID>b46ef588-411e-4a8b-a284-d7dcfe8e74ef</UUID></CreatorID>
501 <FolderID><UUID>9be68fdd-f740-4a0f-9675-dfbbb536b946</UUID></FolderID>
502 <InventorySerial>0</InventorySerial>
503 <TaskInventory />
504 <ObjectFlags>0</ObjectFlags>
505 <UUID><UUID>9be68fdd-f740-4a0f-9675-dfbbb536b946</UUID></UUID>
506 <LocalId>720005</LocalId>
507 <Name>PrimFun</Name>
508 <Material>0</Material>
509 <RegionHandle>1099511628032000</RegionHandle>
510 <ScriptAccessPin>0</ScriptAccessPin>
511 <GroupPosition><X>153.9854</X><Y>121.4908</Y><Z>62.21781</Z></GroupPosition>
512 <OffsetPosition><X>0</X><Y>0</Y><Z>0</Z></OffsetPosition>
513 <RotationOffset><X>0</X><Y>0</Y><Z>0</Z><W>1</W></RotationOffset>
514 <Velocity><X>0</X><Y>0</Y><Z>0</Z></Velocity>
515 <RotationalVelocity><X>0</X><Y>0</Y><Z>0</Z></RotationalVelocity>
516 <AngularVelocity><X>0</X><Y>0</Y><Z>0</Z></AngularVelocity>
517 <Acceleration><X>0</X><Y>0</Y><Z>0</Z></Acceleration>
518 <Description />
519 <Color />
520 <Text />
521 <SitName />
522 <TouchName />
523 <LinkNum>0</LinkNum>
524 <ClickAction>0</ClickAction>
525 <Shape>
526 <PathBegin>0</PathBegin>
527 <PathCurve>16</PathCurve>
528 <PathEnd>0</PathEnd>
529 <PathRadiusOffset>0</PathRadiusOffset>
530 <PathRevolutions>0</PathRevolutions>
531 <PathScaleX>200</PathScaleX>
532 <PathScaleY>200</PathScaleY>
533 <PathShearX>0</PathShearX>
534 <PathShearY>0</PathShearY>
535 <PathSkew>0</PathSkew>
536 <PathTaperX>0</PathTaperX>
537 <PathTaperY>0</PathTaperY>
538 <PathTwist>0</PathTwist>
539 <PathTwistBegin>0</PathTwistBegin>
540 <PCode>9</PCode>
541 <ProfileBegin>0</ProfileBegin>
542 <ProfileEnd>0</ProfileEnd>
543 <ProfileHollow>0</ProfileHollow>
544 <Scale><X>1.283131</X><Y>5.903858</Y><Z>4.266288</Z></Scale>
545 <State>0</State>
546 <ProfileShape>Circle</ProfileShape>
547 <HollowShape>Same</HollowShape>
548 <ProfileCurve>0</ProfileCurve>
549 <TextureEntry>iVVnRyTLQ+2SC0fK7RVGXwJ6yc/SU4RDA5nhJbLUw3R1AAAAAAAAaOw8QQOhPSRAAKE9JEAAAAAAAAAAAAAAAAAAAAA=</TextureEntry>
550 <ExtraParams>AA==</ExtraParams>
551 </Shape>
552 <Scale><X>1.283131</X><Y>5.903858</Y><Z>4.266288</Z></Scale>
553 <UpdateFlag>0</UpdateFlag>
554 <SitTargetOrientation><w>0</w><x>0</x><y>0</y><z>1</z></SitTargetOrientation>
555 <SitTargetPosition><x>0</x><y>0</y><z>0</z></SitTargetPosition>
556 <SitTargetPositionLL><X>0</X><Y>0</Y><Z>0</Z></SitTargetPositionLL>
557 <SitTargetOrientationLL><X>0</X><Y>0</Y><Z>1</Z><W>0</W></SitTargetOrientationLL>
558 <ParentID>0</ParentID>
559 <CreationDate>1216066902</CreationDate>
560 <Category>0</Category>
561 <SalePrice>0</SalePrice>
562 <ObjectSaleType>0</ObjectSaleType>
563 <OwnershipCost>0</OwnershipCost>
564 <GroupID><UUID>00000000-0000-0000-0000-000000000000</UUID></GroupID>
565 <OwnerID><UUID>b46ef588-411e-4a8b-a284-d7dcfe8e74ef</UUID></OwnerID>
566 <LastOwnerID><UUID>b46ef588-411e-4a8b-a284-d7dcfe8e74ef</UUID></LastOwnerID>
567 <BaseMask>2147483647</BaseMask>
568 <OwnerMask>2147483647</OwnerMask>
569 <GroupMask>0</GroupMask>
570 <EveryoneMask>0</EveryoneMask>
571 <NextOwnerMask>2147483647</NextOwnerMask>
572 <Flags>None</Flags>
573 <DynAttrs>
574 <llsd>
575 <map>
576 <key>MyNamespace</key>
577 <map>
578 <key>MyStore</key>
579 <map>
580 <key>last words</key>
581 <string>Rosebud</string>
582 </map>
583 </map>
584 </map>
585 </llsd>
586 </DynAttrs>
587 <SitTargetAvatar><UUID>00000000-0000-0000-0000-000000000000</UUID></SitTargetAvatar>
588 </SceneObjectPart>
589 <OtherParts />
590 </SceneObjectGroup>";
591  
592 protected Scene m_scene;
593 protected SerialiserModule m_serialiserModule;
594  
595 [TestFixtureSetUp]
596 public void Init()
597 {
598 m_serialiserModule = new SerialiserModule();
599 m_scene = new SceneHelpers().SetupScene();
600 SceneHelpers.SetupSceneModules(m_scene, m_serialiserModule);
601 }
602  
603 [Test]
604 public void TestDeserializeXmlObjectWithNoOtherParts()
605 {
606 TestHelpers.InMethod();
607 TestHelpers.EnableLogging();
608  
609 SceneObjectGroup so = SceneObjectSerializer.FromOriginalXmlFormat(ObjectWithNoOtherPartsXml);
610 SceneObjectPart rootPart = so.RootPart;
611  
612 Assert.That(rootPart.UUID, Is.EqualTo(new UUID("e6a5a05e-e8cc-4816-8701-04165e335790")));
613 Assert.That(rootPart.CreatorID, Is.EqualTo(new UUID("a6dacf01-4636-4bb9-8a97-30609438af9d")));
614 Assert.That(rootPart.Name, Is.EqualTo("PrimMyRide"));
615 OSDMap store = rootPart.DynAttrs.GetStore("MyNamespace", "MyStore");
616 Assert.AreEqual(42, store["the answer"].AsInteger());
617  
618 // TODO: Check other properties
619 }
620  
621 [Test]
622 public void TestDeserializeXmlObjectWithOtherParts()
623 {
624 TestHelpers.InMethod();
625 TestHelpers.EnableLogging();
626  
627 SceneObjectGroup so = SceneObjectSerializer.FromOriginalXmlFormat(ObjectWithOtherPartsXml);
628 SceneObjectPart[] parts = so.Parts;
629 Assert.AreEqual(3, so.Parts.Length);
630  
631 {
632 SceneObjectPart part = parts[0];
633  
634 Assert.That(part.UUID, Is.EqualTo(new UUID("e6a5a05e-e8cc-4816-8701-04165e335790")));
635 Assert.That(part.CreatorID, Is.EqualTo(new UUID("a6dacf01-4636-4bb9-8a97-30609438af9d")));
636 Assert.That(part.Name, Is.EqualTo("PrimMyRide"));
637 OSDMap store = part.DynAttrs.GetStore("MyNamespace", "MyStore");
638 Assert.AreEqual(42, store["the answer"].AsInteger());
639 }
640  
641 {
642 SceneObjectPart part = parts[1];
643  
644 Assert.That(part.UUID, Is.EqualTo(new UUID("9958feb1-02a6-49e4-a4ce-eba6f578ee13")));
645 Assert.That(part.CreatorID, Is.EqualTo(new UUID("a6dacf01-4636-4bb9-8a97-30609438af9d")));
646 Assert.That(part.Name, Is.EqualTo("Alien Head 1"));
647 }
648  
649 {
650 SceneObjectPart part = parts[2];
651  
652 Assert.That(part.UUID, Is.EqualTo(new UUID("674b6b86-f5aa-439a-8e00-0d75bc08c80a")));
653 Assert.That(part.CreatorID, Is.EqualTo(new UUID("a6dacf01-4636-4bb9-8a97-30609438af9d")));
654 Assert.That(part.Name, Is.EqualTo("Alien Head 2"));
655 }
656  
657 // TODO: Check other properties
658 }
659  
660 [Test]
661 public void TestDeserializeBadFloatsXml()
662 {
663 TestHelpers.InMethod();
664 // log4net.Config.XmlConfigurator.Configure();
665  
666 SceneObjectGroup so = SceneObjectSerializer.FromOriginalXmlFormat(ObjectWithBadFloatsXml);
667 SceneObjectPart rootPart = so.RootPart;
668  
669 Assert.That(rootPart.UUID, Is.EqualTo(new UUID("e6a5a05e-e8cc-4816-8701-04165e335790")));
670 Assert.That(rootPart.CreatorID, Is.EqualTo(new UUID("a6dacf01-4636-4bb9-8a97-30609438af9d")));
671 Assert.That(rootPart.Name, Is.EqualTo("NaughtyPrim"));
672  
673 // This terminates the deserialization earlier if couldn't be parsed.
674 // TODO: Need to address this
675 Assert.That(rootPart.GroupPosition.X, Is.EqualTo(147.23f));
676  
677 Assert.That(rootPart.Shape.PathCurve, Is.EqualTo(16));
678  
679 // Defaults for bad parses
680 Assert.That(rootPart.Shape.FlexiTension, Is.EqualTo(0));
681 Assert.That(rootPart.Shape.FlexiDrag, Is.EqualTo(0));
682  
683 // TODO: Check other properties
684 }
685  
686 [Test]
687 public void TestSerializeXml()
688 {
689 TestHelpers.InMethod();
690 //log4net.Config.XmlConfigurator.Configure();
691  
692 string rpName = "My Little Donkey";
693 UUID rpUuid = UUID.Parse("00000000-0000-0000-0000-000000000964");
694 UUID rpCreatorId = UUID.Parse("00000000-0000-0000-0000-000000000915");
695 PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere();
696 // Vector3 groupPosition = new Vector3(10, 20, 30);
697 // Quaternion rotationOffset = new Quaternion(20, 30, 40, 50);
698 // Vector3 offsetPosition = new Vector3(5, 10, 15);
699  
700 SceneObjectPart rp = new SceneObjectPart();
701 rp.UUID = rpUuid;
702 rp.Name = rpName;
703 rp.CreatorID = rpCreatorId;
704 rp.Shape = shape;
705  
706 string daNamespace = "MyNamespace";
707 string daStoreName = "MyStore";
708 string daKey = "foo";
709 string daValue = "bar";
710 OSDMap myStore = new OSDMap();
711 myStore.Add(daKey, daValue);
712 rp.DynAttrs = new DAMap();
713 rp.DynAttrs.SetStore(daNamespace, daStoreName, myStore);
714  
715 SceneObjectGroup so = new SceneObjectGroup(rp);
716  
717 // Need to add the object to the scene so that the request to get script state succeeds
718 m_scene.AddSceneObject(so);
719  
720 string xml = SceneObjectSerializer.ToOriginalXmlFormat(so);
721  
722 XmlTextReader xtr = new XmlTextReader(new StringReader(xml));
723 xtr.ReadStartElement("SceneObjectGroup");
724 xtr.ReadStartElement("RootPart");
725 xtr.ReadStartElement("SceneObjectPart");
726  
727 UUID uuid = UUID.Zero;
728 string name = null;
729 UUID creatorId = UUID.Zero;
730 DAMap daMap = null;
731  
732 while (xtr.Read() && xtr.Name != "SceneObjectPart")
733 {
734 if (xtr.NodeType != XmlNodeType.Element)
735 continue;
736  
737 switch (xtr.Name)
738 {
739 case "UUID":
740 xtr.ReadStartElement("UUID");
741 try
742 {
743 uuid = UUID.Parse(xtr.ReadElementString("UUID"));
744 xtr.ReadEndElement();
745 }
746 catch { } // ignore everything but <UUID><UUID>...</UUID></UUID>
747 break;
748 case "Name":
749 name = xtr.ReadElementContentAsString();
750 break;
751 case "CreatorID":
752 xtr.ReadStartElement("CreatorID");
753 creatorId = UUID.Parse(xtr.ReadElementString("UUID"));
754 xtr.ReadEndElement();
755 break;
756 case "DynAttrs":
757 daMap = new DAMap();
758 daMap.ReadXml(xtr);
759 break;
760 }
761 }
762  
763 xtr.ReadEndElement();
764 xtr.ReadEndElement();
765 xtr.ReadStartElement("OtherParts");
766 xtr.ReadEndElement();
767 xtr.Close();
768  
769 // TODO: More checks
770 Assert.That(uuid, Is.EqualTo(rpUuid));
771 Assert.That(name, Is.EqualTo(rpName));
772 Assert.That(creatorId, Is.EqualTo(rpCreatorId));
773 Assert.NotNull(daMap);
774 Assert.AreEqual(daValue, daMap.GetStore(daNamespace, daStoreName)[daKey].AsString());
775 }
776  
777 [Test]
778 public void TestDeserializeXml2()
779 {
780 TestHelpers.InMethod();
781 //log4net.Config.XmlConfigurator.Configure();
782  
783 SceneObjectGroup so = m_serialiserModule.DeserializeGroupFromXml2(ObjectWithNoPartsXml2);
784 SceneObjectPart rootPart = so.RootPart;
785  
786 Assert.That(rootPart.UUID, Is.EqualTo(new UUID("9be68fdd-f740-4a0f-9675-dfbbb536b946")));
787 Assert.That(rootPart.CreatorID, Is.EqualTo(new UUID("b46ef588-411e-4a8b-a284-d7dcfe8e74ef")));
788 Assert.That(rootPart.Name, Is.EqualTo("PrimFun"));
789 OSDMap store = rootPart.DynAttrs.GetStore("MyNamespace", "MyStore");
790 Assert.AreEqual("Rosebud", store["last words"].AsString());
791  
792 // TODO: Check other properties
793 }
794  
795 [Test]
796 public void TestSerializeXml2()
797 {
798 TestHelpers.InMethod();
799 //log4net.Config.XmlConfigurator.Configure();
800  
801 string rpName = "My Little Pony";
802 UUID rpUuid = UUID.Parse("00000000-0000-0000-0000-000000000064");
803 UUID rpCreatorId = UUID.Parse("00000000-0000-0000-0000-000000000015");
804 PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere();
805 // Vector3 groupPosition = new Vector3(10, 20, 30);
806 // Quaternion rotationOffset = new Quaternion(20, 30, 40, 50);
807 // Vector3 offsetPosition = new Vector3(5, 10, 15);
808  
809 SceneObjectPart rp = new SceneObjectPart();
810 rp.UUID = rpUuid;
811 rp.Name = rpName;
812 rp.CreatorID = rpCreatorId;
813 rp.Shape = shape;
814  
815 string daNamespace = "MyNamespace";
816 string daStoreName = "MyStore";
817 string daKey = "foo";
818 string daValue = "bar";
819 OSDMap myStore = new OSDMap();
820 myStore.Add(daKey, daValue);
821 rp.DynAttrs = new DAMap();
822 rp.DynAttrs.SetStore(daNamespace, daStoreName, myStore);
823  
824 SceneObjectGroup so = new SceneObjectGroup(rp);
825  
826 // Need to add the object to the scene so that the request to get script state succeeds
827 m_scene.AddSceneObject(so);
828  
829 Dictionary<string, object> options = new Dictionary<string, object>();
830 options["old-guids"] = true;
831 string xml2 = m_serialiserModule.SerializeGroupToXml2(so, options);
832  
833 XmlTextReader xtr = new XmlTextReader(new StringReader(xml2));
834 xtr.ReadStartElement("SceneObjectGroup");
835 xtr.ReadStartElement("SceneObjectPart");
836  
837 UUID uuid = UUID.Zero;
838 string name = null;
839 UUID creatorId = UUID.Zero;
840 DAMap daMap = null;
841  
842 while (xtr.Read() && xtr.Name != "SceneObjectPart")
843 {
844 if (xtr.NodeType != XmlNodeType.Element)
845 continue;
846  
847 switch (xtr.Name)
848 {
849 case "UUID":
850 xtr.ReadStartElement("UUID");
851 uuid = UUID.Parse(xtr.ReadElementString("Guid"));
852 xtr.ReadEndElement();
853 break;
854 case "Name":
855 name = xtr.ReadElementContentAsString();
856 break;
857 case "CreatorID":
858 xtr.ReadStartElement("CreatorID");
859 creatorId = UUID.Parse(xtr.ReadElementString("Guid"));
860 xtr.ReadEndElement();
861 break;
862 case "DynAttrs":
863 daMap = new DAMap();
864 daMap.ReadXml(xtr);
865 break;
866 }
867 }
868  
869 xtr.ReadEndElement();
870 xtr.ReadStartElement("OtherParts");
871 xtr.ReadEndElement();
872 xtr.Close();
873  
874 // TODO: More checks
875 Assert.That(uuid, Is.EqualTo(rpUuid));
876 Assert.That(name, Is.EqualTo(rpName));
877 Assert.That(creatorId, Is.EqualTo(rpCreatorId));
878 Assert.NotNull(daMap);
879 Assert.AreEqual(daValue, daMap.GetStore(daNamespace, daStoreName)[daKey].AsString());
880 }
881 }
882 }