aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Framework/LandData.cs2
-rw-r--r--OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs53
-rw-r--r--OpenSim/Framework/Serialization/External/LandDataSerializer.cs179
-rw-r--r--OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs36
-rw-r--r--OpenSim/Framework/Serialization/External/UserProfileSerializer.cs5
-rw-r--r--OpenSim/Framework/Serialization/Tests/LandDataSerializerTests.cs37
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs4
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs30
-rw-r--r--bin/OpenSim.Framework.Serialization.Tests.dll.config33
-rw-r--r--prebuild.xml1
10 files changed, 257 insertions, 123 deletions
diff --git a/OpenSim/Framework/LandData.cs b/OpenSim/Framework/LandData.cs
index 58a80ef..f6271ef 100644
--- a/OpenSim/Framework/LandData.cs
+++ b/OpenSim/Framework/LandData.cs
@@ -34,7 +34,7 @@ using OpenMetaverse;
34 34
35namespace OpenSim.Framework 35namespace OpenSim.Framework
36{ 36{
37 public struct LandAccessEntry 37 public class LandAccessEntry
38 { 38 {
39 public UUID AgentID; 39 public UUID AgentID;
40 public int Expires; 40 public int Expires;
diff --git a/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs b/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs
index 7447ac2..39a9f37 100644
--- a/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs
+++ b/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs
@@ -24,11 +24,13 @@
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 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. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27
27using System; 28using System;
28using System.Collections.Generic; 29using System.Collections.Generic;
29using System.IO; 30using System.IO;
31using System.Reflection;
30using System.Xml; 32using System.Xml;
31 33using log4net;
32using OpenMetaverse; 34using OpenMetaverse;
33using OpenSim.Services.Interfaces; 35using OpenSim.Services.Interfaces;
34 36
@@ -39,6 +41,55 @@ namespace OpenSim.Framework.Serialization.External
39 /// </summary> 41 /// </summary>
40 public class ExternalRepresentationUtils 42 public class ExternalRepresentationUtils
41 { 43 {
44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
45
46 /// <summary>
47 /// Populate a node with data read from xml using a dictinoary of processors
48 /// </summary>
49 /// <param name="nodeToFill"></param>
50 /// <param name="processors">
51 /// A <see cref="Dictionary<System.String, Action<NodeType, XmlTextReader>>"/>
52 /// </param>
53 /// <param name="xtr">
54 /// A <see cref="XmlTextReader"/>
55 /// </param>
56 public static void ExecuteReadProcessors<NodeType>(
57 NodeType nodeToFill, Dictionary<string, Action<NodeType, XmlTextReader>> processors, XmlTextReader xtr)
58 {
59 string nodeName = string.Empty;
60 while (xtr.NodeType != XmlNodeType.EndElement)
61 {
62 nodeName = xtr.Name;
63
64// m_log.DebugFormat("[ExternalRepresentationUtils]: Processing: {0}", nodeName);
65
66 Action<NodeType, XmlTextReader> p = null;
67 if (processors.TryGetValue(xtr.Name, out p))
68 {
69// m_log.DebugFormat("[ExternalRepresentationUtils]: Found {0} processor, nodeName);
70
71 try
72 {
73 p(nodeToFill, xtr);
74 }
75 catch (Exception e)
76 {
77 m_log.ErrorFormat(
78 "[ExternalRepresentationUtils]: Exception while parsing element {0}, continuing. Exception {1}{2}",
79 nodeName, e.Message, e.StackTrace);
80
81 if (xtr.NodeType == XmlNodeType.EndElement)
82 xtr.Read();
83 }
84 }
85 else
86 {
87 // m_log.DebugFormat("[LandDataSerializer]: caught unknown element {0}", nodeName);
88 xtr.ReadOuterXml(); // ignore
89 }
90 }
91 }
92
42 /// <summary> 93 /// <summary>
43 /// Takes a XML representation of a SceneObjectPart and returns another XML representation 94 /// Takes a XML representation of a SceneObjectPart and returns another XML representation
44 /// with creator data added to it. 95 /// with creator data added to it.
diff --git a/OpenSim/Framework/Serialization/External/LandDataSerializer.cs b/OpenSim/Framework/Serialization/External/LandDataSerializer.cs
index 3ae9a8e..a12877a 100644
--- a/OpenSim/Framework/Serialization/External/LandDataSerializer.cs
+++ b/OpenSim/Framework/Serialization/External/LandDataSerializer.cs
@@ -28,8 +28,10 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.IO; 30using System.IO;
31using System.Reflection;
31using System.Text; 32using System.Text;
32using System.Xml; 33using System.Xml;
34using log4net;
33using OpenMetaverse; 35using OpenMetaverse;
34using OpenSim.Framework; 36using OpenSim.Framework;
35 37
@@ -40,8 +42,119 @@ namespace OpenSim.Framework.Serialization.External
40 /// </summary> 42 /// </summary>
41 public class LandDataSerializer 43 public class LandDataSerializer
42 { 44 {
45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
46
43 protected static UTF8Encoding m_utf8Encoding = new UTF8Encoding(); 47 protected static UTF8Encoding m_utf8Encoding = new UTF8Encoding();
44 48
49 private static Dictionary<string, Action<LandData, XmlTextReader>> m_ldProcessors
50 = new Dictionary<string, Action<LandData, XmlTextReader>>();
51
52 private static Dictionary<string, Action<LandAccessEntry, XmlTextReader>> m_laeProcessors
53 = new Dictionary<string, Action<LandAccessEntry, XmlTextReader>>();
54
55 static LandDataSerializer()
56 {
57 // LandData processors
58 m_ldProcessors.Add(
59 "Area", (ld, xtr) => ld.Area = Convert.ToInt32(xtr.ReadElementString("Area")));
60 m_ldProcessors.Add(
61 "AuctionID", (ld, xtr) => ld.AuctionID = Convert.ToUInt32(xtr.ReadElementString("AuctionID")));
62 m_ldProcessors.Add(
63 "AuthBuyerID", (ld, xtr) => ld.AuthBuyerID = UUID.Parse(xtr.ReadElementString("AuthBuyerID")));
64 m_ldProcessors.Add(
65 "Category", (ld, xtr) => ld.Category = (ParcelCategory)Convert.ToSByte(xtr.ReadElementString("Category")));
66 m_ldProcessors.Add(
67 "ClaimDate", (ld, xtr) => ld.ClaimDate = Convert.ToInt32(xtr.ReadElementString("ClaimDate")));
68 m_ldProcessors.Add(
69 "ClaimPrice", (ld, xtr) => ld.ClaimPrice = Convert.ToInt32(xtr.ReadElementString("ClaimPrice")));
70 m_ldProcessors.Add(
71 "GlobalID", (ld, xtr) => ld.GlobalID = UUID.Parse(xtr.ReadElementString("GlobalID")));
72 m_ldProcessors.Add(
73 "GroupID", (ld, xtr) => ld.GroupID = UUID.Parse(xtr.ReadElementString("GroupID")));
74 m_ldProcessors.Add(
75 "IsGroupOwned", (ld, xtr) => ld.IsGroupOwned = Convert.ToBoolean(xtr.ReadElementString("IsGroupOwned")));
76 m_ldProcessors.Add(
77 "Bitmap", (ld, xtr) => ld.Bitmap = Convert.FromBase64String(xtr.ReadElementString("Bitmap")));
78 m_ldProcessors.Add(
79 "Description", (ld, xtr) => ld.Description = xtr.ReadElementString("Description"));
80 m_ldProcessors.Add(
81 "Flags", (ld, xtr) => ld.Flags = Convert.ToUInt32(xtr.ReadElementString("Flags")));
82 m_ldProcessors.Add(
83 "LandingType", (ld, xtr) => ld.LandingType = Convert.ToByte(xtr.ReadElementString("LandingType")));
84 m_ldProcessors.Add(
85 "Name", (ld, xtr) => ld.Name = xtr.ReadElementString("Name"));
86 m_ldProcessors.Add(
87 "Status", (ld, xtr) => ld.Status = (ParcelStatus)Convert.ToSByte(xtr.ReadElementString("Status")));
88 m_ldProcessors.Add(
89 "LocalID", (ld, xtr) => ld.LocalID = Convert.ToInt32(xtr.ReadElementString("LocalID")));
90 m_ldProcessors.Add(
91 "MediaAutoScale", (ld, xtr) => ld.MediaAutoScale = Convert.ToByte(xtr.ReadElementString("MediaAutoScale")));
92 m_ldProcessors.Add(
93 "MediaID", (ld, xtr) => ld.MediaID = UUID.Parse(xtr.ReadElementString("MediaID")));
94 m_ldProcessors.Add(
95 "MediaURL", (ld, xtr) => ld.MediaURL = xtr.ReadElementString("MediaURL"));
96 m_ldProcessors.Add(
97 "MusicURL", (ld, xtr) => ld.MusicURL = xtr.ReadElementString("MusicURL"));
98
99 m_ldProcessors.Add(
100 "ParcelAccessList", ProcessParcelAccessList);
101
102 m_ldProcessors.Add(
103 "PassHours", (ld, xtr) => ld.PassHours = Convert.ToSingle(xtr.ReadElementString("PassHours")));
104 m_ldProcessors.Add(
105 "PassPrice", (ld, xtr) => ld.PassPrice = Convert.ToInt32(xtr.ReadElementString("PassPrice")));
106 m_ldProcessors.Add(
107 "SalePrice", (ld, xtr) => ld.SalePrice = Convert.ToInt32(xtr.ReadElementString("SalePrice")));
108 m_ldProcessors.Add(
109 "SnapshotID", (ld, xtr) => ld.SnapshotID = UUID.Parse(xtr.ReadElementString("SnapshotID")));
110 m_ldProcessors.Add(
111 "UserLocation", (ld, xtr) => ld.UserLocation = Vector3.Parse(xtr.ReadElementString("UserLocation")));
112 m_ldProcessors.Add(
113 "UserLookAt", (ld, xtr) => ld.UserLookAt = Vector3.Parse(xtr.ReadElementString("UserLookAt")));
114
115 // No longer used here //
116 // m_ldProcessors.Add("Dwell", (landData, xtr) => return);
117
118 m_ldProcessors.Add(
119 "OtherCleanTime", (ld, xtr) => ld.OtherCleanTime = Convert.ToInt32(xtr.ReadElementString("OtherCleanTime")));
120
121 // LandAccessEntryProcessors
122 m_laeProcessors.Add(
123 "AgentID", (lae, xtr) => lae.AgentID = UUID.Parse(xtr.ReadElementString("AgentID")));
124 m_laeProcessors.Add(
125 "Time", (lae, xtr) =>
126 {
127 // We really don't care about temp vs perm here and this
128 // would break on old oars. Assume all bans are perm
129 xtr.ReadElementString("Time");
130 lae.Expires = 0; // Convert.ToUint( xtr.ReadElementString("Time"));
131 }
132 );
133 m_laeProcessors.Add(
134 "AccessList", (lae, xtr) => lae.Flags = (AccessList)Convert.ToUInt32(xtr.ReadElementString("AccessList")));
135 }
136
137 public static void ProcessParcelAccessList(LandData ld, XmlTextReader xtr)
138 {
139 if (!xtr.IsEmptyElement)
140 {
141 while (xtr.Read() && xtr.NodeType != XmlNodeType.EndElement)
142 {
143 LandAccessEntry lae = new LandAccessEntry();
144
145 xtr.ReadStartElement("ParcelAccessEntry");
146
147 ExternalRepresentationUtils.ExecuteReadProcessors<LandAccessEntry>(lae, m_laeProcessors, xtr);
148
149 xtr.ReadEndElement();
150
151 ld.ParcelAccessList.Add(lae);
152 }
153 }
154
155 xtr.Read();
156 }
157
45 /// <summary> 158 /// <summary>
46 /// Reify/deserialize landData 159 /// Reify/deserialize landData
47 /// </summary> 160 /// </summary>
@@ -63,72 +176,14 @@ namespace OpenSim.Framework.Serialization.External
63 { 176 {
64 LandData landData = new LandData(); 177 LandData landData = new LandData();
65 178
66 StringReader sr = new StringReader(serializedLandData); 179 using (XmlTextReader reader = new XmlTextReader(new StringReader(serializedLandData)))
67 XmlTextReader xtr = new XmlTextReader(sr);
68
69 xtr.ReadStartElement("LandData");
70
71 landData.Area = Convert.ToInt32( xtr.ReadElementString("Area"));
72 landData.AuctionID = Convert.ToUInt32( xtr.ReadElementString("AuctionID"));
73 landData.AuthBuyerID = UUID.Parse( xtr.ReadElementString("AuthBuyerID"));
74 landData.Category = (ParcelCategory)Convert.ToSByte( xtr.ReadElementString("Category"));
75 landData.ClaimDate = Convert.ToInt32( xtr.ReadElementString("ClaimDate"));
76 landData.ClaimPrice = Convert.ToInt32( xtr.ReadElementString("ClaimPrice"));
77 landData.GlobalID = UUID.Parse( xtr.ReadElementString("GlobalID"));
78 landData.GroupID = UUID.Parse( xtr.ReadElementString("GroupID"));
79 landData.IsGroupOwned = Convert.ToBoolean( xtr.ReadElementString("IsGroupOwned"));
80 landData.Bitmap = Convert.FromBase64String( xtr.ReadElementString("Bitmap"));
81 landData.Description = xtr.ReadElementString("Description");
82 landData.Flags = Convert.ToUInt32( xtr.ReadElementString("Flags"));
83 landData.LandingType = Convert.ToByte( xtr.ReadElementString("LandingType"));
84 landData.Name = xtr.ReadElementString("Name");
85 landData.Status = (ParcelStatus)Convert.ToSByte( xtr.ReadElementString("Status"));
86 landData.LocalID = Convert.ToInt32( xtr.ReadElementString("LocalID"));
87 landData.MediaAutoScale = Convert.ToByte( xtr.ReadElementString("MediaAutoScale"));
88 landData.MediaID = UUID.Parse( xtr.ReadElementString("MediaID"));
89 landData.MediaURL = xtr.ReadElementString("MediaURL");
90 landData.MusicURL = xtr.ReadElementString("MusicURL");
91 landData.OwnerID = UUID.Parse( xtr.ReadElementString("OwnerID"));
92
93 landData.ParcelAccessList = new List<LandAccessEntry>();
94 xtr.Read();
95 if (xtr.Name != "ParcelAccessList")
96 throw new XmlException(String.Format("Expected \"ParcelAccessList\" element but got \"{0}\"", xtr.Name));
97
98 if (!xtr.IsEmptyElement)
99 { 180 {
100 while (xtr.Read() && xtr.NodeType != XmlNodeType.EndElement) 181 reader.ReadStartElement("LandData");
101 {
102 LandAccessEntry pae = new LandAccessEntry();
103 182
104 xtr.ReadStartElement("ParcelAccessEntry"); 183 ExternalRepresentationUtils.ExecuteReadProcessors<LandData>(landData, m_ldProcessors, reader);
105 pae.AgentID = UUID.Parse( xtr.ReadElementString("AgentID"));
106 // We really don't care about temp vs perm here and this
107 // would break on old oars. Assume all bans are perm
108 xtr.ReadElementString("Time");
109 pae.Expires = 0; // Convert.ToUint( xtr.ReadElementString("Time"));
110 pae.Flags = (AccessList)Convert.ToUInt32( xtr.ReadElementString("AccessList"));
111 xtr.ReadEndElement();
112 184
113 landData.ParcelAccessList.Add(pae); 185 reader.ReadEndElement();
114 }
115 } 186 }
116 xtr.Read();
117
118 landData.PassHours = Convert.ToSingle( xtr.ReadElementString("PassHours"));
119 landData.PassPrice = Convert.ToInt32( xtr.ReadElementString("PassPrice"));
120 landData.SalePrice = Convert.ToInt32( xtr.ReadElementString("SalePrice"));
121 landData.SnapshotID = UUID.Parse( xtr.ReadElementString("SnapshotID"));
122 landData.UserLocation = Vector3.Parse( xtr.ReadElementString("UserLocation"));
123 landData.UserLookAt = Vector3.Parse( xtr.ReadElementString("UserLookAt"));
124 // No longer used here
125 xtr.ReadElementString("Dwell");
126 landData.OtherCleanTime = Convert.ToInt32( xtr.ReadElementString("OtherCleanTime"));
127
128 xtr.ReadEndElement();
129
130 xtr.Close();
131 sr.Close();
132 187
133 return landData; 188 return landData;
134 } 189 }
diff --git a/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs b/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs
index f138437..f6fdc4b 100644
--- a/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs
+++ b/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs
@@ -41,14 +41,13 @@ namespace OpenSim.Framework.Serialization.External
41{ 41{
42 /// <summary> 42 /// <summary>
43 /// Serialize and deserialize user inventory items as an external format. 43 /// Serialize and deserialize user inventory items as an external format.
44 /// </summary> 44 /// </summary>
45 /// XXX: Please do not use yet.
46 public class UserInventoryItemSerializer 45 public class UserInventoryItemSerializer
47 { 46 {
48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
49 48
50 private delegate void InventoryItemXmlProcessor(InventoryItemBase item, XmlTextReader reader); 49 private static Dictionary<string, Action<InventoryItemBase, XmlTextReader>> m_InventoryItemXmlProcessors
51 private static Dictionary<string, InventoryItemXmlProcessor> m_InventoryItemXmlProcessors = new Dictionary<string, InventoryItemXmlProcessor>(); 50 = new Dictionary<string, Action<InventoryItemBase, XmlTextReader>>();
52 51
53 #region InventoryItemBase Processor initialization 52 #region InventoryItemBase Processor initialization
54 static UserInventoryItemSerializer() 53 static UserInventoryItemSerializer()
@@ -205,39 +204,14 @@ namespace OpenSim.Framework.Serialization.External
205 { 204 {
206 reader.ReadStartElement("InventoryItem"); 205 reader.ReadStartElement("InventoryItem");
207 206
208 string nodeName = string.Empty; 207 ExternalRepresentationUtils.ExecuteReadProcessors<InventoryItemBase>(
209 while (reader.NodeType != XmlNodeType.EndElement) 208 item, m_InventoryItemXmlProcessors, reader);
210 {
211 nodeName = reader.Name;
212 InventoryItemXmlProcessor p = null;
213 if (m_InventoryItemXmlProcessors.TryGetValue(reader.Name, out p))
214 {
215 //m_log.DebugFormat("[XXX] Processing: {0}", reader.Name);
216 try
217 {
218 p(item, reader);
219 }
220 catch (Exception e)
221 {
222 m_log.DebugFormat("[InventoryItemSerializer]: exception while parsing {0}: {1}", nodeName, e);
223 if (reader.NodeType == XmlNodeType.EndElement)
224 reader.Read();
225 }
226 }
227 else
228 {
229 // m_log.DebugFormat("[InventoryItemSerializer]: caught unknown element {0}", nodeName);
230 reader.ReadOuterXml(); // ignore
231 }
232
233 }
234 209
235 reader.ReadEndElement(); // InventoryItem 210 reader.ReadEndElement(); // InventoryItem
236 } 211 }
237 212
238 //m_log.DebugFormat("[XXX]: parsed InventoryItemBase {0} - {1}", obj.Name, obj.UUID); 213 //m_log.DebugFormat("[XXX]: parsed InventoryItemBase {0} - {1}", obj.Name, obj.UUID);
239 return item; 214 return item;
240
241 } 215 }
242 216
243 public static string Serialize(InventoryItemBase inventoryItem, Dictionary<string, object> options, IUserAccountService userAccountService) 217 public static string Serialize(InventoryItemBase inventoryItem, Dictionary<string, object> options, IUserAccountService userAccountService)
diff --git a/OpenSim/Framework/Serialization/External/UserProfileSerializer.cs b/OpenSim/Framework/Serialization/External/UserProfileSerializer.cs
index f50b49a..c685a15 100644
--- a/OpenSim/Framework/Serialization/External/UserProfileSerializer.cs
+++ b/OpenSim/Framework/Serialization/External/UserProfileSerializer.cs
@@ -33,8 +33,11 @@ using OpenSim.Framework;
33namespace OpenSim.Framework.Serialization.External 33namespace OpenSim.Framework.Serialization.External
34{ 34{
35 /// <summary> 35 /// <summary>
36 /// Serialize and deserialize region settings as an external format. 36 /// Serialize and deserialize user profiles as an external format.
37 /// </summary> 37 /// </summary>
38 /// <remarks>
39 /// Currently UNUSED.
40 /// </remarks>
38 public class UserProfileSerializer 41 public class UserProfileSerializer
39 { 42 {
40 public const int MAJOR_VERSION = 0; 43 public const int MAJOR_VERSION = 0;
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
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using OpenSim.Framework;
31using OpenSim.Framework.Serialization.External;
32using OpenMetaverse; 30using OpenMetaverse;
33using OpenMetaverse.StructuredData; 31using OpenMetaverse.StructuredData;
34using NUnit.Framework; 32using NUnit.Framework;
33using OpenSim.Framework;
34using OpenSim.Framework.Serialization.External;
35using OpenSim.Tests.Common;
35 36
36namespace OpenSim.Framework.Serialization.Tests 37namespace 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}
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
index 150d913..09b4ba6 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
@@ -122,7 +122,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
122 122
123 scene.AddCommand( 123 scene.AddCommand(
124 this, "save iar", 124 this, "save iar",
125 "save iar [-h|--home=<url>] [--noassets] <first> <last> <inventory path> <password> [<IAR path>] [--v|-verbose]", 125 "save iar [-p|--profile=<url>] [--noassets] <first> <last> <inventory path> <password> [<IAR path>] [-c|--creators] [-v|--verbose]",
126 "Save user inventory archive (IAR).", 126 "Save user inventory archive (IAR).",
127 "<first> is the user's first name." + Environment.NewLine 127 "<first> is the user's first name." + Environment.NewLine
128 + "<last> is the user's last name." + Environment.NewLine 128 + "<last> is the user's last name." + Environment.NewLine
@@ -408,7 +408,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
408 if (mainParams.Count < 6) 408 if (mainParams.Count < 6)
409 { 409 {
410 m_log.Error( 410 m_log.Error(
411 "[INVENTORY ARCHIVER]: usage is save iar [--p|-profile=<url>] [--noassets] <first name> <last name> <inventory path> <user password> [<save file path>]"); 411 "[INVENTORY ARCHIVER]: usage is save iar [-p|--profile=<url>] [--noassets] <first name> <last name> <inventory path> <user password> [<save file path>] [-c|--creators] [-v|--verbose]");
412 return; 412 return;
413 } 413 }
414 414
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
index 3831d7a..6a48b89 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
@@ -140,24 +140,26 @@ namespace OpenSim.Region.OptionalModules.World.NPC
140// acd.AgentID, i, acd.Appearance.Texture.FaceTextures[i]); 140// acd.AgentID, i, acd.Appearance.Texture.FaceTextures[i]);
141// } 141// }
142 142
143 scene.AuthenticateHandler.AddNewCircuit(npcAvatar.CircuitCode, acd); 143 lock (m_avatars)
144 scene.AddNewClient(npcAvatar, PresenceType.Npc);
145
146 ScenePresence sp;
147 if (scene.TryGetScenePresence(npcAvatar.AgentId, out sp))
148 { 144 {
149 m_log.DebugFormat( 145 scene.AuthenticateHandler.AddNewCircuit(npcAvatar.CircuitCode, acd);
150 "[NPC MODULE]: Successfully retrieved scene presence for NPC {0} {1}", sp.Name, sp.UUID); 146 scene.AddNewClient(npcAvatar, PresenceType.Npc);
151 147
152 sp.CompleteMovement(npcAvatar, false); 148 ScenePresence sp;
153 } 149 if (scene.TryGetScenePresence(npcAvatar.AgentId, out sp))
154 else 150 {
155 { 151 m_log.DebugFormat(
156 m_log.WarnFormat("[NPC MODULE]: Could not find scene presence for NPC {0} {1}", sp.Name, sp.UUID); 152 "[NPC MODULE]: Successfully retrieved scene presence for NPC {0} {1}", sp.Name, sp.UUID);
157 } 153
154 sp.CompleteMovement(npcAvatar, false);
155 }
156 else
157 {
158 m_log.WarnFormat("[NPC MODULE]: Could not find scene presence for NPC {0} {1}", sp.Name, sp.UUID);
159 }
158 160
159 lock (m_avatars)
160 m_avatars.Add(npcAvatar.AgentId, npcAvatar); 161 m_avatars.Add(npcAvatar.AgentId, npcAvatar);
162 }
161 163
162 m_log.DebugFormat("[NPC MODULE]: Created NPC with id {0}", npcAvatar.AgentId); 164 m_log.DebugFormat("[NPC MODULE]: Created NPC with id {0}", npcAvatar.AgentId);
163 165
diff --git a/bin/OpenSim.Framework.Serialization.Tests.dll.config b/bin/OpenSim.Framework.Serialization.Tests.dll.config
new file mode 100644
index 0000000..a3f681d
--- /dev/null
+++ b/bin/OpenSim.Framework.Serialization.Tests.dll.config
@@ -0,0 +1,33 @@
1<?xml version="1.0" encoding="utf-8" ?>
2<configuration>
3 <configSections>
4 <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
5 </configSections>
6 <runtime>
7 <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
8 <dependentAssembly>
9 <assemblyIdentity name="nunit.framework" publicKeyToken="96d09a1eb7f44a77" culture="Neutral" />
10 <bindingRedirect oldVersion="2.0.6.0" newVersion="2.4.6.0" />
11 <bindingRedirect oldVersion="2.1.4.0" newVersion="2.4.6.0" />
12 <bindingRedirect oldVersion="2.2.8.0" newVersion="2.4.6.0" />
13 </dependentAssembly>
14 </assemblyBinding>
15 </runtime>
16 <log4net>
17 <!-- A1 is set to be a ConsoleAppender -->
18 <appender name="A1" type="log4net.Appender.ConsoleAppender">
19
20 <!-- A1 uses PatternLayout -->
21 <layout type="log4net.Layout.PatternLayout">
22 <!-- Print the date in ISO 8601 format -->
23 <conversionPattern value="%date [%thread] %-5level %logger %ndc - %message%newline" />
24 </layout>
25 </appender>
26
27 <!-- Set root logger level to DEBUG and its only appender to A1 -->
28 <root>
29 <level value="DEBUG" />
30 <appender-ref ref="A1" />
31 </root>
32 </log4net>
33</configuration>
diff --git a/prebuild.xml b/prebuild.xml
index 65383ee..c402cf5 100644
--- a/prebuild.xml
+++ b/prebuild.xml
@@ -218,6 +218,7 @@
218 218
219 <ReferencePath>../../../bin/</ReferencePath> 219 <ReferencePath>../../../bin/</ReferencePath>
220 <Reference name="System"/> 220 <Reference name="System"/>
221 <Reference name="System.Core"/>
221 <Reference name="System.Xml"/> 222 <Reference name="System.Xml"/>
222 <Reference name="log4net" path="../../../bin/"/> 223 <Reference name="log4net" path="../../../bin/"/>
223 <Reference name="OpenMetaverse" path="../../../bin/"/> 224 <Reference name="OpenMetaverse" path="../../../bin/"/>