29 using System.Collections.Generic;
31 using OpenMetaverse.StructuredData;
32 using NUnit.Framework;
33 using OpenSim.Framework;
34 using OpenSim.Framework.Serialization.External;
35 using OpenSim.Tests.Common;
37 namespace OpenSim.Framework.Serialization.Tests
43 private LandData landWithParcelAccessList;
46 private static string preSerializedWithParcelAccessList
47 =
"<?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>0</Time>\n <AccessList>2</AccessList>\n </ParcelAccessEntry>\n <ParcelAccessEntry>\n <AgentID>ec2a8d18-2378-4fe0-8b68-2a31b57c481e</AgentID>\n <Time>0</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><0, 0, 0></UserLocation>\n <UserLookAt><0, 0, 0></UserLookAt>\n <Dwell>0</Dwell>\n <OtherCleanTime>0</OtherCleanTime>\n</LandData>";
54 this.land.AABBMax =
new Vector3(1, 2, 3);
55 this.land.AABBMin =
new Vector3(129, 130, 131);
57 this.land.AuctionID = 4;
58 this.land.AuthBuyerID =
new UUID(
"7176df0c-6c50-45db-8a37-5e78be56a0cd");
59 this.land.Category = ParcelCategory.Residential;
60 this.land.ClaimDate = 1;
61 this.land.ClaimPrice = 2;
62 this.land.GlobalID =
new UUID(
"54ff9641-dd40-4a2c-b1f1-47dd3af24e50");
63 this.land.GroupID =
new UUID(
"d740204e-bbbf-44aa-949d-02c7d739f6a5");
64 this.land.Description =
"land data to test LandDataSerializer";
65 this.land.Flags = (uint)(ParcelFlags.AllowDamage | ParcelFlags.AllowVoiceChat);
66 this.land.LandingType = (byte)LandingType.Direct;
67 this.land.Name =
"LandDataSerializerTest Land";
68 this.land.Status = ParcelStatus.Leased;
69 this.land.LocalID = 1;
70 this.land.MediaAutoScale = (byte)0x01;
71 this.land.MediaID =
new UUID(
"d4452578-2f25-4b97-a81b-819af559cfd7");
72 this.land.MediaURL =
"http://videos.opensimulator.org/bumblebee.mp4";
73 this.land.OwnerID =
new UUID(
"1b8eedf9-6d15-448b-8015-24286f1756bf");
75 this.landWithParcelAccessList = this.land.Copy();
76 this.landWithParcelAccessList.ParcelAccessList.Clear();
79 pae0.AgentID =
new UUID(
"62d65d45-c91a-4f77-862c-46557d978b6c");
80 pae0.Flags = AccessList.Ban;
82 this.landWithParcelAccessList.ParcelAccessList.Add(pae0);
85 pae1.AgentID =
new UUID(
"ec2a8d18-2378-4fe0-8b68-2a31b57c481e");
86 pae1.Flags = AccessList.Access;
88 this.landWithParcelAccessList.ParcelAccessList.Add(pae1);
121 TestHelpers.InMethod();
124 Dictionary<string, object>
options =
new Dictionary<string, object>();
125 LandData ld = LandDataSerializer.Deserialize(LandDataSerializer.Serialize(this.land,
options));
126 Assert.That(ld, Is.Not.Null,
"Deserialize(string) returned null");
129 Assert.That(ld.Area, Is.EqualTo(land.Area));
130 Assert.That(ld.AuctionID, Is.EqualTo(land.AuctionID));
131 Assert.That(ld.AuthBuyerID, Is.EqualTo(land.AuthBuyerID));
132 Assert.That(ld.Category, Is.EqualTo(land.Category));
133 Assert.That(ld.ClaimDate, Is.EqualTo(land.ClaimDate));
134 Assert.That(ld.ClaimPrice, Is.EqualTo(land.ClaimPrice));
135 Assert.That(ld.GlobalID, Is.EqualTo(land.GlobalID),
"Reified LandData.GlobalID != original LandData.GlobalID");
136 Assert.That(ld.GroupID, Is.EqualTo(land.GroupID));
137 Assert.That(ld.Description, Is.EqualTo(land.Description));
138 Assert.That(ld.Flags, Is.EqualTo(land.Flags));
139 Assert.That(ld.LandingType, Is.EqualTo(land.LandingType));
140 Assert.That(ld.Name, Is.EqualTo(land.Name),
"Reified LandData.Name != original LandData.Name");
141 Assert.That(ld.Status, Is.EqualTo(land.Status));
142 Assert.That(ld.LocalID, Is.EqualTo(land.LocalID));
143 Assert.That(ld.MediaAutoScale, Is.EqualTo(land.MediaAutoScale));
144 Assert.That(ld.MediaID, Is.EqualTo(land.MediaID));
145 Assert.That(ld.MediaURL, Is.EqualTo(land.MediaURL));
146 Assert.That(ld.OwnerID, Is.EqualTo(land.OwnerID));
152 TestHelpers.InMethod();
155 LandData ld = LandDataSerializer.Deserialize(LandDataSerializerTest.preSerializedWithParcelAccessList);
156 Assert.That(ld != null,
157 "Deserialize(string) returned null (pre-serialized with parcel access list)");
158 Assert.That(ld.GlobalID == this.landWithParcelAccessList.GlobalID,
159 "Reified LandData.GlobalID != original LandData.GlobalID (pre-serialized with parcel access list)");
160 Assert.That(ld.Name == this.landWithParcelAccessList.Name,
161 "Reified LandData.Name != original LandData.Name (pre-serialized with parcel access list)");
162 Assert.That(ld.ParcelAccessList.Count, Is.EqualTo(2));
163 Assert.That(ld.ParcelAccessList[0].AgentID, Is.EqualTo(UUID.Parse(
"62d65d45-c91a-4f77-862c-46557d978b6c")));
void TestLandDataDeserializeNoAccessLists()
Test the LandDataSerializer.Serialize() method
Details of a Parcel of land
Interactive OpenSim region server
void TestLandDataDeserializeWithAccessLists()