diff options
author | Justin Clark-Casey (justincc) | 2012-02-03 22:21:54 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-02-03 22:21:54 +0000 |
commit | f17066b7bf27c22448d883e0af9d20a42f671b62 (patch) | |
tree | c1b4fed29d33d2055dd990fd53c616a8fe1e8f60 /OpenSim/Framework/Serialization/Tests | |
parent | Corrected console help texts for "save iar" (diff) | |
download | opensim-SC_OLD-f17066b7bf27c22448d883e0af9d20a42f671b62.zip opensim-SC_OLD-f17066b7bf27c22448d883e0af9d20a42f671b62.tar.gz opensim-SC_OLD-f17066b7bf27c22448d883e0af9d20a42f671b62.tar.bz2 opensim-SC_OLD-f17066b7bf27c22448d883e0af9d20a42f671b62.tar.xz |
Change LandDataSerializer deserialization so that in the future it won't care about extra elements or element order.
This brings it into line with other deserializations such as object and will improve future backward compatibility.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/Serialization/Tests/LandDataSerializerTests.cs | 37 |
1 files changed, 26 insertions, 11 deletions
diff --git a/OpenSim/Framework/Serialization/Tests/LandDataSerializerTests.cs b/OpenSim/Framework/Serialization/Tests/LandDataSerializerTests.cs index 3607ce8..11a3a0a 100644 --- a/OpenSim/Framework/Serialization/Tests/LandDataSerializerTests.cs +++ b/OpenSim/Framework/Serialization/Tests/LandDataSerializerTests.cs | |||
@@ -27,11 +27,12 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using OpenSim.Framework; | ||
31 | using OpenSim.Framework.Serialization.External; | ||
32 | using OpenMetaverse; | 30 | using OpenMetaverse; |
33 | using OpenMetaverse.StructuredData; | 31 | using OpenMetaverse.StructuredData; |
34 | using NUnit.Framework; | 32 | using NUnit.Framework; |
33 | using OpenSim.Framework; | ||
34 | using OpenSim.Framework.Serialization.External; | ||
35 | using OpenSim.Tests.Common; | ||
35 | 36 | ||
36 | namespace OpenSim.Framework.Serialization.Tests | 37 | namespace OpenSim.Framework.Serialization.Tests |
37 | { | 38 | { |
@@ -92,6 +93,8 @@ namespace OpenSim.Framework.Serialization.Tests | |||
92 | [Test] | 93 | [Test] |
93 | public void LandDataSerializerSerializeTest() | 94 | public void LandDataSerializerSerializeTest() |
94 | { | 95 | { |
96 | TestHelpers.InMethod(); | ||
97 | |||
95 | string serialized = LandDataSerializer.Serialize(this.land).Replace("\r\n", "\n"); | 98 | string serialized = LandDataSerializer.Serialize(this.land).Replace("\r\n", "\n"); |
96 | Assert.That(serialized.Length > 0, "Serialize(LandData) returned empty string"); | 99 | Assert.That(serialized.Length > 0, "Serialize(LandData) returned empty string"); |
97 | 100 | ||
@@ -112,20 +115,32 @@ namespace OpenSim.Framework.Serialization.Tests | |||
112 | /// Test the LandDataSerializer.Deserialize() method | 115 | /// Test the LandDataSerializer.Deserialize() method |
113 | /// </summary> | 116 | /// </summary> |
114 | [Test] | 117 | [Test] |
115 | public void TestLandDataSerializerDeserializeFromStringTest() | 118 | public void TestLandDataDeserializeNoAccessLists() |
119 | { | ||
120 | TestHelpers.InMethod(); | ||
121 | log4net.Config.XmlConfigurator.Configure(); | ||
122 | |||
123 | LandData ld = LandDataSerializer.Deserialize(LandDataSerializerTest.preSerialized); | ||
124 | Assert.That(ld != null, "Deserialize(string) returned null"); | ||
125 | Assert.That(ld.GlobalID == this.land.GlobalID, "Reified LandData.GlobalID != original LandData.GlobalID"); | ||
126 | Assert.That(ld.Name == this.land.Name, "Reified LandData.Name != original LandData.Name"); | ||
127 | } | ||
128 | |||
129 | [Test] | ||
130 | public void TestLandDataDeserializeWithAccessLists() | ||
116 | { | 131 | { |
117 | LandData reifiedLandData = LandDataSerializer.Deserialize(LandDataSerializerTest.preSerialized); | 132 | TestHelpers.InMethod(); |
118 | Assert.That(reifiedLandData != null, "Deserialize(string) returned null"); | 133 | // log4net.Config.XmlConfigurator.Configure(); |
119 | Assert.That(reifiedLandData.GlobalID == this.land.GlobalID, "Reified LandData.GlobalID != original LandData.GlobalID"); | ||
120 | Assert.That(reifiedLandData.Name == this.land.Name, "Reified LandData.Name != original LandData.Name"); | ||
121 | 134 | ||
122 | LandData reifiedLandDataWithParcelAccessList = LandDataSerializer.Deserialize(LandDataSerializerTest.preSerializedWithParcelAccessList); | 135 | LandData ld = LandDataSerializer.Deserialize(LandDataSerializerTest.preSerializedWithParcelAccessList); |
123 | Assert.That(reifiedLandDataWithParcelAccessList != null, | 136 | Assert.That(ld != null, |
124 | "Deserialize(string) returned null (pre-serialized with parcel access list)"); | 137 | "Deserialize(string) returned null (pre-serialized with parcel access list)"); |
125 | Assert.That(reifiedLandDataWithParcelAccessList.GlobalID == this.landWithParcelAccessList.GlobalID, | 138 | Assert.That(ld.GlobalID == this.landWithParcelAccessList.GlobalID, |
126 | "Reified LandData.GlobalID != original LandData.GlobalID (pre-serialized with parcel access list)"); | 139 | "Reified LandData.GlobalID != original LandData.GlobalID (pre-serialized with parcel access list)"); |
127 | Assert.That(reifiedLandDataWithParcelAccessList.Name == this.landWithParcelAccessList.Name, | 140 | Assert.That(ld.Name == this.landWithParcelAccessList.Name, |
128 | "Reified LandData.Name != original LandData.Name (pre-serialized with parcel access list)"); | 141 | "Reified LandData.Name != original LandData.Name (pre-serialized with parcel access list)"); |
142 | Assert.That(ld.ParcelAccessList.Count, Is.EqualTo(2)); | ||
143 | Assert.That(ld.ParcelAccessList[0].AgentID, Is.EqualTo(UUID.Parse("62d65d45-c91a-4f77-862c-46557d978b6c"))); | ||
129 | } | 144 | } |
130 | } | 145 | } |
131 | } | 146 | } |