aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clarke Casey2009-06-02 15:24:29 +0000
committerJustin Clarke Casey2009-06-02 15:24:29 +0000
commit5c42143a7b17b68c9a33df9d6da3780b58f31f43 (patch)
treef112835614efeef7faeb65a42fc8227a66ac21fe
parentExplicitly set the changed status of the prim groups affected in a delink (diff)
downloadopensim-SC-5c42143a7b17b68c9a33df9d6da3780b58f31f43.zip
opensim-SC-5c42143a7b17b68c9a33df9d6da3780b58f31f43.tar.gz
opensim-SC-5c42143a7b17b68c9a33df9d6da3780b58f31f43.tar.bz2
opensim-SC-5c42143a7b17b68c9a33df9d6da3780b58f31f43.tar.xz
* Add simple original xml serialization test
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs10
-rw-r--r--OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs76
2 files changed, 75 insertions, 11 deletions
diff --git a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs
index 129d6d3..c459a66 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
101 } 101 }
102 } 102 }
103 103
104 private bool done = false;
105 /// <summary> 104 /// <summary>
106 /// Called back by the asset cache when it has the asset 105 /// Called back by the asset cache when it has the asset
107 /// </summary> 106 /// </summary>
@@ -127,14 +126,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver
127 126
128 if (m_foundAssetUuids.Count + m_notFoundAssetUuids.Count == m_repliesRequired) 127 if (m_foundAssetUuids.Count + m_notFoundAssetUuids.Count == m_repliesRequired)
129 { 128 {
130 if (done)
131 throw new Exception("AArgh");
132
133 m_log.DebugFormat( 129 m_log.DebugFormat(
134 "[ARCHIVER]: Successfully added {0} assets ({1} assets missing)", 130 "[ARCHIVER]: Successfully added {0} assets ({1} assets notified missing)",
135 m_foundAssetUuids.Count, m_notFoundAssetUuids.Count); 131 m_foundAssetUuids.Count, m_notFoundAssetUuids.Count);
136
137 done = true;
138 132
139 // We want to stop using the asset cache thread asap 133 // We want to stop using the asset cache thread asap
140 // as we now need to do the work of producing the rest of the archive 134 // 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
146 } 140 }
147 catch (Exception e) 141 catch (Exception e)
148 { 142 {
149 m_log.ErrorFormat("[ARCHIVER]: AssetRequestCallback failed with {0}", e); 143 m_log.ErrorFormat("[ARCHIVER]: AssetRequestCallback failed with {0}", e);
150 } 144 }
151 } 145 }
152 146
diff --git a/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs b/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs
index d028360..c894d8e 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
147 </SceneObjectPart> 147 </SceneObjectPart>
148 </RootPart> 148 </RootPart>
149 <OtherParts /> 149 <OtherParts />
150 </SceneObjectGroup> 150 </SceneObjectGroup>";
151 ";
152 151
153 private string xml2 = @" 152 private string xml2 = @"
154 <SceneObjectGroup> 153 <SceneObjectGroup>
@@ -243,7 +242,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
243 } 242 }
244 243
245 [Test] 244 [Test]
246 public void TestSerializeXml() 245 public void TestDeserializeXml()
247 { 246 {
248 TestHelper.InMethod(); 247 TestHelper.InMethod();
249 //log4net.Config.XmlConfigurator.Configure(); 248 //log4net.Config.XmlConfigurator.Configure();
@@ -256,6 +255,77 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
256 Assert.That(rootPart.Name, Is.EqualTo("PrimMyRide")); 255 Assert.That(rootPart.Name, Is.EqualTo("PrimMyRide"));
257 256
258 // TODO: Check other properties 257 // TODO: Check other properties
258 }
259
260 [Test]
261 public void TestSerializeXml()
262 {
263 TestHelper.InMethod();
264 //log4net.Config.XmlConfigurator.Configure();
265
266 string rpName = "My Little Donkey";
267 UUID rpUuid = UUID.Parse("00000000-0000-0000-0000-000000000964");
268 UUID rpCreatorId = UUID.Parse("00000000-0000-0000-0000-000000000915");
269 PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere();
270// Vector3 groupPosition = new Vector3(10, 20, 30);
271// Quaternion rotationOffset = new Quaternion(20, 30, 40, 50);
272// Vector3 offsetPosition = new Vector3(5, 10, 15);
273
274 SceneObjectPart rp = new SceneObjectPart();
275 rp.UUID = rpUuid;
276 rp.Name = rpName;
277 rp.CreatorID = rpCreatorId;
278 rp.Shape = shape;
279
280 SceneObjectGroup so = new SceneObjectGroup(rp);
281
282 // Need to add the object to the scene so that the request to get script state succeeds
283 m_scene.AddSceneObject(so);
284
285 string xml = SceneObjectSerializer.ToOriginalXmlFormat(so);
286
287 XmlTextReader xtr = new XmlTextReader(new StringReader(xml));
288 xtr.ReadStartElement("SceneObjectGroup");
289 xtr.ReadStartElement("RootPart");
290 xtr.ReadStartElement("SceneObjectPart");
291
292 UUID uuid = UUID.Zero;
293 string name = null;
294 UUID creatorId = UUID.Zero;
295
296 while (xtr.Read() && xtr.Name != "SceneObjectPart")
297 {
298 if (xtr.NodeType != XmlNodeType.Element)
299 continue;
300
301 switch (xtr.Name)
302 {
303 case "UUID":
304 xtr.ReadStartElement("UUID");
305 uuid = UUID.Parse(xtr.ReadElementString("Guid"));
306 xtr.ReadEndElement();
307 break;
308 case "Name":
309 name = xtr.ReadElementContentAsString();
310 break;
311 case "CreatorID":
312 xtr.ReadStartElement("CreatorID");
313 creatorId = UUID.Parse(xtr.ReadElementString("Guid"));
314 xtr.ReadEndElement();
315 break;
316 }
317 }
318
319 xtr.ReadEndElement();
320 xtr.ReadEndElement();
321 xtr.ReadStartElement("OtherParts");
322 xtr.ReadEndElement();
323 xtr.Close();
324
325 // TODO: More checks
326 Assert.That(uuid, Is.EqualTo(rpUuid));
327 Assert.That(name, Is.EqualTo(rpName));
328 Assert.That(creatorId, Is.EqualTo(rpCreatorId));
259 } 329 }
260 330
261 [Test] 331 [Test]