aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-05-15 23:43:59 +0100
committerJustin Clark-Casey (justincc)2012-05-15 23:43:59 +0100
commit1b5ce8c10e492308eeb44c82fee0c65cec855327 (patch)
tree699bb92bdb6b98be78d9933037961f5de8ede003
parentAllow use of regular expressions in "show object name", "show part name" and ... (diff)
downloadopensim-SC_OLD-1b5ce8c10e492308eeb44c82fee0c65cec855327.zip
opensim-SC_OLD-1b5ce8c10e492308eeb44c82fee0c65cec855327.tar.gz
opensim-SC_OLD-1b5ce8c10e492308eeb44c82fee0c65cec855327.tar.bz2
opensim-SC_OLD-1b5ce8c10e492308eeb44c82fee0c65cec855327.tar.xz
Fix issue where loading OARs could sometimes result in link numbers being reordered.
This was because the parts in scene objects were sometimes not serialized in link order. This is perfectly fine since the parts still have the right link numbers, but an extra fix to adjust for this had not been done in the SerialiserModule methods that OAR loading used. Add regression test for same. Addresses http://opensimulator.org/mantis/view.php?id=5948, http://opensimulator.org/mantis/view.php?id=5749
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs4
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs53
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs13
-rw-r--r--OpenSim/Tests/Common/Helpers/SceneHelpers.cs8
4 files changed, 72 insertions, 6 deletions
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
index bf0ff75..11eca12 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
@@ -41,6 +41,7 @@ using OpenSim.Framework.Serialization.External;
41using OpenSim.Region.CoreModules.World.Terrain; 41using OpenSim.Region.CoreModules.World.Terrain;
42using OpenSim.Region.Framework.Interfaces; 42using OpenSim.Region.Framework.Interfaces;
43using OpenSim.Region.Framework.Scenes; 43using OpenSim.Region.Framework.Scenes;
44using OpenSim.Region.Framework.Scenes.Serialization;
44using OpenSim.Services.Interfaces; 45using OpenSim.Services.Interfaces;
45 46
46namespace OpenSim.Region.CoreModules.World.Archiver 47namespace OpenSim.Region.CoreModules.World.Archiver
@@ -266,7 +267,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver
266 } 267 }
267 */ 268 */
268 269
269 SceneObjectGroup sceneObject = serialiser.DeserializeGroupFromXml2(serialisedSceneObject); 270 SceneObjectGroup sceneObject = SceneObjectSerializer.FromXml2Format(serialisedSceneObject);
271// SceneObjectGroup sceneObject = serialiser.DeserializeGroupFromXml2(serialisedSceneObject);
270 272
271 bool isTelehub = (sceneObject.UUID == oldTelehubUUID); 273 bool isTelehub = (sceneObject.UUID == oldTelehubUUID);
272 274
diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
index 394ca27..5deaf52 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
@@ -292,6 +292,59 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
292 } 292 }
293 293
294 /// <summary> 294 /// <summary>
295 /// Test loading an OpenSim Region Archive where the scene object parts are not ordered by link number (e.g.
296 /// 2 can come after 3).
297 /// </summary>
298 [Test]
299 public void TestLoadOarUnorderedParts()
300 {
301 TestHelpers.InMethod();
302
303 UUID ownerId = TestHelpers.ParseTail(0xaaaa);
304
305 MemoryStream archiveWriteStream = new MemoryStream();
306 TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream);
307
308 tar.WriteFile(
309 ArchiveConstants.CONTROL_FILE_PATH,
310 new ArchiveWriteRequestPreparation(null, (Stream)null, Guid.Empty).CreateControlFile(new Dictionary<string, Object>()));
311
312 SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, ownerId, "obj1-", 0x11);
313 SceneObjectPart sop2
314 = SceneHelpers.CreateSceneObjectPart("obj1-Part2", TestHelpers.ParseTail(0x12), ownerId);
315 SceneObjectPart sop3
316 = SceneHelpers.CreateSceneObjectPart("obj1-Part3", TestHelpers.ParseTail(0x13), ownerId);
317
318 // Add the parts so they will be written out in reverse order to the oar
319 sog1.AddPart(sop3);
320 sop3.LinkNum = 3;
321 sog1.AddPart(sop2);
322 sop2.LinkNum = 2;
323
324 tar.WriteFile(
325 ArchiveConstants.CreateOarObjectPath(sog1.Name, sog1.UUID, sog1.AbsolutePosition),
326 SceneObjectSerializer.ToXml2Format(sog1));
327
328 tar.Close();
329
330 MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray());
331
332 lock (this)
333 {
334 m_scene.EventManager.OnOarFileLoaded += LoadCompleted;
335 m_archiverModule.DearchiveRegion(archiveReadStream);
336 }
337
338 Assert.That(m_lastErrorMessage, Is.Null);
339
340 SceneObjectPart part2 = m_scene.GetSceneObjectPart("obj1-Part2");
341 Assert.That(part2.LinkNum, Is.EqualTo(2));
342
343 SceneObjectPart part3 = m_scene.GetSceneObjectPart("obj1-Part3");
344 Assert.That(part3.LinkNum, Is.EqualTo(3));
345 }
346
347 /// <summary>
295 /// Test loading an OpenSim Region Archive. 348 /// Test loading an OpenSim Region Archive.
296 /// </summary> 349 /// </summary>
297 [Test] 350 [Test]
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index f911ef8..1a940aa 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -932,7 +932,18 @@ namespace OpenSim.Region.Framework.Scenes
932 public int LinkNum 932 public int LinkNum
933 { 933 {
934 get { return m_linkNum; } 934 get { return m_linkNum; }
935 set { m_linkNum = value; } 935 set
936 {
937// if (ParentGroup != null)
938// {
939// m_log.DebugFormat(
940// "[SCENE OBJECT PART]: Setting linknum of {0}@{1} to {2} from {3}",
941// Name, AbsolutePosition, value, m_linkNum);
942// Util.PrintCallStack();
943// }
944
945 m_linkNum = value;
946 }
936 } 947 }
937 948
938 public byte ClickAction 949 public byte ClickAction
diff --git a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs
index 78f9434..59829d9 100644
--- a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs
+++ b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs
@@ -624,7 +624,7 @@ namespace OpenSim.Tests.Common
624 /// <param name="ownerId"></param> 624 /// <param name="ownerId"></param>
625 /// <param name="partNamePrefix"> 625 /// <param name="partNamePrefix">
626 /// The prefix to be given to part names. This will be suffixed with "Part<part no>" 626 /// The prefix to be given to part names. This will be suffixed with "Part<part no>"
627 /// (e.g. mynamePart0 for the root part) 627 /// (e.g. mynamePart1 for the root part)
628 /// </param> 628 /// </param>
629 /// <param name="uuidTail"> 629 /// <param name="uuidTail">
630 /// The hexadecimal last part of the UUID for parts created. A UUID of the form "00000000-0000-0000-0000-{0:XD12}" 630 /// The hexadecimal last part of the UUID for parts created. A UUID of the form "00000000-0000-0000-0000-{0:XD12}"
@@ -637,14 +637,14 @@ namespace OpenSim.Tests.Common
637 637
638 SceneObjectGroup sog 638 SceneObjectGroup sog
639 = new SceneObjectGroup( 639 = new SceneObjectGroup(
640 CreateSceneObjectPart(string.Format("{0}Part0", partNamePrefix), new UUID(rawSogId), ownerId)); 640 CreateSceneObjectPart(string.Format("{0}Part1", partNamePrefix), new UUID(rawSogId), ownerId));
641 641
642 if (parts > 1) 642 if (parts > 1)
643 for (int i = 1; i < parts; i++) 643 for (int i = 2; i <= parts; i++)
644 sog.AddPart( 644 sog.AddPart(
645 CreateSceneObjectPart( 645 CreateSceneObjectPart(
646 string.Format("{0}Part{1}", partNamePrefix, i), 646 string.Format("{0}Part{1}", partNamePrefix, i),
647 new UUID(string.Format("00000000-0000-0000-0000-{0:X12}", uuidTail + i)), 647 new UUID(string.Format("00000000-0000-0000-0000-{0:X12}", uuidTail + i - 1)),
648 ownerId)); 648 ownerId));
649 649
650 return sog; 650 return sog;