aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Serialization/Tests/LandDataSerializerTests.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/Serialization/Tests/LandDataSerializerTests.cs')
-rw-r--r--OpenSim/Framework/Serialization/Tests/LandDataSerializerTests.cs44
1 files changed, 41 insertions, 3 deletions
diff --git a/OpenSim/Framework/Serialization/Tests/LandDataSerializerTests.cs b/OpenSim/Framework/Serialization/Tests/LandDataSerializerTests.cs
index 06ec047..14e0462 100644
--- a/OpenSim/Framework/Serialization/Tests/LandDataSerializerTests.cs
+++ b/OpenSim/Framework/Serialization/Tests/LandDataSerializerTests.cs
@@ -39,7 +39,13 @@ namespace OpenSim.Framework.Serialization.Tests
39 public class LandDataSerializerTest 39 public class LandDataSerializerTest
40 { 40 {
41 private LandData land; 41 private LandData land;
42 private string preSerialized = "<?xml version=\"1.0\" encoding=\"utf-16\"?>\n<LandData>\n <Area>128</Area>\n <AuctionID>0</AuctionID>\n <AuthBuyerID>00000000-0000-0000-0000-000000000000</AuthBuyerID>\n <Category>10</Category>\n <ClaimDate>0</ClaimDate>\n <ClaimPrice>0</ClaimPrice>\n <GlobalID>54ff9641-dd40-4a2c-b1f1-47dd3af24e50</GlobalID>\n <GroupID>d740204e-bbbf-44aa-949d-02c7d739f6a5</GroupID>\n <IsGroupOwned>False</IsGroupOwned>\n <Bitmap>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</Bitmap>\n <Description>land data to test LandDataSerializer</Description>\n <Flags>536870944</Flags>\n <LandingType>2</LandingType>\n <Name>LandDataSerializerTest Land</Name>\n <Status>0</Status>\n <LocalID>0</LocalID>\n <MediaAutoScale>1</MediaAutoScale>\n <MediaID>d4452578-2f25-4b97-a81b-819af559cfd7</MediaID>\n <MediaURL>http://videos.opensimulator.org/bumblebee.mp4</MediaURL>\n <MusicURL />\n <OwnerID>1b8eedf9-6d15-448b-8015-24286f1756bf</OwnerID>\n <ParcelAccessList />\n <PassHours>0</PassHours>\n <PassPrice>0</PassPrice>\n <SalePrice>0</SalePrice>\n <SnapshotID>00000000-0000-0000-0000-000000000000</SnapshotID>\n <UserLocation>&lt;0, 0, 0&gt;</UserLocation>\n <UserLookAt>&lt;0, 0, 0&gt;</UserLookAt>\n <Dwell>0</Dwell>\n <OtherCleanTime>0</OtherCleanTime>\n</LandData>"; 42 private LandData landWithParcelAccessList;
43
44 private static string preSerialized = "<?xml version=\"1.0\" encoding=\"utf-16\"?>\n<LandData>\n <Area>128</Area>\n <AuctionID>0</AuctionID>\n <AuthBuyerID>00000000-0000-0000-0000-000000000000</AuthBuyerID>\n <Category>10</Category>\n <ClaimDate>0</ClaimDate>\n <ClaimPrice>0</ClaimPrice>\n <GlobalID>54ff9641-dd40-4a2c-b1f1-47dd3af24e50</GlobalID>\n <GroupID>d740204e-bbbf-44aa-949d-02c7d739f6a5</GroupID>\n <IsGroupOwned>False</IsGroupOwned>\n <Bitmap>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</Bitmap>\n <Description>land data to test LandDataSerializer</Description>\n <Flags>536870944</Flags>\n <LandingType>2</LandingType>\n <Name>LandDataSerializerTest Land</Name>\n <Status>0</Status>\n <LocalID>0</LocalID>\n <MediaAutoScale>1</MediaAutoScale>\n <MediaID>d4452578-2f25-4b97-a81b-819af559cfd7</MediaID>\n <MediaURL>http://videos.opensimulator.org/bumblebee.mp4</MediaURL>\n <MusicURL />\n <OwnerID>1b8eedf9-6d15-448b-8015-24286f1756bf</OwnerID>\n <ParcelAccessList />\n <PassHours>0</PassHours>\n <PassPrice>0</PassPrice>\n <SalePrice>0</SalePrice>\n <SnapshotID>00000000-0000-0000-0000-000000000000</SnapshotID>\n <UserLocation>&lt;0, 0, 0&gt;</UserLocation>\n <UserLookAt>&lt;0, 0, 0&gt;</UserLookAt>\n <Dwell>0</Dwell>\n <OtherCleanTime>0</OtherCleanTime>\n</LandData>";
45 private static string preSerializedWithParcelAccessList = "<?xml version=\"1.0\" encoding=\"utf-16\"?>\n<LandData>\n <Area>128</Area>\n <AuctionID>0</AuctionID>\n <AuthBuyerID>00000000-0000-0000-0000-000000000000</AuthBuyerID>\n <Category>10</Category>\n <ClaimDate>0</ClaimDate>\n <ClaimPrice>0</ClaimPrice>\n <GlobalID>54ff9641-dd40-4a2c-b1f1-47dd3af24e50</GlobalID>\n <GroupID>d740204e-bbbf-44aa-949d-02c7d739f6a5</GroupID>\n <IsGroupOwned>False</IsGroupOwned>\n <Bitmap>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</Bitmap>\n <Description>land data to test LandDataSerializer</Description>\n <Flags>536870944</Flags>\n <LandingType>2</LandingType>\n <Name>LandDataSerializerTest Land</Name>\n <Status>0</Status>\n <LocalID>0</LocalID>\n <MediaAutoScale>1</MediaAutoScale>\n <MediaID>d4452578-2f25-4b97-a81b-819af559cfd7</MediaID>\n <MediaURL>http://videos.opensimulator.org/bumblebee.mp4</MediaURL>\n <MusicURL />\n <OwnerID>1b8eedf9-6d15-448b-8015-24286f1756bf</OwnerID>\n <ParcelAccessList>\n <ParcelAccessEntry>\n <AgentID>62d65d45-c91a-4f77-862c-46557d978b6c</AgentID>\n <Time>2009-10-01T00:00:00</Time>\n <AccessList>2</AccessList>\n </ParcelAccessEntry>\n <ParcelAccessEntry>\n <AgentID>ec2a8d18-2378-4fe0-8b68-2a31b57c481e</AgentID>\n <Time>2010-10-20T00:00:00</Time>\n <AccessList>1</AccessList>\n </ParcelAccessEntry>\n </ParcelAccessList>\n <PassHours>0</PassHours>\n <PassPrice>0</PassPrice>\n <SalePrice>0</SalePrice>\n <SnapshotID>00000000-0000-0000-0000-000000000000</SnapshotID>\n <UserLocation>&lt;0, 0, 0&gt;</UserLocation>\n <UserLookAt>&lt;0, 0, 0&gt;</UserLookAt>\n <Dwell>0</Dwell>\n <OtherCleanTime>0</OtherCleanTime>\n</LandData>";
46
47
48
43 49
44 [SetUp] 50 [SetUp]
45 public void setup() 51 public void setup()
@@ -67,27 +73,59 @@ namespace OpenSim.Framework.Serialization.Tests
67 this.land.MediaID = new UUID("d4452578-2f25-4b97-a81b-819af559cfd7"); 73 this.land.MediaID = new UUID("d4452578-2f25-4b97-a81b-819af559cfd7");
68 this.land.MediaURL = "http://videos.opensimulator.org/bumblebee.mp4"; 74 this.land.MediaURL = "http://videos.opensimulator.org/bumblebee.mp4";
69 this.land.OwnerID = new UUID("1b8eedf9-6d15-448b-8015-24286f1756bf"); 75 this.land.OwnerID = new UUID("1b8eedf9-6d15-448b-8015-24286f1756bf");
76
77 this.landWithParcelAccessList = this.land.Copy();
78 this.landWithParcelAccessList.ParcelAccessList.Clear();
79
80 ParcelManager.ParcelAccessEntry pae0 = new ParcelManager.ParcelAccessEntry();
81 pae0.AgentID = new UUID("62d65d45-c91a-4f77-862c-46557d978b6c");
82 pae0.Flags = AccessList.Ban;
83 pae0.Time = new DateTime(2009, 10, 01);
84 this.landWithParcelAccessList.ParcelAccessList.Add(pae0);
85
86 ParcelManager.ParcelAccessEntry pae1 = new ParcelManager.ParcelAccessEntry();
87 pae1.AgentID = new UUID("ec2a8d18-2378-4fe0-8b68-2a31b57c481e");
88 pae1.Flags = AccessList.Access;
89 pae1.Time = new DateTime(2010, 10, 20);
90 this.landWithParcelAccessList.ParcelAccessList.Add(pae1);
70 } 91 }
71 92
72 /// <summary> 93 /// <summary>
94 /// Test the LandDataSerializer.Serialize() method
73 /// </summary> 95 /// </summary>
74 [Test] 96 [Test]
75 public void LandDataSerializerSerializeTest() 97 public void LandDataSerializerSerializeTest()
76 { 98 {
77 string serialized = LandDataSerializer.Serialize(this.land); 99 string serialized = LandDataSerializer.Serialize(this.land);
78 Assert.That(serialized.Length > 0, "Serialize(LandData) returned empty string"); 100 Assert.That(serialized.Length > 0, "Serialize(LandData) returned empty string");
79 Assert.That(serialized == this.preSerialized, "result of Serialize(LandData) does not match expected result"); 101 Assert.That(serialized == LandDataSerializerTest.preSerialized,
102 "result of Serialize(LandData) does not match expected result");
103
104 string serializedWithParcelAccessList = LandDataSerializer.Serialize(this.landWithParcelAccessList);
105 Assert.That(serializedWithParcelAccessList.Length > 0,
106 "Serialize(LandData) returned empty string for LandData object with ParcelAccessList");
107 Assert.That(serializedWithParcelAccessList == LandDataSerializerTest.preSerializedWithParcelAccessList,
108 "result of Serialize(LandData) does not match expected result (pre-serialized with parcel access list");
80 } 109 }
81 110
82 /// <summary> 111 /// <summary>
112 /// Test the LandDataSerializer.Deserialize() method
83 /// </summary> 113 /// </summary>
84 [Test] 114 [Test]
85 public void TestLandDataSerializerDeserializeFromStringTest() 115 public void TestLandDataSerializerDeserializeFromStringTest()
86 { 116 {
87 LandData reifiedLandData = LandDataSerializer.Deserialize(this.preSerialized); 117 LandData reifiedLandData = LandDataSerializer.Deserialize(LandDataSerializerTest.preSerialized);
88 Assert.That(reifiedLandData != null, "Deserialize(string) returned null"); 118 Assert.That(reifiedLandData != null, "Deserialize(string) returned null");
89 Assert.That(reifiedLandData.GlobalID == this.land.GlobalID, "Reified LandData.GlobalID != original LandData.GlobalID"); 119 Assert.That(reifiedLandData.GlobalID == this.land.GlobalID, "Reified LandData.GlobalID != original LandData.GlobalID");
90 Assert.That(reifiedLandData.Name == this.land.Name, "Reified LandData.Name != original LandData.Name"); 120 Assert.That(reifiedLandData.Name == this.land.Name, "Reified LandData.Name != original LandData.Name");
121
122 LandData reifiedLandDataWithParcelAccessList = LandDataSerializer.Deserialize(LandDataSerializerTest.preSerializedWithParcelAccessList);
123 Assert.That(reifiedLandDataWithParcelAccessList != null,
124 "Deserialize(string) returned null (pre-serialized with parcel access list)");
125 Assert.That(reifiedLandDataWithParcelAccessList.GlobalID == this.landWithParcelAccessList.GlobalID,
126 "Reified LandData.GlobalID != original LandData.GlobalID (pre-serialized with parcel access list)");
127 Assert.That(reifiedLandDataWithParcelAccessList.Name == this.landWithParcelAccessList.Name,
128 "Reified LandData.Name != original LandData.Name (pre-serialized with parcel access list)");
91 } 129 }
92 } 130 }
93} 131}