diff options
author | Justin Clark-Casey (justincc) | 2014-08-29 18:06:29 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2014-08-29 18:06:29 +0100 |
commit | 305c3e668a36f8a53582d57a0eee79084c62a280 (patch) | |
tree | 1cb14dbbb676b5b7e6d8dcb7cee9b290b659d62d /OpenSim/Region/CoreModules/World/Serialiser | |
parent | minor: Eliminate more unnecessary code copying individual parameters for Vect... (diff) | |
download | opensim-SC-305c3e668a36f8a53582d57a0eee79084c62a280.zip opensim-SC-305c3e668a36f8a53582d57a0eee79084c62a280.tar.gz opensim-SC-305c3e668a36f8a53582d57a0eee79084c62a280.tar.bz2 opensim-SC-305c3e668a36f8a53582d57a0eee79084c62a280.tar.xz |
Add regression test for deserializing xml objects with more than one non-root part.
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Serialiser')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs | 533 |
1 files changed, 406 insertions, 127 deletions
diff --git a/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs b/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs index 66059fb..52203f7 100644 --- a/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs +++ b/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs | |||
@@ -27,6 +27,7 @@ | |||
27 | 27 | ||
28 | using System.Collections.Generic; | 28 | using System.Collections.Generic; |
29 | using System.IO; | 29 | using System.IO; |
30 | using System.Text; | ||
30 | using System.Xml; | 31 | using System.Xml; |
31 | using log4net.Config; | 32 | using log4net.Config; |
32 | using NUnit.Framework; | 33 | using NUnit.Framework; |
@@ -42,128 +43,351 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests | |||
42 | [TestFixture] | 43 | [TestFixture] |
43 | public class SerialiserTests : OpenSimTestCase | 44 | public class SerialiserTests : OpenSimTestCase |
44 | { | 45 | { |
45 | private string xml = @" | 46 | private const string ObjectRootPartStubXml = |
46 | <SceneObjectGroup> | 47 | @"<SceneObjectGroup> |
47 | <RootPart> | 48 | <RootPart> |
48 | <SceneObjectPart xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema""> | 49 | <SceneObjectPart xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema""> |
49 | <AllowedDrop>false</AllowedDrop> | 50 | <AllowedDrop>false</AllowedDrop> |
50 | <CreatorID><Guid>a6dacf01-4636-4bb9-8a97-30609438af9d</Guid></CreatorID> | 51 | <CreatorID><Guid>a6dacf01-4636-4bb9-8a97-30609438af9d</Guid></CreatorID> |
51 | <FolderID><Guid>e6a5a05e-e8cc-4816-8701-04165e335790</Guid></FolderID> | 52 | <FolderID><Guid>e6a5a05e-e8cc-4816-8701-04165e335790</Guid></FolderID> |
52 | <InventorySerial>1</InventorySerial> | 53 | <InventorySerial>1</InventorySerial> |
53 | <TaskInventory /> | 54 | <TaskInventory /> |
54 | <ObjectFlags>0</ObjectFlags> | 55 | <ObjectFlags>0</ObjectFlags> |
55 | <UUID><Guid>e6a5a05e-e8cc-4816-8701-04165e335790</Guid></UUID> | 56 | <UUID><Guid>e6a5a05e-e8cc-4816-8701-04165e335790</Guid></UUID> |
56 | <LocalId>2698615125</LocalId> | 57 | <LocalId>2698615125</LocalId> |
57 | <Name>PrimMyRide</Name> | 58 | <Name>PrimMyRide</Name> |
58 | <Material>0</Material> | 59 | <Material>0</Material> |
59 | <PassTouches>false</PassTouches> | 60 | <PassTouches>false</PassTouches> |
60 | <RegionHandle>1099511628032000</RegionHandle> | 61 | <RegionHandle>1099511628032000</RegionHandle> |
61 | <ScriptAccessPin>0</ScriptAccessPin> | 62 | <ScriptAccessPin>0</ScriptAccessPin> |
62 | <GroupPosition><X>147.23</X><Y>92.698</Y><Z>22.78084</Z></GroupPosition> | 63 | <GroupPosition><X>147.23</X><Y>92.698</Y><Z>22.78084</Z></GroupPosition> |
63 | <OffsetPosition><X>0</X><Y>0</Y><Z>0</Z></OffsetPosition> | 64 | <OffsetPosition><X>0</X><Y>0</Y><Z>0</Z></OffsetPosition> |
64 | <RotationOffset><X>-4.371139E-08</X><Y>-1</Y><Z>-4.371139E-08</Z><W>0</W></RotationOffset> | 65 | <RotationOffset><X>-4.371139E-08</X><Y>-1</Y><Z>-4.371139E-08</Z><W>0</W></RotationOffset> |
65 | <Velocity><X>0</X><Y>0</Y><Z>0</Z></Velocity> | 66 | <Velocity><X>0</X><Y>0</Y><Z>0</Z></Velocity> |
66 | <RotationalVelocity><X>0</X><Y>0</Y><Z>0</Z></RotationalVelocity> | 67 | <RotationalVelocity><X>0</X><Y>0</Y><Z>0</Z></RotationalVelocity> |
67 | <AngularVelocity><X>0</X><Y>0</Y><Z>0</Z></AngularVelocity> | 68 | <AngularVelocity><X>0</X><Y>0</Y><Z>0</Z></AngularVelocity> |
68 | <Acceleration><X>0</X><Y>0</Y><Z>0</Z></Acceleration> | 69 | <Acceleration><X>0</X><Y>0</Y><Z>0</Z></Acceleration> |
69 | <Description /> | 70 | <Description /> |
70 | <Color /> | 71 | <Color /> |
71 | <Text /> | 72 | <Text /> |
72 | <SitName /> | 73 | <SitName /> |
73 | <TouchName /> | 74 | <TouchName /> |
74 | <LinkNum>0</LinkNum> | 75 | <LinkNum>0</LinkNum> |
75 | <ClickAction>0</ClickAction> | 76 | <ClickAction>0</ClickAction> |
76 | <Shape> | 77 | <Shape> |
77 | <ProfileCurve>1</ProfileCurve> | 78 | <ProfileCurve>1</ProfileCurve> |
78 | <TextureEntry>AAAAAAAAERGZmQAAAAAABQCVlZUAAAAAQEAAAABAQAAAAAAAAAAAAAAAAAAAAA==</TextureEntry> | 79 | <TextureEntry>AAAAAAAAERGZmQAAAAAABQCVlZUAAAAAQEAAAABAQAAAAAAAAAAAAAAAAAAAAA==</TextureEntry> |
79 | <ExtraParams>AA==</ExtraParams> | 80 | <ExtraParams>AA==</ExtraParams> |
80 | <PathBegin>0</PathBegin> | 81 | <PathBegin>0</PathBegin> |
81 | <PathCurve>16</PathCurve> | 82 | <PathCurve>16</PathCurve> |
82 | <PathEnd>0</PathEnd> | 83 | <PathEnd>0</PathEnd> |
83 | <PathRadiusOffset>0</PathRadiusOffset> | 84 | <PathRadiusOffset>0</PathRadiusOffset> |
84 | <PathRevolutions>0</PathRevolutions> | 85 | <PathRevolutions>0</PathRevolutions> |
85 | <PathScaleX>100</PathScaleX> | 86 | <PathScaleX>100</PathScaleX> |
86 | <PathScaleY>100</PathScaleY> | 87 | <PathScaleY>100</PathScaleY> |
87 | <PathShearX>0</PathShearX> | 88 | <PathShearX>0</PathShearX> |
88 | <PathShearY>0</PathShearY> | 89 | <PathShearY>0</PathShearY> |
89 | <PathSkew>0</PathSkew> | 90 | <PathSkew>0</PathSkew> |
90 | <PathTaperX>0</PathTaperX> | 91 | <PathTaperX>0</PathTaperX> |
91 | <PathTaperY>0</PathTaperY> | 92 | <PathTaperY>0</PathTaperY> |
92 | <PathTwist>0</PathTwist> | 93 | <PathTwist>0</PathTwist> |
93 | <PathTwistBegin>0</PathTwistBegin> | 94 | <PathTwistBegin>0</PathTwistBegin> |
94 | <PCode>9</PCode> | 95 | <PCode>9</PCode> |
95 | <ProfileBegin>0</ProfileBegin> | 96 | <ProfileBegin>0</ProfileBegin> |
96 | <ProfileEnd>0</ProfileEnd> | 97 | <ProfileEnd>0</ProfileEnd> |
97 | <ProfileHollow>0</ProfileHollow> | 98 | <ProfileHollow>0</ProfileHollow> |
98 | <Scale><X>10</X><Y>10</Y><Z>0.5</Z></Scale> | 99 | <Scale><X>10</X><Y>10</Y><Z>0.5</Z></Scale> |
99 | <State>0</State> | 100 | <State>0</State> |
100 | <ProfileShape>Square</ProfileShape> | 101 | <ProfileShape>Square</ProfileShape> |
101 | <HollowShape>Same</HollowShape> | 102 | <HollowShape>Same</HollowShape> |
102 | <SculptTexture><Guid>00000000-0000-0000-0000-000000000000</Guid></SculptTexture> | 103 | <SculptTexture><Guid>00000000-0000-0000-0000-000000000000</Guid></SculptTexture> |
103 | <SculptType>0</SculptType><SculptData /> | 104 | <SculptType>0</SculptType><SculptData /> |
104 | <FlexiSoftness>0</FlexiSoftness> | 105 | <FlexiSoftness>0</FlexiSoftness> |
105 | <FlexiTension>0</FlexiTension> | 106 | <FlexiTension>0</FlexiTension> |
106 | <FlexiDrag>0</FlexiDrag> | 107 | <FlexiDrag>0</FlexiDrag> |
107 | <FlexiGravity>0</FlexiGravity> | 108 | <FlexiGravity>0</FlexiGravity> |
108 | <FlexiWind>0</FlexiWind> | 109 | <FlexiWind>0</FlexiWind> |
109 | <FlexiForceX>0</FlexiForceX> | 110 | <FlexiForceX>0</FlexiForceX> |
110 | <FlexiForceY>0</FlexiForceY> | 111 | <FlexiForceY>0</FlexiForceY> |
111 | <FlexiForceZ>0</FlexiForceZ> | 112 | <FlexiForceZ>0</FlexiForceZ> |
112 | <LightColorR>0</LightColorR> | 113 | <LightColorR>0</LightColorR> |
113 | <LightColorG>0</LightColorG> | 114 | <LightColorG>0</LightColorG> |
114 | <LightColorB>0</LightColorB> | 115 | <LightColorB>0</LightColorB> |
115 | <LightColorA>1</LightColorA> | 116 | <LightColorA>1</LightColorA> |
116 | <LightRadius>0</LightRadius> | 117 | <LightRadius>0</LightRadius> |
117 | <LightCutoff>0</LightCutoff> | 118 | <LightCutoff>0</LightCutoff> |
118 | <LightFalloff>0</LightFalloff> | 119 | <LightFalloff>0</LightFalloff> |
119 | <LightIntensity>1</LightIntensity> | 120 | <LightIntensity>1</LightIntensity> |
120 | <FlexiEntry>false</FlexiEntry> | 121 | <FlexiEntry>false</FlexiEntry> |
121 | <LightEntry>false</LightEntry> | 122 | <LightEntry>false</LightEntry> |
122 | <SculptEntry>false</SculptEntry> | 123 | <SculptEntry>false</SculptEntry> |
123 | </Shape> | 124 | </Shape> |
124 | <Scale><X>10</X><Y>10</Y><Z>0.5</Z></Scale> | 125 | <Scale><X>10</X><Y>10</Y><Z>0.5</Z></Scale> |
125 | <UpdateFlag>0</UpdateFlag> | 126 | <UpdateFlag>0</UpdateFlag> |
126 | <SitTargetOrientation><X>0</X><Y>0</Y><Z>0</Z><W>1</W></SitTargetOrientation> | 127 | <SitTargetOrientation><X>0</X><Y>0</Y><Z>0</Z><W>1</W></SitTargetOrientation> |
127 | <SitTargetPosition><X>0</X><Y>0</Y><Z>0</Z></SitTargetPosition> | 128 | <SitTargetPosition><X>0</X><Y>0</Y><Z>0</Z></SitTargetPosition> |
128 | <SitTargetPositionLL><X>0</X><Y>0</Y><Z>0</Z></SitTargetPositionLL> | 129 | <SitTargetPositionLL><X>0</X><Y>0</Y><Z>0</Z></SitTargetPositionLL> |
129 | <SitTargetOrientationLL><X>0</X><Y>0</Y><Z>0</Z><W>1</W></SitTargetOrientationLL> | 130 | <SitTargetOrientationLL><X>0</X><Y>0</Y><Z>0</Z><W>1</W></SitTargetOrientationLL> |
130 | <ParentID>0</ParentID> | 131 | <ParentID>0</ParentID> |
131 | <CreationDate>1211330445</CreationDate> | 132 | <CreationDate>1211330445</CreationDate> |
132 | <Category>0</Category> | 133 | <Category>0</Category> |
133 | <SalePrice>0</SalePrice> | 134 | <SalePrice>0</SalePrice> |
134 | <ObjectSaleType>0</ObjectSaleType> | 135 | <ObjectSaleType>0</ObjectSaleType> |
135 | <OwnershipCost>0</OwnershipCost> | 136 | <OwnershipCost>0</OwnershipCost> |
136 | <GroupID><Guid>00000000-0000-0000-0000-000000000000</Guid></GroupID> | 137 | <GroupID><Guid>00000000-0000-0000-0000-000000000000</Guid></GroupID> |
137 | <OwnerID><Guid>a6dacf01-4636-4bb9-8a97-30609438af9d</Guid></OwnerID> | 138 | <OwnerID><Guid>a6dacf01-4636-4bb9-8a97-30609438af9d</Guid></OwnerID> |
138 | <LastOwnerID><Guid>a6dacf01-4636-4bb9-8a97-30609438af9d</Guid></LastOwnerID> | 139 | <LastOwnerID><Guid>a6dacf01-4636-4bb9-8a97-30609438af9d</Guid></LastOwnerID> |
139 | <BaseMask>2147483647</BaseMask> | 140 | <BaseMask>2147483647</BaseMask> |
140 | <OwnerMask>2147483647</OwnerMask> | 141 | <OwnerMask>2147483647</OwnerMask> |
141 | <GroupMask>0</GroupMask> | 142 | <GroupMask>0</GroupMask> |
142 | <EveryoneMask>0</EveryoneMask> | 143 | <EveryoneMask>0</EveryoneMask> |
143 | <NextOwnerMask>2147483647</NextOwnerMask> | 144 | <NextOwnerMask>2147483647</NextOwnerMask> |
144 | <Flags>None</Flags> | 145 | <Flags>None</Flags> |
145 | <CollisionSound><Guid>00000000-0000-0000-0000-000000000000</Guid></CollisionSound> | 146 | <CollisionSound><Guid>00000000-0000-0000-0000-000000000000</Guid></CollisionSound> |
146 | <CollisionSoundVolume>0</CollisionSoundVolume> | 147 | <CollisionSoundVolume>0</CollisionSoundVolume> |
147 | <DynAttrs> | 148 | <DynAttrs> |
148 | <llsd> | 149 | <llsd> |
149 | <map> | 150 | <map> |
150 | <key>MyNamespace</key> | 151 | <key>MyNamespace</key> |
151 | <map> | 152 | <map> |
152 | <key>MyStore</key> | 153 | <key>MyStore</key> |
153 | <map> | 154 | <map> |
154 | <key>the answer</key> | 155 | <key>the answer</key> |
155 | <integer>42</integer> | 156 | <integer>42</integer> |
156 | </map> | ||
157 | </map> | ||
158 | </map> | 157 | </map> |
159 | </llsd> | 158 | </map> |
160 | </DynAttrs> | 159 | </map> |
161 | </SceneObjectPart> | 160 | </llsd> |
162 | </RootPart> | 161 | </DynAttrs> |
163 | <OtherParts /> | 162 | </SceneObjectPart> |
164 | </SceneObjectGroup>"; | 163 | </RootPart>"; |
165 | 164 | ||
166 | private string badFloatsXml = @" | 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 = @" | ||
167 | <SceneObjectGroup> | 391 | <SceneObjectGroup> |
168 | <RootPart> | 392 | <RootPart> |
169 | <SceneObjectPart xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema""> | 393 | <SceneObjectPart xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema""> |
@@ -270,7 +494,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests | |||
270 | <OtherParts /> | 494 | <OtherParts /> |
271 | </SceneObjectGroup>"; | 495 | </SceneObjectGroup>"; |
272 | 496 | ||
273 | private string xml2 = @" | 497 | private const string ObjectWithNoPartsXml2 = @" |
274 | <SceneObjectGroup> | 498 | <SceneObjectGroup> |
275 | <SceneObjectPart xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema""> | 499 | <SceneObjectPart xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema""> |
276 | <CreatorID><UUID>b46ef588-411e-4a8b-a284-d7dcfe8e74ef</UUID></CreatorID> | 500 | <CreatorID><UUID>b46ef588-411e-4a8b-a284-d7dcfe8e74ef</UUID></CreatorID> |
@@ -377,12 +601,12 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests | |||
377 | } | 601 | } |
378 | 602 | ||
379 | [Test] | 603 | [Test] |
380 | public void TestDeserializeXml() | 604 | public void TestDeserializeXmlObjectWithNoOtherParts() |
381 | { | 605 | { |
382 | TestHelpers.InMethod(); | 606 | TestHelpers.InMethod(); |
383 | //log4net.Config.XmlConfigurator.Configure(); | 607 | TestHelpers.EnableLogging(); |
384 | 608 | ||
385 | SceneObjectGroup so = SceneObjectSerializer.FromOriginalXmlFormat(xml); | 609 | SceneObjectGroup so = SceneObjectSerializer.FromOriginalXmlFormat(ObjectWithNoOtherPartsXml); |
386 | SceneObjectPart rootPart = so.RootPart; | 610 | SceneObjectPart rootPart = so.RootPart; |
387 | 611 | ||
388 | Assert.That(rootPart.UUID, Is.EqualTo(new UUID("e6a5a05e-e8cc-4816-8701-04165e335790"))); | 612 | Assert.That(rootPart.UUID, Is.EqualTo(new UUID("e6a5a05e-e8cc-4816-8701-04165e335790"))); |
@@ -395,12 +619,67 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests | |||
395 | } | 619 | } |
396 | 620 | ||
397 | [Test] | 621 | [Test] |
622 | public void TestDeserializeXmlObjectWithOtherParts() | ||
623 | { | ||
624 | TestHelpers.InMethod(); | ||
625 | TestHelpers.EnableLogging(); | ||
626 | |||
627 | // We need to do this to get rid of whitespace between elements. | ||
628 | // TODO: Ultimately OpenSimulator xml parser should be set to ignore this but this means a bit of | ||
629 | // rejigging to replace old new XmlTextReader() with the post .NET 2.0 XmlReader.Create() calls | ||
630 | XmlDocument xdoc = new XmlDocument(); | ||
631 | xdoc.LoadXml(ObjectWithOtherPartsXml); | ||
632 | |||
633 | StringBuilder sb = new StringBuilder(); | ||
634 | using (StringWriter sw = new StringWriter(sb)) | ||
635 | { | ||
636 | using (XmlTextWriter xtw = new XmlTextWriter(sw)) | ||
637 | { | ||
638 | xtw.Formatting = Formatting.Indented; | ||
639 | xdoc.WriteTo(xtw); | ||
640 | } | ||
641 | } | ||
642 | |||
643 | SceneObjectGroup so = SceneObjectSerializer.FromOriginalXmlFormat(sb.ToString()); | ||
644 | SceneObjectPart[] parts = so.Parts; | ||
645 | Assert.AreEqual(3, so.Parts.Length); | ||
646 | |||
647 | { | ||
648 | SceneObjectPart part = parts[0]; | ||
649 | |||
650 | Assert.That(part.UUID, Is.EqualTo(new UUID("e6a5a05e-e8cc-4816-8701-04165e335790"))); | ||
651 | Assert.That(part.CreatorID, Is.EqualTo(new UUID("a6dacf01-4636-4bb9-8a97-30609438af9d"))); | ||
652 | Assert.That(part.Name, Is.EqualTo("PrimMyRide")); | ||
653 | OSDMap store = part.DynAttrs.GetStore("MyNamespace", "MyStore"); | ||
654 | Assert.AreEqual(42, store["the answer"].AsInteger()); | ||
655 | } | ||
656 | |||
657 | { | ||
658 | SceneObjectPart part = parts[1]; | ||
659 | |||
660 | Assert.That(part.UUID, Is.EqualTo(new UUID("9958feb1-02a6-49e4-a4ce-eba6f578ee13"))); | ||
661 | Assert.That(part.CreatorID, Is.EqualTo(new UUID("a6dacf01-4636-4bb9-8a97-30609438af9d"))); | ||
662 | Assert.That(part.Name, Is.EqualTo("Alien Head 1")); | ||
663 | } | ||
664 | |||
665 | { | ||
666 | SceneObjectPart part = parts[2]; | ||
667 | |||
668 | Assert.That(part.UUID, Is.EqualTo(new UUID("674b6b86-f5aa-439a-8e00-0d75bc08c80a"))); | ||
669 | Assert.That(part.CreatorID, Is.EqualTo(new UUID("a6dacf01-4636-4bb9-8a97-30609438af9d"))); | ||
670 | Assert.That(part.Name, Is.EqualTo("Alien Head 2")); | ||
671 | } | ||
672 | |||
673 | // TODO: Check other properties | ||
674 | } | ||
675 | |||
676 | [Test] | ||
398 | public void TestDeserializeBadFloatsXml() | 677 | public void TestDeserializeBadFloatsXml() |
399 | { | 678 | { |
400 | TestHelpers.InMethod(); | 679 | TestHelpers.InMethod(); |
401 | // log4net.Config.XmlConfigurator.Configure(); | 680 | // log4net.Config.XmlConfigurator.Configure(); |
402 | 681 | ||
403 | SceneObjectGroup so = SceneObjectSerializer.FromOriginalXmlFormat(badFloatsXml); | 682 | SceneObjectGroup so = SceneObjectSerializer.FromOriginalXmlFormat(ObjectWithBadFloatsXml); |
404 | SceneObjectPart rootPart = so.RootPart; | 683 | SceneObjectPart rootPart = so.RootPart; |
405 | 684 | ||
406 | Assert.That(rootPart.UUID, Is.EqualTo(new UUID("e6a5a05e-e8cc-4816-8701-04165e335790"))); | 685 | Assert.That(rootPart.UUID, Is.EqualTo(new UUID("e6a5a05e-e8cc-4816-8701-04165e335790"))); |
@@ -517,7 +796,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests | |||
517 | TestHelpers.InMethod(); | 796 | TestHelpers.InMethod(); |
518 | //log4net.Config.XmlConfigurator.Configure(); | 797 | //log4net.Config.XmlConfigurator.Configure(); |
519 | 798 | ||
520 | SceneObjectGroup so = m_serialiserModule.DeserializeGroupFromXml2(xml2); | 799 | SceneObjectGroup so = m_serialiserModule.DeserializeGroupFromXml2(ObjectWithNoPartsXml2); |
521 | SceneObjectPart rootPart = so.RootPart; | 800 | SceneObjectPart rootPart = so.RootPart; |
522 | 801 | ||
523 | Assert.That(rootPart.UUID, Is.EqualTo(new UUID("9be68fdd-f740-4a0f-9675-dfbbb536b946"))); | 802 | Assert.That(rootPart.UUID, Is.EqualTo(new UUID("9be68fdd-f740-4a0f-9675-dfbbb536b946"))); |