aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authordr scofield (aka dirk husemann)2009-10-01 09:47:45 +0200
committerdr scofield (aka dirk husemann)2009-10-01 09:47:45 +0200
commit40cf840df26e66fca8ab81d602fd67ff1d2a6afa (patch)
tree5cc8d3ffafa5f4f7ac441aec49664bbc133912df
parentadding skeleton test case for LandDataSerializer [w-i-p] (diff)
downloadopensim-SC_OLD-40cf840df26e66fca8ab81d602fd67ff1d2a6afa.zip
opensim-SC_OLD-40cf840df26e66fca8ab81d602fd67ff1d2a6afa.tar.gz
opensim-SC_OLD-40cf840df26e66fca8ab81d602fd67ff1d2a6afa.tar.bz2
opensim-SC_OLD-40cf840df26e66fca8ab81d602fd67ff1d2a6afa.tar.xz
adding testcase for LandDataSerializer; fixing LandDataSerializer ;-)
Diffstat (limited to '')
-rw-r--r--.nant/local.include5
-rw-r--r--OpenSim/Framework/Serialization/External/LandDataSerializer.cs64
-rw-r--r--OpenSim/Framework/Serialization/Tests/LandDataSerializerTests.cs86
-rw-r--r--prebuild.xml5
4 files changed, 126 insertions, 34 deletions
diff --git a/.nant/local.include b/.nant/local.include
index 8c72c80..8e233d0 100644
--- a/.nant/local.include
+++ b/.nant/local.include
@@ -53,6 +53,11 @@
53 </exec> 53 </exec>
54 <fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.framework.servers.tests)==0}" /> 54 <fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.framework.servers.tests)==0}" />
55 55
56 <exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.framework.serialization.tests">
57 <arg value="./bin/OpenSim.Framework.Serialization.Tests.dll" />
58 </exec>
59 <fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.framework.serialization.tests)==0}" />
60
56 <exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.region.clientstack.lindenudp.tests"> 61 <exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.region.clientstack.lindenudp.tests">
57 <arg value="./bin/OpenSim.Region.ClientStack.LindenUDP.Tests.dll" /> 62 <arg value="./bin/OpenSim.Region.ClientStack.LindenUDP.Tests.dll" />
58 </exec> 63 </exec>
diff --git a/OpenSim/Framework/Serialization/External/LandDataSerializer.cs b/OpenSim/Framework/Serialization/External/LandDataSerializer.cs
index 6bfae41..0d91859 100644
--- a/OpenSim/Framework/Serialization/External/LandDataSerializer.cs
+++ b/OpenSim/Framework/Serialization/External/LandDataSerializer.cs
@@ -132,47 +132,47 @@ namespace OpenSim.Framework.Serialization.External
132 xtw.WriteStartDocument(); 132 xtw.WriteStartDocument();
133 xtw.WriteStartElement("LandData"); 133 xtw.WriteStartElement("LandData");
134 134
135 xtw.WriteElementString("Area", landData.Area.ToString()); 135 xtw.WriteElementString("Area", Convert.ToString(landData.Area));
136 xtw.WriteElementString("AuctionID", landData.AuctionID.ToString()); 136 xtw.WriteElementString("AuctionID", Convert.ToString(landData.AuctionID));
137 xtw.WriteElementString("AuthBuyerID", landData.AuthBuyerID.ToString()); 137 xtw.WriteElementString("AuthBuyerID", landData.AuthBuyerID.ToString());
138 xtw.WriteElementString("Category", landData.Category.ToString()); 138 xtw.WriteElementString("Category", Convert.ToString(landData.Category));
139 xtw.WriteElementString("ClaimDate", landData.ClaimDate.ToString()); 139 xtw.WriteElementString("ClaimDate", Convert.ToString(landData.ClaimDate));
140 xtw.WriteElementString("ClaimPrice", landData.ClaimPrice.ToString()); 140 xtw.WriteElementString("ClaimPrice", Convert.ToString(landData.ClaimPrice));
141 xtw.WriteElementString("GlobalID", landData.GlobalID.ToString()); 141 xtw.WriteElementString("GlobalID", landData.GlobalID.ToString());
142 xtw.WriteElementString("GroupID", landData.GroupID.ToString()); 142 xtw.WriteElementString("GroupID", landData.GroupID.ToString());
143 xtw.WriteElementString("IsGroupOwned", landData.IsGroupOwned.ToString()); 143 xtw.WriteElementString("IsGroupOwned", Convert.ToString(landData.IsGroupOwned));
144 xtw.WriteElementString("Bitmap", landData.Bitmap.ToString()); 144 xtw.WriteElementString("Bitmap", Convert.ToBase64String(landData.Bitmap));
145 xtw.WriteElementString("Description", landData.Description); 145 xtw.WriteElementString("Description", landData.Description);
146 xtw.WriteElementString("Flags", landData.Flags.ToString()); 146 xtw.WriteElementString("Flags", Convert.ToString(landData.Flags));
147 xtw.WriteElementString("LandingType", landData.LandingType.ToString()); 147 xtw.WriteElementString("LandingType", Convert.ToString(landData.LandingType));
148 xtw.WriteElementString("Name", landData.Name); 148 xtw.WriteElementString("Name", landData.Name);
149 xtw.WriteElementString("Status", landData.Status.ToString()); 149 xtw.WriteElementString("Status", Convert.ToString(landData.Status));
150 xtw.WriteElementString("LocalID", landData.LocalID.ToString()); 150 xtw.WriteElementString("LocalID", landData.LocalID.ToString());
151 xtw.WriteElementString("MediaAutoScale", landData.MediaAutoScale.ToString()); 151 xtw.WriteElementString("MediaAutoScale", Convert.ToString(landData.MediaAutoScale));
152 xtw.WriteElementString("MediaID", landData.MediaID.ToString()); 152 xtw.WriteElementString("MediaID", landData.MediaID.ToString());
153 xtw.WriteElementString("MediaURL", landData.MediaURL.ToString()); 153 xtw.WriteElementString("MediaURL", landData.MediaURL);
154 xtw.WriteElementString("MusicURL", landData.MusicURL.ToString()); 154 xtw.WriteElementString("MusicURL", landData.MusicURL);
155 xtw.WriteElementString("OwnerID", landData.OwnerID.ToString()); 155 xtw.WriteElementString("OwnerID", landData.OwnerID.ToString());
156 156
157 xtw.WriteStartElement("ParcelAccessList"); 157 xtw.WriteStartElement("ParcelAccessList");
158 foreach(ParcelManager.ParcelAccessEntry pal in landData.ParcelAccessList) 158 foreach(ParcelManager.ParcelAccessEntry pal in landData.ParcelAccessList)
159 { 159 {
160 xtw.WriteStartElement("ParcelAccessEntry"); 160 xtw.WriteStartElement("ParcelAccessEntry");
161 xtw.WriteElementString("AgentID", pal.AgentID.ToString()); 161 xtw.WriteElementString("AgentID", pal.AgentID.ToString());
162 xtw.WriteElementString("Time", pal.Time.ToString()); 162 xtw.WriteElementString("Time", Convert.ToString(pal.Time));
163 xtw.WriteElementString("AccessList", pal.Flags.ToString()); 163 xtw.WriteElementString("AccessList", Convert.ToString(pal.Flags));
164 xtw.WriteEndElement(); 164 xtw.WriteEndElement();
165 } 165 }
166 xtw.WriteEndElement(); 166 xtw.WriteEndElement();
167 167
168 xtw.WriteElementString("PassHours", landData.PassHours.ToString()); 168 xtw.WriteElementString("PassHours", Convert.ToString(landData.PassHours));
169 xtw.WriteElementString("PassPrice", landData.PassPrice.ToString()); 169 xtw.WriteElementString("PassPrice", Convert.ToString(landData.PassPrice));
170 xtw.WriteElementString("SalePrice", landData.SalePrice.ToString()); 170 xtw.WriteElementString("SalePrice", Convert.ToString(landData.SalePrice));
171 xtw.WriteElementString("SnapshotID", landData.SnapshotID.ToString()); 171 xtw.WriteElementString("SnapshotID", landData.SnapshotID.ToString());
172 xtw.WriteElementString("UserLocation", landData.UserLocation.ToString()); 172 xtw.WriteElementString("UserLocation", landData.UserLocation.ToString());
173 xtw.WriteElementString("UserLookAt", landData.UserLookAt.ToString()); 173 xtw.WriteElementString("UserLookAt", landData.UserLookAt.ToString());
174 xtw.WriteElementString("Dwell", landData.Dwell.ToString()); 174 xtw.WriteElementString("Dwell", Convert.ToString(landData.Dwell));
175 xtw.WriteElementString("OtherCleanTime", landData.OtherCleanTime.ToString()); 175 xtw.WriteElementString("OtherCleanTime", Convert.ToString(landData.OtherCleanTime));
176 176
177 xtw.WriteEndElement(); 177 xtw.WriteEndElement();
178 178
diff --git a/OpenSim/Framework/Serialization/Tests/LandDataSerializerTests.cs b/OpenSim/Framework/Serialization/Tests/LandDataSerializerTests.cs
new file mode 100644
index 0000000..f1881a1
--- /dev/null
+++ b/OpenSim/Framework/Serialization/Tests/LandDataSerializerTests.cs
@@ -0,0 +1,86 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System.Collections.Generic;
29using OpenSim.Framework;
30using OpenSim.Framework.Serialization.External;
31using OpenMetaverse;
32using OpenMetaverse.StructuredData;
33using NUnit.Framework;
34
35namespace OpenSim.Framework.Serialization.Tests
36{
37 [TestFixture]
38 public class LandDataSerializerTest
39 {
40 private LandData land;
41
42 [SetUp]
43 public void setup()
44 {
45 // setup LandData object
46 this.land = new LandData();
47 this.land.AABBMax = new Vector3(0, 0, 0);
48 this.land.AABBMin = new Vector3(128, 128, 128);
49 this.land.Area = 128;
50 this.land.AuctionID = 0;
51 this.land.AuthBuyerID = new UUID();
52 this.land.Category = ParcelCategory.Residential;
53 this.land.ClaimDate = 0;
54 this.land.ClaimPrice = 0;
55 this.land.GlobalID = new UUID("54ff9641-dd40-4a2c-b1f1-47dd3af24e50");
56 this.land.GroupID = new UUID("d740204e-bbbf-44aa-949d-02c7d739f6a5");
57 this.land.GroupPrims = 0;
58 this.land.Description = "land data to test LandDataSerializer";
59 this.land.Flags = (uint)(ParcelFlags.AllowDamage | ParcelFlags.AllowVoiceChat);
60 this.land.LandingType = (byte)LandingType.Direct;
61 this.land.Name = "LandDataSerializerTest Land";
62 this.land.Status = ParcelStatus.Leased;
63 this.land.LocalID = 0;
64 this.land.MediaAutoScale = (byte)0x01;
65 this.land.MediaID = new UUID("d4452578-2f25-4b97-a81b-819af559cfd7");
66 this.land.MediaURL = "http://videos.opensimulator.org/bumblebee.mp4";
67 this.land.OwnerID = new UUID("1b8eedf9-6d15-448b-8015-24286f1756bf");
68 }
69
70 /// <summary>
71 /// </summary>
72 [Test]
73 public void TestLandDataSerializerSerializeTest()
74 {
75 string serialized = LandDataSerializer.Serialize(this.land);
76 Assert.That(serialized.Length > 0);
77 }
78
79 /// <summary>
80 /// </summary>
81 [Test]
82 public void TestLandDataSerializerDeserializeTest()
83 {
84 }
85 }
86}
diff --git a/prebuild.xml b/prebuild.xml
index d02004b..ce04f12 100644
--- a/prebuild.xml
+++ b/prebuild.xml
@@ -3486,6 +3486,9 @@
3486 3486
3487 <ReferencePath>../../../../bin/</ReferencePath> 3487 <ReferencePath>../../../../bin/</ReferencePath>
3488 <Reference name="System"/> 3488 <Reference name="System"/>
3489 <Reference name="OpenMetaverse.dll"/>
3490 <Reference name="OpenMetaverseTypes.dll"/>
3491 <Reference name="OpenMetaverse.StructuredData.dll"/>
3489 <Reference name="OpenSim.Data"/> 3492 <Reference name="OpenSim.Data"/>
3490 <Reference name="OpenSim.Services.Interfaces"/> 3493 <Reference name="OpenSim.Services.Interfaces"/>
3491 <Reference name="OpenSim.Tests.Common"/> 3494 <Reference name="OpenSim.Tests.Common"/>
@@ -3493,8 +3496,6 @@
3493 <Reference name="OpenSim.Framework.Serialization"/> 3496 <Reference name="OpenSim.Framework.Serialization"/>
3494 <Reference name="OpenSim.Framework.Serialization.External"/> 3497 <Reference name="OpenSim.Framework.Serialization.External"/>
3495 <Reference name="log4net.dll"/> 3498 <Reference name="log4net.dll"/>
3496 <Reference name="OpenMetaverse.dll"/>
3497 <Reference name="OpenMetaverse.StructuredData.dll"/>
3498 <Reference name="nunit.framework.dll" /> 3499 <Reference name="nunit.framework.dll" />
3499 3500
3500 <Files> 3501 <Files>