aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/Tests/BasicUserTest.cs12
-rw-r--r--OpenSim/Data/Tests/PropertyCompareConstraint.cs298
-rw-r--r--OpenSim/Data/Tests/ScrambleForTesting.cs102
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs55
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs172
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs72
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs115
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs6
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs6
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/ScriptBase.cs15
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs9
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineTest.cs3
-rw-r--r--OpenSim/Services/Interfaces/IAssetService.cs46
-rw-r--r--OpenSim/Tests/Common/Mock/TestAssetService.cs14
15 files changed, 823 insertions, 103 deletions
diff --git a/OpenSim/Data/Tests/BasicUserTest.cs b/OpenSim/Data/Tests/BasicUserTest.cs
index d3e6f41..4e4ddc8 100644
--- a/OpenSim/Data/Tests/BasicUserTest.cs
+++ b/OpenSim/Data/Tests/BasicUserTest.cs
@@ -204,8 +204,16 @@ namespace OpenSim.Data.Tests
204 UUID webloginkey = UUID.Random(); 204 UUID webloginkey = UUID.Random();
205 uint homeregx = (uint) random.Next(); 205 uint homeregx = (uint) random.Next();
206 uint homeregy = (uint) random.Next(); 206 uint homeregy = (uint) random.Next();
207 Vector3 homeloc = new Vector3((float)Math.Round(random.NextDouble(),5),(float)Math.Round(random.NextDouble(),5),(float)Math.Round(random.NextDouble(),5)); 207 Vector3 homeloc
208 Vector3 homelookat = new Vector3((float)Math.Round(random.NextDouble(),5),(float)Math.Round(random.NextDouble(),5),(float)Math.Round(random.NextDouble(),5)); 208 = new Vector3(
209 (float)Math.Round(random.NextDouble(), 5),
210 (float)Math.Round(random.NextDouble(), 5),
211 (float)Math.Round(random.NextDouble(), 5));
212 Vector3 homelookat
213 = new Vector3(
214 (float)Math.Round(random.NextDouble(), 5),
215 (float)Math.Round(random.NextDouble(), 5),
216 (float)Math.Round(random.NextDouble(), 5));
209 int created = random.Next(); 217 int created = random.Next();
210 int lastlogin = random.Next(); 218 int lastlogin = random.Next();
211 string userinvuri = RandomName(); 219 string userinvuri = RandomName();
diff --git a/OpenSim/Data/Tests/PropertyCompareConstraint.cs b/OpenSim/Data/Tests/PropertyCompareConstraint.cs
new file mode 100644
index 0000000..678501e
--- /dev/null
+++ b/OpenSim/Data/Tests/PropertyCompareConstraint.cs
@@ -0,0 +1,298 @@
1using System;
2using System.Collections;
3using System.Collections.Generic;
4using System.Drawing;
5using System.Linq;
6using System.Linq.Expressions;
7using System.Reflection;
8using NUnit.Framework;
9using NUnit.Framework.Constraints;
10using NUnit.Framework.SyntaxHelpers;
11using OpenMetaverse;
12using OpenSim.Framework;
13
14namespace OpenSim.Data.Tests
15{
16 public static class Constraints
17 {
18 //This is here because C# has a gap in the language, you can't infer type from a constructor
19 public static PropertyCompareConstraint<T> PropertyCompareConstraint<T>(T expected)
20 {
21 return new PropertyCompareConstraint<T>(expected);
22 }
23 }
24
25 public class PropertyCompareConstraint<T> : NUnit.Framework.Constraints.Constraint
26 {
27 private readonly object _expected;
28 //the reason everywhere uses propertyNames.Reverse().ToArray() is because the stack is backwards of the order we want to display the properties in.
29 private string failingPropertyName = string.Empty;
30 private object failingExpected;
31 private object failingActual;
32
33 public PropertyCompareConstraint(T expected)
34 {
35 _expected = expected;
36 }
37
38 public override bool Matches(object actual)
39 {
40 return ObjectCompare(_expected, actual, new Stack<string>());
41 }
42
43 private bool ObjectCompare(object expected, object actual, Stack<string> propertyNames)
44 {
45 if (actual.GetType() != expected.GetType())
46 {
47 propertyNames.Push("GetType()");
48 failingPropertyName = string.Join(".", propertyNames.Reverse().ToArray());
49 propertyNames.Pop();
50 failingActual = actual.GetType();
51 failingExpected = expected.GetType();
52 return false;
53 }
54
55 if(actual.GetType() == typeof(Color))
56 {
57 Color actualColor = (Color) actual;
58 Color expectedColor = (Color) expected;
59 if (actualColor.R != expectedColor.R)
60 {
61 propertyNames.Push("R");
62 failingPropertyName = string.Join(".", propertyNames.Reverse().ToArray());
63 propertyNames.Pop();
64 failingActual = actualColor.R;
65 failingExpected = expectedColor.R;
66 return false;
67 }
68 if (actualColor.G != expectedColor.G)
69 {
70 propertyNames.Push("G");
71 failingPropertyName = string.Join(".", propertyNames.Reverse().ToArray());
72 propertyNames.Pop();
73 failingActual = actualColor.G;
74 failingExpected = expectedColor.G;
75 return false;
76 }
77 if (actualColor.B != expectedColor.B)
78 {
79 propertyNames.Push("B");
80 failingPropertyName = string.Join(".", propertyNames.Reverse().ToArray());
81 propertyNames.Pop();
82 failingActual = actualColor.B;
83 failingExpected = expectedColor.B;
84 return false;
85 }
86 if (actualColor.A != expectedColor.A)
87 {
88 propertyNames.Push("A");
89 failingPropertyName = string.Join(".", propertyNames.Reverse().ToArray());
90 propertyNames.Pop();
91 failingActual = actualColor.A;
92 failingExpected = expectedColor.A;
93 return false;
94 }
95 return true;
96 }
97
98 //Skip static properties. I had a nasty problem comparing colors because of all of the public static colors.
99 PropertyInfo[] properties = expected.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance);
100 foreach (var property in properties)
101 {
102 if (ignores.Contains(property.Name))
103 continue;
104
105 object actualValue = property.GetValue(actual, null);
106 object expectedValue = property.GetValue(expected, null);
107
108 //If they are both null, they are equal
109 if (actualValue == null && expectedValue == null)
110 continue;
111
112 //If only one is null, then they aren't
113 if (actualValue == null || expectedValue == null)
114 {
115 propertyNames.Push(property.Name);
116 failingPropertyName = string.Join(".", propertyNames.Reverse().ToArray());
117 propertyNames.Pop();
118 failingActual = actualValue;
119 failingExpected = expectedValue;
120 return false;
121 }
122
123 IComparable comp = actualValue as IComparable;
124 if (comp != null)
125 {
126 if (comp.CompareTo(expectedValue) != 0)
127 {
128 propertyNames.Push(property.Name);
129 failingPropertyName = string.Join(".", propertyNames.Reverse().ToArray());
130 propertyNames.Pop();
131 failingActual = actualValue;
132 failingExpected = expectedValue;
133 return false;
134 }
135 continue;
136 }
137
138 IEnumerable arr = actualValue as IEnumerable;
139 if (arr != null)
140 {
141 List<object> actualList = arr.Cast<object>().ToList();
142 List<object> expectedList = ((IEnumerable)expectedValue).Cast<object>().ToList();
143 if (actualList.Count != expectedList.Count)
144 {
145 propertyNames.Push(property.Name);
146 propertyNames.Push("Count");
147 failingPropertyName = string.Join(".", propertyNames.Reverse().ToArray());
148 failingActual = actualList.Count;
149 failingExpected = expectedList.Count;
150 propertyNames.Pop();
151 propertyNames.Pop();
152 }
153 //Todo: A value-wise comparison of all of the values.
154 //Everything seems okay...
155 continue;
156 }
157
158 propertyNames.Push(property.Name);
159 if (!ObjectCompare(expectedValue, actualValue, propertyNames))
160 return false;
161 propertyNames.Pop();
162 }
163
164 return true;
165 }
166
167 public override void WriteDescriptionTo(MessageWriter writer)
168 {
169 writer.WriteExpectedValue(failingExpected);
170 }
171
172 public override void WriteActualValueTo(MessageWriter writer)
173 {
174 writer.WriteActualValue(failingActual);
175 writer.WriteLine();
176 writer.Write(" On Property: " + failingPropertyName);
177 }
178
179 //These notes assume the lambda: (x=>x.Parent.Value)
180 //ignores should really contain like a fully dotted version of the property name, but I'm starting with small steps
181 readonly List<string> ignores = new List<string>();
182 public PropertyCompareConstraint<T> IgnoreProperty(Expression<Func<T, object>> func)
183 {
184 Expression express = func.Body;
185 PullApartExpression(express);
186
187 return this;
188 }
189
190 private void PullApartExpression(Expression express)
191 {
192 //This deals with any casts... like implicit casts to object. Not all UnaryExpression are casts, but this is a first attempt.
193 if (express is UnaryExpression)
194 PullApartExpression(((UnaryExpression)express).Operand);
195 if (express is MemberExpression)
196 {
197 //If the inside of the lambda is the access to x, we've hit the end of the chain.
198 // We should track by the fully scoped parameter name, but this is the first rev of doing this.
199 if (((MemberExpression)express).Expression is ParameterExpression)
200 {
201 ignores.Add(((MemberExpression)express).Member.Name);
202 }
203 else
204 {
205 //Otherwise there could be more parameters inside...
206 PullApartExpression(((MemberExpression)express).Expression);
207 }
208 }
209 }
210 }
211
212 [TestFixture]
213 public class PropertyCompareConstraintTest
214 {
215 public class HasInt
216 {
217 public int TheValue { get; set; }
218 }
219
220 [Test]
221 public void IntShouldMatch()
222 {
223 HasInt actual = new HasInt { TheValue = 5 };
224 HasInt expected = new HasInt { TheValue = 5 };
225 var constraint = Constraints.PropertyCompareConstraint(expected);
226
227 Assert.That(constraint.Matches(actual), Is.True);
228 }
229
230 [Test]
231 public void IntShouldNotMatch()
232 {
233 HasInt actual = new HasInt { TheValue = 5 };
234 HasInt expected = new HasInt { TheValue = 4 };
235 var constraint = Constraints.PropertyCompareConstraint(expected);
236
237 Assert.That(constraint.Matches(actual), Is.False);
238 }
239
240
241 [Test]
242 public void IntShouldIgnore()
243 {
244 HasInt actual = new HasInt { TheValue = 5 };
245 HasInt expected = new HasInt { TheValue = 4 };
246 var constraint = Constraints.PropertyCompareConstraint(expected).IgnoreProperty(x=>x.TheValue);
247
248 Assert.That(constraint.Matches(actual), Is.True);
249 }
250
251 [Test]
252 public void AssetShouldMatch()
253 {
254 UUID uuid1 = UUID.Random();
255 AssetBase actual = new AssetBase(uuid1, "asset one");
256 AssetBase expected = new AssetBase(uuid1, "asset one");
257
258 var constraint = Constraints.PropertyCompareConstraint(expected);
259
260 Assert.That(constraint.Matches(actual), Is.True);
261 }
262
263 [Test]
264 public void AssetShouldNotMatch()
265 {
266 UUID uuid1 = UUID.Random();
267 AssetBase actual = new AssetBase(uuid1, "asset one");
268 AssetBase expected = new AssetBase(UUID.Random(), "asset one");
269
270 var constraint = Constraints.PropertyCompareConstraint(expected);
271
272 Assert.That(constraint.Matches(actual), Is.False);
273 }
274
275 [Test]
276 public void AssetShouldNotMatch2()
277 {
278 UUID uuid1 = UUID.Random();
279 AssetBase actual = new AssetBase(uuid1, "asset one");
280 AssetBase expected = new AssetBase(uuid1, "asset two");
281
282 var constraint = Constraints.PropertyCompareConstraint(expected);
283
284 Assert.That(constraint.Matches(actual), Is.False);
285 }
286
287 [Test]
288 public void TestColors()
289 {
290 Color actual = Color.Red;
291 Color expected = Color.FromArgb(actual.A, actual.R, actual.G, actual.B);
292
293 var constraint = Constraints.PropertyCompareConstraint(expected);
294
295 Assert.That(constraint.Matches(actual), Is.True);
296 }
297 }
298} \ No newline at end of file
diff --git a/OpenSim/Data/Tests/ScrambleForTesting.cs b/OpenSim/Data/Tests/ScrambleForTesting.cs
new file mode 100644
index 0000000..c6e467f
--- /dev/null
+++ b/OpenSim/Data/Tests/ScrambleForTesting.cs
@@ -0,0 +1,102 @@
1using System;
2using System.Collections;
3using System.Reflection;
4using System.Text;
5using NUnit.Framework;
6using OpenMetaverse;
7using OpenSim.Framework;
8
9namespace OpenSim.Data.Tests
10{
11 public static class ScrambleForTesting
12 {
13 private static readonly Random random = new Random();
14 public static void Scramble(object obj)
15 {
16 PropertyInfo[] properties = obj.GetType().GetProperties();
17 foreach (var property in properties)
18 {
19 //Skip indexers of classes. We will assume that everything that has an indexer
20 // is also IEnumberable. May not always be true, but should be true normally.
21 if(property.GetIndexParameters().Length > 0)
22 continue;
23
24 RandomizeProperty(obj, property, null);
25 }
26 //Now if it implments IEnumberable, it's probably some kind of list, so we should randomize
27 // everything inside of it.
28 IEnumerable enumerable = obj as IEnumerable;
29 if(enumerable != null)
30 {
31 foreach (object value in enumerable)
32 {
33 Scramble(value);
34 }
35 }
36 }
37
38 private static void RandomizeProperty(object obj, PropertyInfo property, object[] index)
39 {
40 Type t = property.PropertyType;
41 if (!property.CanWrite)
42 return;
43 object value = property.GetValue(obj, index);
44 if (value == null)
45 return;
46
47 if (t == typeof (string))
48 property.SetValue(obj, RandomName(), index);
49 else if (t == typeof (UUID))
50 property.SetValue(obj, UUID.Random(), index);
51 else if (t == typeof (sbyte))
52 property.SetValue(obj, (sbyte)random.Next(sbyte.MinValue, sbyte.MaxValue), index);
53 else if (t == typeof (short))
54 property.SetValue(obj, (short)random.Next(short.MinValue, short.MaxValue), index);
55 else if (t == typeof (int))
56 property.SetValue(obj, random.Next(), index);
57 else if (t == typeof (long))
58 property.SetValue(obj, random.Next() * int.MaxValue, index);
59 else if (t == typeof (byte))
60 property.SetValue(obj, (byte)random.Next(byte.MinValue, byte.MaxValue), index);
61 else if (t == typeof (ushort))
62 property.SetValue(obj, (ushort)random.Next(ushort.MinValue, ushort.MaxValue), index);
63 else if (t == typeof (uint))
64 property.SetValue(obj, Convert.ToUInt32(random.Next()), index);
65 else if (t == typeof (ulong))
66 property.SetValue(obj, Convert.ToUInt64(random.Next()) * Convert.ToUInt64(UInt32.MaxValue), index);
67 else if (t == typeof (bool))
68 property.SetValue(obj, true, index);
69 else if (t == typeof (byte[]))
70 {
71 byte[] bytes = new byte[30];
72 random.NextBytes(bytes);
73 property.SetValue(obj, bytes, index);
74 }
75 else
76 Scramble(value);
77 }
78
79 private static string RandomName()
80 {
81 StringBuilder name = new StringBuilder();
82 int size = random.Next(5, 12);
83 for (int i = 0; i < size; i++)
84 {
85 char ch = Convert.ToChar(Convert.ToInt32(Math.Floor(26 * random.NextDouble() + 65)));
86 name.Append(ch);
87 }
88 return name.ToString();
89 }
90 }
91
92 [TestFixture]
93 public class ScrableForTestingTest
94 {
95 [Test]
96 public void TestScramble()
97 {
98 AssetBase actual = new AssetBase(UUID.Random(), "asset one");
99 ScrambleForTesting.Scramble(actual);
100 }
101 }
102} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
index 28b4d64..470a386 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
@@ -74,7 +74,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
74 /// <summary> 74 /// <summary>
75 /// Test saving a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet). 75 /// Test saving a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet).
76 /// </summary> 76 /// </summary>
77 //[Test] 77 [Test]
78 public void TestSaveIarV0_1() 78 public void TestSaveIarV0_1()
79 { 79 {
80 TestHelper.InMethod(); 80 TestHelper.InMethod();
@@ -82,7 +82,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
82 82
83 InventoryArchiverModule archiverModule = new InventoryArchiverModule(); 83 InventoryArchiverModule archiverModule = new InventoryArchiverModule();
84 84
85 Scene scene = SceneSetupHelpers.SetupScene(""); 85 Scene scene = SceneSetupHelpers.SetupScene("Inventory");
86 SceneSetupHelpers.SetupSceneModules(scene, archiverModule); 86 SceneSetupHelpers.SetupSceneModules(scene, archiverModule);
87 CommunicationsManager cm = scene.CommsManager; 87 CommunicationsManager cm = scene.CommsManager;
88 88
@@ -222,7 +222,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
222 /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where 222 /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where
223 /// an account exists with the creator name. 223 /// an account exists with the creator name.
224 /// </summary> 224 /// </summary>
225 //[Test] 225 [Test]
226 public void TestLoadIarV0_1ExistingUsers() 226 public void TestLoadIarV0_1ExistingUsers()
227 { 227 {
228 TestHelper.InMethod(); 228 TestHelper.InMethod();
@@ -262,7 +262,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
262 InventoryArchiverModule archiverModule = new InventoryArchiverModule(); 262 InventoryArchiverModule archiverModule = new InventoryArchiverModule();
263 263
264 // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene 264 // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene
265 Scene scene = SceneSetupHelpers.SetupScene(); 265 Scene scene = SceneSetupHelpers.SetupScene("inventory");
266 IUserAdminService userAdminService = scene.CommsManager.UserAdminService; 266 IUserAdminService userAdminService = scene.CommsManager.UserAdminService;
267 267
268 SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); 268 SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
@@ -276,16 +276,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
276 276
277 CachedUserInfo userInfo 277 CachedUserInfo userInfo
278 = scene.CommsManager.UserProfileCacheService.GetUserDetails(userFirstName, userLastName); 278 = scene.CommsManager.UserProfileCacheService.GetUserDetails(userFirstName, userLastName);
279 //userInfo.FetchInventory(); 279
280 /*
281 for (int i = 0 ; i < 50 ; i++)
282 {
283 if (userInfo.HasReceivedInventory == true)
284 break;
285 Thread.Sleep(200);
286 }
287 Assert.That(userInfo.HasReceivedInventory, Is.True, "FetchInventory timed out (10 seconds)");
288 */
289 InventoryItemBase foundItem = userInfo.RootFolder.FindItemByPath(itemName); 280 InventoryItemBase foundItem = userInfo.RootFolder.FindItemByPath(itemName);
290 Assert.That(foundItem, Is.Not.Null, "Didn't find loaded item"); 281 Assert.That(foundItem, Is.Not.Null, "Didn't find loaded item");
291 Assert.That( 282 Assert.That(
@@ -395,17 +386,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
395 userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager, InventoryReceived); 386 userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager, InventoryReceived);
396 Monitor.Wait(this, 60000); 387 Monitor.Wait(this, 60000);
397 } 388 }
398
399 //userInfo.FetchInventory();
400 /*
401 for (int i = 0 ; i < 50 ; i++)
402 {
403 if (userInfo.HasReceivedInventory == true)
404 break;
405 Thread.Sleep(200);
406 }
407 Assert.That(userInfo.HasReceivedInventory, Is.True, "FetchInventory timed out (10 seconds)");
408 */
409 389
410 Console.WriteLine("userInfo.RootFolder 1: {0}", userInfo.RootFolder); 390 Console.WriteLine("userInfo.RootFolder 1: {0}", userInfo.RootFolder);
411 391
@@ -429,22 +409,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
429 409
430 Console.WriteLine("userInfo.RootFolder 2: {0}", userInfo.RootFolder); 410 Console.WriteLine("userInfo.RootFolder 2: {0}", userInfo.RootFolder);
431 411
432 try 412 new InventoryArchiveReadRequest(userInfo, null, (Stream)null, null, null)
433 { 413 .ReplicateArchivePathToUserInventory(
434 new InventoryArchiveReadRequest(userInfo, null, (Stream)null, null, null) 414 itemArchivePath, false, userInfo.RootFolder, foldersCreated, nodesLoaded);
435 .ReplicateArchivePathToUserInventory(itemArchivePath, false, userInfo.RootFolder, foldersCreated, nodesLoaded); 415
436 416 Console.WriteLine("userInfo.RootFolder 3: {0}", userInfo.RootFolder);
437 Console.WriteLine("userInfo.RootFolder 3: {0}", userInfo.RootFolder); 417 InventoryFolderImpl folder1 = userInfo.RootFolder.FindFolderByPath("a");
438 InventoryFolderImpl folder1 = userInfo.RootFolder.FindFolderByPath("a"); 418 Assert.That(folder1, Is.Not.Null, "Could not find folder a");
439 Assert.That(folder1, Is.Not.Null, "Could not find folder a"); 419 InventoryFolderImpl folder2 = folder1.FindFolderByPath("b");
440 InventoryFolderImpl folder2 = folder1.FindFolderByPath("b"); 420 Assert.That(folder2, Is.Not.Null, "Could not find folder b");
441 Assert.That(folder2, Is.Not.Null, "Could not find folder b");
442 }
443 catch (NullReferenceException e)
444 {
445 // Non fatal for now until we resolve the race condition
446 Console.WriteLine("Test failed with {0}", e);
447 }
448 } 421 }
449 } 422 }
450} 423}
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 919075c..18d7bad 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1038,6 +1038,10 @@ namespace OpenSim.Region.Framework.Scenes
1038 } 1038 }
1039 } 1039 }
1040 1040
1041 /// <summary>
1042 /// Send out simstats data to all clients
1043 /// </summary>
1044 /// <param name="stats">Stats on the Simulator's performance</param>
1041 private void SendSimStatsPackets(SimStats stats) 1045 private void SendSimStatsPackets(SimStats stats)
1042 { 1046 {
1043 List<ScenePresence> StatSendAgents = GetScenePresences(); 1047 List<ScenePresence> StatSendAgents = GetScenePresences();
@@ -1050,6 +1054,9 @@ namespace OpenSim.Region.Framework.Scenes
1050 } 1054 }
1051 } 1055 }
1052 1056
1057 /// <summary>
1058 /// Recount SceneObjectPart in parcel aabb
1059 /// </summary>
1053 private void UpdateLand() 1060 private void UpdateLand()
1054 { 1061 {
1055 if (LandChannel != null) 1062 if (LandChannel != null)
@@ -1061,11 +1068,17 @@ namespace OpenSim.Region.Framework.Scenes
1061 } 1068 }
1062 } 1069 }
1063 1070
1071 /// <summary>
1072 /// Update the terrain if it needs to be updated.
1073 /// </summary>
1064 private void UpdateTerrain() 1074 private void UpdateTerrain()
1065 { 1075 {
1066 EventManager.TriggerTerrainTick(); 1076 EventManager.TriggerTerrainTick();
1067 } 1077 }
1068 1078
1079 /// <summary>
1080 /// Back up queued up changes
1081 /// </summary>
1069 private void UpdateStorageBackup() 1082 private void UpdateStorageBackup()
1070 { 1083 {
1071 if (!m_backingup) 1084 if (!m_backingup)
@@ -1078,6 +1091,9 @@ namespace OpenSim.Region.Framework.Scenes
1078 } 1091 }
1079 } 1092 }
1080 1093
1094 /// <summary>
1095 /// Sends out the OnFrame event to the modules
1096 /// </summary>
1081 private void UpdateEvents() 1097 private void UpdateEvents()
1082 { 1098 {
1083 m_eventManager.TriggerOnFrame(); 1099 m_eventManager.TriggerOnFrame();
@@ -1133,6 +1149,10 @@ namespace OpenSim.Region.Framework.Scenes
1133 } 1149 }
1134 } 1150 }
1135 1151
1152 /// <summary>
1153 /// Synchronous force backup. For deletes and links/unlinks
1154 /// </summary>
1155 /// <param name="group">Object to be backed up</param>
1136 public void ForceSceneObjectBackup(SceneObjectGroup group) 1156 public void ForceSceneObjectBackup(SceneObjectGroup group)
1137 { 1157 {
1138 if (group != null) 1158 if (group != null)
@@ -1141,6 +1161,13 @@ namespace OpenSim.Region.Framework.Scenes
1141 } 1161 }
1142 } 1162 }
1143 1163
1164 /// <summary>
1165 /// Return object to avatar Message
1166 /// </summary>
1167 /// <param name="agentID">Avatar Unique Id</param>
1168 /// <param name="objectName">Name of object returned</param>
1169 /// <param name="location">Location of object returned</param>
1170 /// <param name="reason">Reasion for object return</param>
1144 public void AddReturn(UUID agentID, string objectName, Vector3 location, string reason) 1171 public void AddReturn(UUID agentID, string objectName, Vector3 location, string reason)
1145 { 1172 {
1146 lock (m_returns) 1173 lock (m_returns)
@@ -1167,6 +1194,9 @@ namespace OpenSim.Region.Framework.Scenes
1167 1194
1168 #region Load Terrain 1195 #region Load Terrain
1169 1196
1197 /// <summary>
1198 /// Store the terrain in the persistant data store
1199 /// </summary>
1170 public void SaveTerrain() 1200 public void SaveTerrain()
1171 { 1201 {
1172 m_storageManager.DataStore.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID); 1202 m_storageManager.DataStore.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID);
@@ -1269,6 +1299,10 @@ namespace OpenSim.Region.Framework.Scenes
1269 1299
1270 #region Load Land 1300 #region Load Land
1271 1301
1302 /// <summary>
1303 /// Loads all Parcel data from the datastore for region identified by regionID
1304 /// </summary>
1305 /// <param name="regionID">Unique Identifier of the Region to load parcel data for</param>
1272 public void loadAllLandObjectsFromStorage(UUID regionID) 1306 public void loadAllLandObjectsFromStorage(UUID regionID)
1273 { 1307 {
1274 m_log.Info("[SCENE]: Loading land objects from storage"); 1308 m_log.Info("[SCENE]: Loading land objects from storage");
@@ -1322,6 +1356,20 @@ namespace OpenSim.Region.Framework.Scenes
1322 m_log.Info("[SCENE]: Loaded " + PrimsFromDB.Count.ToString() + " SceneObject(s)"); 1356 m_log.Info("[SCENE]: Loaded " + PrimsFromDB.Count.ToString() + " SceneObject(s)");
1323 } 1357 }
1324 1358
1359
1360 /// <summary>
1361 /// Gets a new rez location based on the raycast and the size of the object that is being rezzed.
1362 /// </summary>
1363 /// <param name="RayStart"></param>
1364 /// <param name="RayEnd"></param>
1365 /// <param name="RayTargetID"></param>
1366 /// <param name="rot"></param>
1367 /// <param name="bypassRayCast"></param>
1368 /// <param name="RayEndIsIntersection"></param>
1369 /// <param name="frontFacesOnly"></param>
1370 /// <param name="scale"></param>
1371 /// <param name="FaceCenter"></param>
1372 /// <returns></returns>
1325 public Vector3 GetNewRezLocation(Vector3 RayStart, Vector3 RayEnd, UUID RayTargetID, Quaternion rot, byte bypassRayCast, byte RayEndIsIntersection, bool frontFacesOnly, Vector3 scale, bool FaceCenter) 1373 public Vector3 GetNewRezLocation(Vector3 RayStart, Vector3 RayEnd, UUID RayTargetID, Quaternion rot, byte bypassRayCast, byte RayEndIsIntersection, bool frontFacesOnly, Vector3 scale, bool FaceCenter)
1326 { 1374 {
1327 Vector3 pos = Vector3.Zero; 1375 Vector3 pos = Vector3.Zero;
@@ -1412,6 +1460,19 @@ namespace OpenSim.Region.Framework.Scenes
1412 } 1460 }
1413 } 1461 }
1414 1462
1463
1464 /// <summary>
1465 /// Create a New SceneObjectGroup/Part by raycasting
1466 /// </summary>
1467 /// <param name="ownerID"></param>
1468 /// <param name="groupID"></param>
1469 /// <param name="RayEnd"></param>
1470 /// <param name="rot"></param>
1471 /// <param name="shape"></param>
1472 /// <param name="bypassRaycast"></param>
1473 /// <param name="RayStart"></param>
1474 /// <param name="RayTargetID"></param>
1475 /// <param name="RayEndIsIntersection"></param>
1415 public virtual void AddNewPrim(UUID ownerID, UUID groupID, Vector3 RayEnd, Quaternion rot, PrimitiveBaseShape shape, 1476 public virtual void AddNewPrim(UUID ownerID, UUID groupID, Vector3 RayEnd, Quaternion rot, PrimitiveBaseShape shape,
1416 byte bypassRaycast, Vector3 RayStart, UUID RayTargetID, 1477 byte bypassRaycast, Vector3 RayStart, UUID RayTargetID,
1417 byte RayEndIsIntersection) 1478 byte RayEndIsIntersection)
@@ -1829,6 +1890,12 @@ namespace OpenSim.Region.Framework.Scenes
1829 return true; 1890 return true;
1830 } 1891 }
1831 1892
1893 /// <summary>
1894 /// Attachment rezzing
1895 /// </summary>
1896 /// <param name="userID">Agent Unique ID</param>
1897 /// <param name="itemID">Object ID</param>
1898 /// <returns>False</returns>
1832 public virtual bool IncomingCreateObject(UUID userID, UUID itemID) 1899 public virtual bool IncomingCreateObject(UUID userID, UUID itemID)
1833 { 1900 {
1834 ScenePresence sp = GetScenePresence(userID); 1901 ScenePresence sp = GetScenePresence(userID);
@@ -1841,6 +1908,13 @@ namespace OpenSim.Region.Framework.Scenes
1841 return false; 1908 return false;
1842 } 1909 }
1843 1910
1911 /// <summary>
1912 /// Adds a Scene Object group to the Scene.
1913 /// Verifies that the creator of the object is not banned from the simulator.
1914 /// Checks if the item is an Attachment
1915 /// </summary>
1916 /// <param name="sceneObject"></param>
1917 /// <returns>True if the SceneObjectGroup was added, False if it was not</returns>
1844 public bool AddSceneObject(SceneObjectGroup sceneObject) 1918 public bool AddSceneObject(SceneObjectGroup sceneObject)
1845 { 1919 {
1846 // If the user is banned, we won't let any of their objects 1920 // If the user is banned, we won't let any of their objects
@@ -1933,6 +2007,10 @@ namespace OpenSim.Region.Framework.Scenes
1933 2007
1934 #region Add/Remove Avatar Methods 2008 #region Add/Remove Avatar Methods
1935 2009
2010 /// <summary>
2011 /// Adding a New Client and Create a Presence for it.
2012 /// </summary>
2013 /// <param name="client"></param>
1936 public override void AddNewClient(IClientAPI client) 2014 public override void AddNewClient(IClientAPI client)
1937 { 2015 {
1938 SubscribeToClientEvents(client); 2016 SubscribeToClientEvents(client);
@@ -1977,6 +2055,10 @@ namespace OpenSim.Region.Framework.Scenes
1977 EventManager.TriggerOnNewClient(client); 2055 EventManager.TriggerOnNewClient(client);
1978 } 2056 }
1979 2057
2058 /// <summary>
2059 /// Register for events from the client
2060 /// </summary>
2061 /// <param name="client">The IClientAPI of the connected client</param>
1980 protected virtual void SubscribeToClientEvents(IClientAPI client) 2062 protected virtual void SubscribeToClientEvents(IClientAPI client)
1981 { 2063 {
1982 client.OnRegionHandShakeReply += SendLayerData; 2064 client.OnRegionHandShakeReply += SendLayerData;
@@ -2070,8 +2152,8 @@ namespace OpenSim.Region.Framework.Scenes
2070 /// <summary> 2152 /// <summary>
2071 /// Teleport an avatar to their home region 2153 /// Teleport an avatar to their home region
2072 /// </summary> 2154 /// </summary>
2073 /// <param name="agentId"></param> 2155 /// <param name="agentId">The avatar's Unique ID</param>
2074 /// <param name="client"></param> 2156 /// <param name="client">The IClientAPI for the client</param>
2075 public virtual void TeleportClientHome(UUID agentId, IClientAPI client) 2157 public virtual void TeleportClientHome(UUID agentId, IClientAPI client)
2076 { 2158 {
2077 UserProfileData UserProfile = CommsManager.UserService.GetUserProfile(agentId); 2159 UserProfileData UserProfile = CommsManager.UserService.GetUserProfile(agentId);
@@ -2099,6 +2181,21 @@ namespace OpenSim.Region.Framework.Scenes
2099 } 2181 }
2100 } 2182 }
2101 2183
2184 /// <summary>
2185 /// Duplicates object specified by localID at position raycasted against RayTargetObject using
2186 /// RayEnd and RayStart to determine what the angle of the ray is
2187 /// </summary>
2188 /// <param name="localID">ID of object to duplicate</param>
2189 /// <param name="dupeFlags"></param>
2190 /// <param name="AgentID">Agent doing the duplication</param>
2191 /// <param name="GroupID">Group of new object</param>
2192 /// <param name="RayTargetObj">The target of the Ray</param>
2193 /// <param name="RayEnd">The ending of the ray (farthest away point)</param>
2194 /// <param name="RayStart">The Beginning of the ray (closest point)</param>
2195 /// <param name="BypassRaycast">Bool to bypass raycasting</param>
2196 /// <param name="RayEndIsIntersection">The End specified is the place to add the object</param>
2197 /// <param name="CopyCenters">Position the object at the center of the face that it's colliding with</param>
2198 /// <param name="CopyRotates">Rotate the object the same as the localID object</param>
2102 public void doObjectDuplicateOnRay(uint localID, uint dupeFlags, UUID AgentID, UUID GroupID, 2199 public void doObjectDuplicateOnRay(uint localID, uint dupeFlags, UUID AgentID, UUID GroupID,
2103 UUID RayTargetObj, Vector3 RayEnd, Vector3 RayStart, 2200 UUID RayTargetObj, Vector3 RayEnd, Vector3 RayStart,
2104 bool BypassRaycast, bool RayEndIsIntersection, bool CopyCenters, bool CopyRotates) 2201 bool BypassRaycast, bool RayEndIsIntersection, bool CopyCenters, bool CopyRotates)
@@ -2170,6 +2267,14 @@ namespace OpenSim.Region.Framework.Scenes
2170 } 2267 }
2171 } 2268 }
2172 2269
2270 /// <summary>
2271 /// Sets the Home Point. The GridService uses this to know where to put a user when they log-in
2272 /// </summary>
2273 /// <param name="remoteClient"></param>
2274 /// <param name="regionHandle"></param>
2275 /// <param name="position"></param>
2276 /// <param name="lookAt"></param>
2277 /// <param name="flags"></param>
2173 public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags) 2278 public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags)
2174 { 2279 {
2175 UserProfileData UserProfile = CommsManager.UserService.GetUserProfile(remoteClient.AgentId); 2280 UserProfileData UserProfile = CommsManager.UserService.GetUserProfile(remoteClient.AgentId);
@@ -2340,6 +2445,12 @@ namespace OpenSim.Region.Framework.Scenes
2340 } 2445 }
2341 } 2446 }
2342 2447
2448 /// <summary>
2449 /// Removes region from an avatar's known region list. This coincides with child agents. For each child agent, there will be a known region entry.
2450 ///
2451 /// </summary>
2452 /// <param name="avatarID"></param>
2453 /// <param name="regionslst"></param>
2343 public void HandleRemoveKnownRegionsFromAvatar(UUID avatarID, List<ulong> regionslst) 2454 public void HandleRemoveKnownRegionsFromAvatar(UUID avatarID, List<ulong> regionslst)
2344 { 2455 {
2345 ScenePresence av = GetScenePresence(avatarID); 2456 ScenePresence av = GetScenePresence(avatarID);
@@ -2355,12 +2466,19 @@ namespace OpenSim.Region.Framework.Scenes
2355 } 2466 }
2356 } 2467 }
2357 2468
2469 /// <summary>
2470 /// Closes all endpoints with the circuitcode provided.
2471 /// </summary>
2472 /// <param name="circuitcode">Circuit Code of the endpoint to close</param>
2358 public override void CloseAllAgents(uint circuitcode) 2473 public override void CloseAllAgents(uint circuitcode)
2359 { 2474 {
2360 // Called by ClientView to kill all circuit codes 2475 // Called by ClientView to kill all circuit codes
2361 ClientManager.CloseAllAgents(circuitcode); 2476 ClientManager.CloseAllAgents(circuitcode);
2362 } 2477 }
2363 2478
2479 /// <summary>
2480 /// Inform all other ScenePresences on this Scene that someone else has changed position on the minimap.
2481 /// </summary>
2364 public void NotifyMyCoarseLocationChange() 2482 public void NotifyMyCoarseLocationChange()
2365 { 2483 {
2366 ForEachScenePresence(delegate(ScenePresence presence) { presence.CoarseLocationChange(); }); 2484 ForEachScenePresence(delegate(ScenePresence presence) { presence.CoarseLocationChange(); });
@@ -2455,9 +2573,10 @@ namespace OpenSim.Region.Framework.Scenes
2455 /// The return bool should allow for connections to be refused, but as not all calling paths 2573 /// The return bool should allow for connections to be refused, but as not all calling paths
2456 /// take proper notice of it let, we allowed banned users in still. 2574 /// take proper notice of it let, we allowed banned users in still.
2457 /// </summary> 2575 /// </summary>
2458 /// <param name="regionHandle"></param> 2576 /// <param name="agent">CircuitData of the agent who is connecting</param>
2459 /// <param name="agent"></param> 2577 /// <param name="reason">Outputs the reason for the false response on this string</param>
2460 /// <param name="reason"></param> 2578 /// <returns>True if the region accepts this agent. False if it does not. False will
2579 /// also return a reason.</returns>
2461 public bool NewUserConnection(AgentCircuitData agent, out string reason) 2580 public bool NewUserConnection(AgentCircuitData agent, out string reason)
2462 { 2581 {
2463 // Don't disable this log message - it's too helpful 2582 // Don't disable this log message - it's too helpful
@@ -2530,6 +2649,13 @@ namespace OpenSim.Region.Framework.Scenes
2530 return true; 2649 return true;
2531 } 2650 }
2532 2651
2652 /// <summary>
2653 /// Verifies that the user has a session on the Grid
2654 /// </summary>
2655 /// <param name="agent">Circuit Data of the Agent we're verifying</param>
2656 /// <param name="reason">Outputs the reason for the false response on this string</param>
2657 /// <returns>True if the user has a session on the grid. False if it does not. False will
2658 /// also return a reason.</returns>
2533 public virtual bool AuthenticateUser(AgentCircuitData agent, out string reason) 2659 public virtual bool AuthenticateUser(AgentCircuitData agent, out string reason)
2534 { 2660 {
2535 reason = String.Empty; 2661 reason = String.Empty;
@@ -2542,6 +2668,13 @@ namespace OpenSim.Region.Framework.Scenes
2542 return result; 2668 return result;
2543 } 2669 }
2544 2670
2671 /// <summary>
2672 /// Verify if the user can connect to this region. Checks the banlist and ensures that the region is set for public access
2673 /// </summary>
2674 /// <param name="agent">The circuit data for the agent</param>
2675 /// <param name="reason">outputs the reason to this string</param>
2676 /// <returns>True if the region accepts this agent. False if it does not. False will
2677 /// also return a reason.</returns>
2545 protected virtual bool AuthorizeUser(AgentCircuitData agent, out string reason) 2678 protected virtual bool AuthorizeUser(AgentCircuitData agent, out string reason)
2546 { 2679 {
2547 reason = String.Empty; 2680 reason = String.Empty;
@@ -2600,16 +2733,32 @@ namespace OpenSim.Region.Framework.Scenes
2600 return true; 2733 return true;
2601 } 2734 }
2602 2735
2736 /// <summary>
2737 /// Update an AgentCircuitData object with new information
2738 /// </summary>
2739 /// <param name="data">Information to update the AgentCircuitData with</param>
2603 public void UpdateCircuitData(AgentCircuitData data) 2740 public void UpdateCircuitData(AgentCircuitData data)
2604 { 2741 {
2605 m_authenticateHandler.UpdateAgentData(data); 2742 m_authenticateHandler.UpdateAgentData(data);
2606 } 2743 }
2607 2744
2745 /// <summary>
2746 /// Change the Circuit Code for the user's Circuit Data
2747 /// </summary>
2748 /// <param name="oldcc">The old Circuit Code. Must match a previous circuit code</param>
2749 /// <param name="newcc">The new Circuit Code. Must not be an already existing circuit code</param>
2750 /// <returns>True if we successfully changed it. False if we did not</returns>
2608 public bool ChangeCircuitCode(uint oldcc, uint newcc) 2751 public bool ChangeCircuitCode(uint oldcc, uint newcc)
2609 { 2752 {
2610 return m_authenticateHandler.TryChangeCiruitCode(oldcc, newcc); 2753 return m_authenticateHandler.TryChangeCiruitCode(oldcc, newcc);
2611 } 2754 }
2612 2755
2756 /// <summary>
2757 /// The Grid has requested that we log-off a user. Log them off.
2758 /// </summary>
2759 /// <param name="AvatarID">Unique ID of the avatar to log-off</param>
2760 /// <param name="RegionSecret">SecureSessionID of the user, or the RegionSecret text when logging on to the grid</param>
2761 /// <param name="message">message to display to the user. Reason for being logged off</param>
2613 public void HandleLogOffUserFromGrid(UUID AvatarID, UUID RegionSecret, string message) 2762 public void HandleLogOffUserFromGrid(UUID AvatarID, UUID RegionSecret, string message)
2614 { 2763 {
2615 ScenePresence loggingOffUser = null; 2764 ScenePresence loggingOffUser = null;
@@ -2675,6 +2824,13 @@ namespace OpenSim.Region.Framework.Scenes
2675 } 2824 }
2676 } 2825 }
2677 2826
2827 /// <summary>
2828 /// We've got an update about an agent that sees into this region,
2829 /// send it to ScenePresence for processing It's the full data.
2830 /// </summary>
2831 /// <param name="cAgentData">Agent that contains all of the relevant things about an agent.
2832 /// Appearance, animations, position, etc.</param>
2833 /// <returns>true if we handled it.</returns>
2678 public virtual bool IncomingChildAgentDataUpdate(AgentData cAgentData) 2834 public virtual bool IncomingChildAgentDataUpdate(AgentData cAgentData)
2679 { 2835 {
2680// m_log.DebugFormat( 2836// m_log.DebugFormat(
@@ -2692,6 +2848,12 @@ namespace OpenSim.Region.Framework.Scenes
2692 return false; 2848 return false;
2693 } 2849 }
2694 2850
2851 /// <summary>
2852 /// We've got an update about an agent that sees into this region,
2853 /// send it to ScenePresence for processing It's only positional data
2854 /// </summary>
2855 /// <param name="cAgentData">AgentPosition that contains agent positional data so we can know what to send</param>
2856 /// <returns>true if we handled it.</returns>
2695 public virtual bool IncomingChildAgentDataUpdate(AgentPosition cAgentData) 2857 public virtual bool IncomingChildAgentDataUpdate(AgentPosition cAgentData)
2696 { 2858 {
2697 //m_log.Debug(" XXX Scene IncomingChildAgentDataUpdate POSITION in " + RegionInfo.RegionName); 2859 //m_log.Debug(" XXX Scene IncomingChildAgentDataUpdate POSITION in " + RegionInfo.RegionName);
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
index 0140faa..c1e39a9 100644
--- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
@@ -48,6 +48,9 @@ namespace OpenSim.Region.Framework.Scenes
48 48
49 public delegate void RemoveKnownRegionsFromAvatarList(UUID avatarID, List<ulong> regionlst); 49 public delegate void RemoveKnownRegionsFromAvatarList(UUID avatarID, List<ulong> regionlst);
50 50
51 /// <summary>
52 /// Class that Region communications runs through
53 /// </summary>
51 public class SceneCommunicationService //one instance per region 54 public class SceneCommunicationService //one instance per region
52 { 55 {
53 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 56 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -60,15 +63,46 @@ namespace OpenSim.Region.Framework.Scenes
60 63
61 protected List<UUID> m_agentsInTransit; 64 protected List<UUID> m_agentsInTransit;
62 65
66 /// <summary>
67 /// An agent is crossing into this region
68 /// </summary>
63 public event AgentCrossing OnAvatarCrossingIntoRegion; 69 public event AgentCrossing OnAvatarCrossingIntoRegion;
70
71 /// <summary>
72 /// A user will arrive shortly, set up appropriate credentials so it can connect
73 /// </summary>
64 public event ExpectUserDelegate OnExpectUser; 74 public event ExpectUserDelegate OnExpectUser;
75
76 /// <summary>
77 /// A Prim will arrive shortly
78 /// </summary>
65 public event ExpectPrimDelegate OnExpectPrim; 79 public event ExpectPrimDelegate OnExpectPrim;
66 public event CloseAgentConnection OnCloseAgentConnection; 80 public event CloseAgentConnection OnCloseAgentConnection;
81
82 /// <summary>
83 /// A new prim has arrived
84 /// </summary>
67 public event PrimCrossing OnPrimCrossingIntoRegion; 85 public event PrimCrossing OnPrimCrossingIntoRegion;
86
87 /// <summary>
88 /// A New Region is up and available
89 /// </summary>
68 public event RegionUp OnRegionUp; 90 public event RegionUp OnRegionUp;
91
92 /// <summary>
93 /// We have a child agent for this avatar and we're getting a status update about it
94 /// </summary>
69 public event ChildAgentUpdate OnChildAgentUpdate; 95 public event ChildAgentUpdate OnChildAgentUpdate;
70 //public event RemoveKnownRegionsFromAvatarList OnRemoveKnownRegionFromAvatar; 96 //public event RemoveKnownRegionsFromAvatarList OnRemoveKnownRegionFromAvatar;
97
98 /// <summary>
99 /// Time to log one of our users off. Grid Service sends this mostly
100 /// </summary>
71 public event LogOffUser OnLogOffUser; 101 public event LogOffUser OnLogOffUser;
102
103 /// <summary>
104 /// A region wants land data from us!
105 /// </summary>
72 public event GetLandData OnGetLandData; 106 public event GetLandData OnGetLandData;
73 107
74 private AgentCrossing handlerAvatarCrossingIntoRegion = null; // OnAvatarCrossingIntoRegion; 108 private AgentCrossing handlerAvatarCrossingIntoRegion = null; // OnAvatarCrossingIntoRegion;
@@ -123,11 +157,20 @@ namespace OpenSim.Region.Framework.Scenes
123 } 157 }
124 } 158 }
125 159
160 /// <summary>
161 /// Returns a region with the name closest to string provided
162 /// </summary>
163 /// <param name="name">Partial Region Name for matching</param>
164 /// <returns>Region Information for the region</returns>
126 public RegionInfo RequestClosestRegion(string name) 165 public RegionInfo RequestClosestRegion(string name)
127 { 166 {
128 return m_commsProvider.GridService.RequestClosestRegion(name); 167 return m_commsProvider.GridService.RequestClosestRegion(name);
129 } 168 }
130 169
170 /// <summary>
171 /// This region is shutting down, de-register all events!
172 /// De-Register region from Grid!
173 /// </summary>
131 public void Close() 174 public void Close()
132 { 175 {
133 if (regionCommsHost != null) 176 if (regionCommsHost != null)
@@ -159,10 +202,9 @@ namespace OpenSim.Region.Framework.Scenes
159 #region CommsManager Event handlers 202 #region CommsManager Event handlers
160 203
161 /// <summary> 204 /// <summary>
162 /// 205 /// A New User will arrive shortly, Informs the scene that there's a new user on the way
163 /// </summary> 206 /// </summary>
164 /// <param name="regionHandle"></param> 207 /// <param name="agent">Data we need to ensure that the agent can connect</param>
165 /// <param name="agent"></param>
166 /// 208 ///
167 protected void NewUserConnection(AgentCircuitData agent) 209 protected void NewUserConnection(AgentCircuitData agent)
168 { 210 {
@@ -174,6 +216,12 @@ namespace OpenSim.Region.Framework.Scenes
174 } 216 }
175 } 217 }
176 218
219 /// <summary>
220 /// The Grid has requested us to log-off the user
221 /// </summary>
222 /// <param name="AgentID">Unique ID of agent to log-off</param>
223 /// <param name="RegionSecret">The secret string that the region establishes with the grid when registering</param>
224 /// <param name="message">The message to send to the user that tells them why they were logged off</param>
177 protected void GridLogOffUser(UUID AgentID, UUID RegionSecret, string message) 225 protected void GridLogOffUser(UUID AgentID, UUID RegionSecret, string message)
178 { 226 {
179 handlerLogOffUser = OnLogOffUser; 227 handlerLogOffUser = OnLogOffUser;
@@ -183,6 +231,11 @@ namespace OpenSim.Region.Framework.Scenes
183 } 231 }
184 } 232 }
185 233
234 /// <summary>
235 /// A New Region is now available. Inform the scene that there is a new region available.
236 /// </summary>
237 /// <param name="region">Information about the new region that is available</param>
238 /// <returns>True if the event was handled</returns>
186 protected bool newRegionUp(RegionInfo region) 239 protected bool newRegionUp(RegionInfo region)
187 { 240 {
188 handlerRegionUp = OnRegionUp; 241 handlerRegionUp = OnRegionUp;
@@ -194,6 +247,11 @@ namespace OpenSim.Region.Framework.Scenes
194 return true; 247 return true;
195 } 248 }
196 249
250 /// <summary>
251 /// Inform the scene that we've got an update about a child agent that we have
252 /// </summary>
253 /// <param name="cAgentData"></param>
254 /// <returns></returns>
197 protected bool ChildAgentUpdate(ChildAgentDataUpdate cAgentData) 255 protected bool ChildAgentUpdate(ChildAgentDataUpdate cAgentData)
198 { 256 {
199 handlerChildAgentUpdate = OnChildAgentUpdate; 257 handlerChildAgentUpdate = OnChildAgentUpdate;
@@ -204,6 +262,7 @@ namespace OpenSim.Region.Framework.Scenes
204 return true; 262 return true;
205 } 263 }
206 264
265
207 protected void AgentCrossing(UUID agentID, Vector3 position, bool isFlying) 266 protected void AgentCrossing(UUID agentID, Vector3 position, bool isFlying)
208 { 267 {
209 handlerAvatarCrossingIntoRegion = OnAvatarCrossingIntoRegion; 268 handlerAvatarCrossingIntoRegion = OnAvatarCrossingIntoRegion;
@@ -213,6 +272,13 @@ namespace OpenSim.Region.Framework.Scenes
213 } 272 }
214 } 273 }
215 274
275 /// <summary>
276 /// We have a new prim from a neighbor
277 /// </summary>
278 /// <param name="primID">unique ID for the primative</param>
279 /// <param name="objXMLData">XML2 encoded data of the primative</param>
280 /// <param name="XMLMethod">An Int that represents the version of the XMLMethod</param>
281 /// <returns>True if the prim was accepted, false if it was not</returns>
216 protected bool IncomingPrimCrossing(UUID primID, String objXMLData, int XMLMethod) 282 protected bool IncomingPrimCrossing(UUID primID, String objXMLData, int XMLMethod)
217 { 283 {
218 handlerExpectPrim = OnExpectPrim; 284 handlerExpectPrim = OnExpectPrim;
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs
index a3672d5..88452d2 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs
@@ -113,6 +113,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
113 agent.InventoryFolder = UUID.Zero; 113 agent.InventoryFolder = UUID.Zero;
114 agent.startpos = Vector3.Zero; 114 agent.startpos = Vector3.Zero;
115 agent.CapsPath = GetRandomCapsObjectPath(); 115 agent.CapsPath = GetRandomCapsObjectPath();
116 agent.ChildrenCapSeeds = new Dictionary<ulong, string>();
116 117
117 string reason; 118 string reason;
118 scene.NewUserConnection(agent, out reason); 119 scene.NewUserConnection(agent, out reason);
diff --git a/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs
index ed2d317..23eab90 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs
@@ -38,6 +38,7 @@ using OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion;
38using OpenSim.Tests.Common; 38using OpenSim.Tests.Common;
39using OpenSim.Tests.Common.Mock; 39using OpenSim.Tests.Common.Mock;
40using OpenSim.Tests.Common.Setup; 40using OpenSim.Tests.Common.Setup;
41using System.Threading;
41 42
42namespace OpenSim.Region.Framework.Scenes.Tests 43namespace OpenSim.Region.Framework.Scenes.Tests
43{ 44{
@@ -55,56 +56,130 @@ namespace OpenSim.Region.Framework.Scenes.Tests
55 public void TestSimpleNotNeighboursTeleport() 56 public void TestSimpleNotNeighboursTeleport()
56 { 57 {
57 TestHelper.InMethod(); 58 TestHelper.InMethod();
59 ThreadRunResults results = new ThreadRunResults();
60 results.Result = false;
61 results.Message = "Test did not run";
62 TestRunning testClass = new TestRunning(results);
58 63
64 Thread testThread = new Thread(testClass.run);
65
66 try
67 {
68 // Seems kind of redundant to start a thread and then join it, however.. We need to protect against
69 // A thread abort exception in the simulator code.
70 testThread.Start();
71 testThread.Join();
72 }
73 catch (ThreadAbortException)
74 {
75
76 }
77 Assert.That(testClass.results.Result, Is.EqualTo(true), testClass.results.Message);
59 // Console.WriteLine("Beginning test {0}", MethodBase.GetCurrentMethod()); 78 // Console.WriteLine("Beginning test {0}", MethodBase.GetCurrentMethod());
79 }
80
81 }
82
83 public class ThreadRunResults
84 {
85 public bool Result = false;
86 public string Message = string.Empty;
87 }
88
89 public class TestRunning
90 {
91 public ThreadRunResults results;
92 public TestRunning(ThreadRunResults t)
93 {
94 results = t;
95 }
96 public void run(object o)
97 {
60 98
99 //results.Result = true;
61 log4net.Config.XmlConfigurator.Configure(); 100 log4net.Config.XmlConfigurator.Configure();
62 101
63 UUID sceneAId = UUID.Parse("00000000-0000-0000-0000-000000000100"); 102 UUID sceneAId = UUID.Parse("00000000-0000-0000-0000-000000000100");
64 UUID sceneBId = UUID.Parse("00000000-0000-0000-0000-000000000200"); 103 UUID sceneBId = UUID.Parse("00000000-0000-0000-0000-000000000200");
65 TestCommunicationsManager cm = new TestCommunicationsManager(); 104 TestCommunicationsManager cm = new TestCommunicationsManager();
66 105
67 // shared module 106 // shared module
68 ISharedRegionModule interregionComms = new RESTInterregionComms(); 107 ISharedRegionModule interregionComms = new RESTInterregionComms();
69 108
70 Scene sceneA = SceneSetupHelpers.SetupScene("sceneA", sceneAId, 1000, 1000, cm); 109 Scene sceneA = SceneSetupHelpers.SetupScene("sceneA", sceneAId, 1000, 1000, cm);
71 SceneSetupHelpers.SetupSceneModules(sceneA, new IniConfigSource(), interregionComms); 110 SceneSetupHelpers.SetupSceneModules(sceneA, new IniConfigSource(), interregionComms);
72 sceneA.RegisterRegionWithGrid(); 111 sceneA.RegisterRegionWithGrid();
73 112
74 Scene sceneB = SceneSetupHelpers.SetupScene("sceneB", sceneBId, 1010, 1010, cm); 113 Scene sceneB = SceneSetupHelpers.SetupScene("sceneB", sceneBId, 1010, 1010, cm);
75 SceneSetupHelpers.SetupSceneModules(sceneB, new IniConfigSource(), interregionComms); 114 SceneSetupHelpers.SetupSceneModules(sceneB, new IniConfigSource(), interregionComms);
76 sceneB.RegisterRegionWithGrid(); 115 sceneB.RegisterRegionWithGrid();
77 116
78 UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000041"); 117 UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000041");
79 TestClient client = SceneSetupHelpers.AddRootAgent(sceneA, agentId); 118 TestClient client = SceneSetupHelpers.AddRootAgent(sceneA, agentId);
80 119
81 ICapabilitiesModule sceneACapsModule = sceneA.RequestModuleInterface<ICapabilitiesModule>(); 120 ICapabilitiesModule sceneACapsModule = sceneA.RequestModuleInterface<ICapabilitiesModule>();
121
122 results.Result = (sceneACapsModule.GetCapsPath(agentId) == client.CapsSeedUrl);
82 123
124 if (!results.Result)
125 {
126 results.Message = "Incorrect caps object path set up in sceneA";
127 return;
128 }
129
130 /*
83 Assert.That( 131 Assert.That(
84 sceneACapsModule.GetCapsPath(agentId), 132 sceneACapsModule.GetCapsPath(agentId),
85 Is.EqualTo(client.CapsSeedUrl), 133 Is.EqualTo(client.CapsSeedUrl),
86 "Incorrect caps object path set up in sceneA"); 134 "Incorrect caps object path set up in sceneA");
87 135 */
88 // FIXME: This is a hack to get the test working - really the normal OpenSim mechanisms should be used. 136 // FIXME: This is a hack to get the test working - really the normal OpenSim mechanisms should be used.
89 client.TeleportTargetScene = sceneB;
90 client.Teleport(sceneB.RegionInfo.RegionHandle, new Vector3(100, 100, 100), new Vector3(40, 40, 40));
91 137
92 Assert.That(sceneB.GetScenePresence(agentId), Is.Not.Null, "Client does not have an agent in sceneB"); 138
93 Assert.That(sceneA.GetScenePresence(agentId), Is.Null, "Client still had an agent in sceneA"); 139 client.TeleportTargetScene = sceneB;
140 client.Teleport(sceneB.RegionInfo.RegionHandle, new Vector3(100, 100, 100), new Vector3(40, 40, 40));
141
142 results.Result = (sceneB.GetScenePresence(agentId) != null);
143 if (!results.Result)
144 {
145 results.Message = "Client does not have an agent in sceneB";
146 return;
147 }
148
149 //Assert.That(sceneB.GetScenePresence(agentId), Is.Not.Null, "Client does not have an agent in sceneB");
94 150
151 //Assert.That(sceneA.GetScenePresence(agentId), Is.Null, "Client still had an agent in sceneA");
152
153 results.Result = (sceneA.GetScenePresence(agentId) == null);
154 if (!results.Result)
155 {
156 results.Message = "Client still had an agent in sceneA";
157 return;
158 }
159
95 ICapabilitiesModule sceneBCapsModule = sceneB.RequestModuleInterface<ICapabilitiesModule>(); 160 ICapabilitiesModule sceneBCapsModule = sceneB.RequestModuleInterface<ICapabilitiesModule>();
96 161
162
163 results.Result = ("http://" + sceneB.RegionInfo.ExternalHostName + ":" + sceneB.RegionInfo.HttpPort +
164 "/CAPS/" + sceneBCapsModule.GetCapsPath(agentId) + "0000/" == client.CapsSeedUrl);
165 if (!results.Result)
166 {
167 results.Message = "Incorrect caps object path set up in sceneB";
168 return;
169 }
170
97 // Temporary assertion - caps url construction should at least be doable through a method. 171 // Temporary assertion - caps url construction should at least be doable through a method.
172 /*
98 Assert.That( 173 Assert.That(
99 "http://" + sceneB.RegionInfo.ExternalHostName + ":" + sceneB.RegionInfo.HttpPort + "/CAPS/" + sceneBCapsModule.GetCapsPath(agentId) + "0000/", 174 "http://" + sceneB.RegionInfo.ExternalHostName + ":" + sceneB.RegionInfo.HttpPort + "/CAPS/" + sceneBCapsModule.GetCapsPath(agentId) + "0000/",
100 Is.EqualTo(client.CapsSeedUrl), 175 Is.EqualTo(client.CapsSeedUrl),
101 "Incorrect caps object path set up in sceneB"); 176 "Incorrect caps object path set up in sceneB");
102 177 */
103 // This assertion will currently fail since we don't remove the caps paths when no longer needed 178 // This assertion will currently fail since we don't remove the caps paths when no longer needed
104 //Assert.That(sceneACapsModule.GetCapsPath(agentId), Is.Null, "sceneA still had a caps object path"); 179 //Assert.That(sceneACapsModule.GetCapsPath(agentId), Is.Null, "sceneA still had a caps object path");
105 180
106 // TODO: Check that more of everything is as it should be 181 // TODO: Check that more of everything is as it should be
107 182
108 // TODO: test what happens if we try to teleport to a region that doesn't exist 183 // TODO: test what happens if we try to teleport to a region that doesn't exist
109 } 184 }
110 } 185 }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index ff85b96..691732a 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -125,9 +125,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
125 125
126 if (lease.CurrentState == LeaseState.Initial) 126 if (lease.CurrentState == LeaseState.Initial)
127 { 127 {
128 lease.InitialLeaseTime = TimeSpan.FromMinutes(1.0); 128 lease.InitialLeaseTime = TimeSpan.FromMinutes(0);
129 lease.RenewOnCallTime = TimeSpan.FromSeconds(10.0); 129// lease.RenewOnCallTime = TimeSpan.FromSeconds(10.0);
130 lease.SponsorshipTimeout = TimeSpan.FromMinutes(1.0); 130// lease.SponsorshipTimeout = TimeSpan.FromMinutes(1.0);
131 } 131 }
132 return lease; 132 return lease;
133 } 133 }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 6539bda..6e3a3ab 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -166,9 +166,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
166 166
167 if (lease.CurrentState == LeaseState.Initial) 167 if (lease.CurrentState == LeaseState.Initial)
168 { 168 {
169 lease.InitialLeaseTime = TimeSpan.FromMinutes(1.0); 169 lease.InitialLeaseTime = TimeSpan.FromMinutes(0);
170 lease.RenewOnCallTime = TimeSpan.FromSeconds(10.0); 170// lease.RenewOnCallTime = TimeSpan.FromSeconds(10.0);
171 lease.SponsorshipTimeout = TimeSpan.FromMinutes(1.0); 171// lease.SponsorshipTimeout = TimeSpan.FromMinutes(1.0);
172 } 172 }
173 return lease; 173 return lease;
174 } 174 }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/ScriptBase.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/ScriptBase.cs
index d119a77..838cafb 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/ScriptBase.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/ScriptBase.cs
@@ -42,16 +42,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
42 public partial class ScriptBaseClass : MarshalByRefObject, IScript 42 public partial class ScriptBaseClass : MarshalByRefObject, IScript
43 { 43 {
44 private Dictionary<string, MethodInfo> inits = new Dictionary<string, MethodInfo>(); 44 private Dictionary<string, MethodInfo> inits = new Dictionary<string, MethodInfo>();
45 private ScriptSponsor m_sponser; 45// private ScriptSponsor m_sponser;
46 46
47 public override Object InitializeLifetimeService() 47 public override Object InitializeLifetimeService()
48 { 48 {
49 ILease lease = (ILease)base.InitializeLifetimeService(); 49 ILease lease = (ILease)base.InitializeLifetimeService();
50 if (lease.CurrentState == LeaseState.Initial) 50 if (lease.CurrentState == LeaseState.Initial)
51 { 51 {
52 lease.InitialLeaseTime = TimeSpan.FromMinutes(1.0); 52 // Infinite
53 lease.RenewOnCallTime = TimeSpan.FromSeconds(10.0); 53 lease.InitialLeaseTime = TimeSpan.FromMinutes(0);
54 lease.SponsorshipTimeout = TimeSpan.FromMinutes(1.0); 54// lease.RenewOnCallTime = TimeSpan.FromSeconds(10.0);
55// lease.SponsorshipTimeout = TimeSpan.FromMinutes(1.0);
55 } 56 }
56 return lease; 57 return lease;
57 } 58 }
@@ -79,7 +80,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
79 } 80 }
80 } 81 }
81 82
82 m_sponser = new ScriptSponsor(); 83// m_sponser = new ScriptSponsor();
83 } 84 }
84 85
85 private Executor m_Executor = null; 86 private Executor m_Executor = null;
@@ -112,7 +113,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
112 return; 113 return;
113 114
114 ILease lease = (ILease)RemotingServices.GetLifetimeService(data as MarshalByRefObject); 115 ILease lease = (ILease)RemotingServices.GetLifetimeService(data as MarshalByRefObject);
115 lease.Register(m_sponser); 116// lease.Register(m_sponser);
116 117
117 MethodInfo mi = inits[api]; 118 MethodInfo mi = inits[api];
118 119
@@ -126,7 +127,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
126 127
127 public void Close() 128 public void Close()
128 { 129 {
129 m_sponser.Close(); 130// m_sponser.Close();
130 } 131 }
131 132
132 public Dictionary<string, object> GetVars() 133 public Dictionary<string, object> GetVars()
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
index 4211ced..225126d 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
@@ -53,7 +53,7 @@ using OpenSim.Region.ScriptEngine.Interfaces;
53 53
54namespace OpenSim.Region.ScriptEngine.Shared.Instance 54namespace OpenSim.Region.ScriptEngine.Shared.Instance
55{ 55{
56 public class ScriptInstance : MarshalByRefObject, IScriptInstance, ISponsor 56 public class ScriptInstance : MarshalByRefObject, IScriptInstance
57 { 57 {
58 // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 58 // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
59 59
@@ -261,7 +261,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
261 "SecondLife.Script"); 261 "SecondLife.Script");
262 262
263 ILease lease = (ILease)RemotingServices.GetLifetimeService(m_Script as ScriptBaseClass); 263 ILease lease = (ILease)RemotingServices.GetLifetimeService(m_Script as ScriptBaseClass);
264 lease.Register(this); 264// lease.Register(this);
265 } 265 }
266 catch (Exception) 266 catch (Exception)
267 { 267 {
@@ -1006,10 +1006,5 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
1006 { 1006 {
1007 return true; 1007 return true;
1008 } 1008 }
1009
1010 public TimeSpan Renewal(ILease lease)
1011 {
1012 return lease.InitialLeaseTime;
1013 }
1014 } 1009 }
1015} 1010}
diff --git a/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineTest.cs b/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineTest.cs
index aac52a4..045abb4 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineTest.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineTest.cs
@@ -40,6 +40,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine.Tests
40 /// <summary> 40 /// <summary>
41 /// Scene presence tests 41 /// Scene presence tests
42 /// </summary> 42 /// </summary>
43 /// Commented out XEngineTests that don't do anything
44 /*
43 [TestFixture] 45 [TestFixture]
44 public class XEngineTest 46 public class XEngineTest
45 { 47 {
@@ -65,4 +67,5 @@ namespace OpenSim.Region.ScriptEngine.XEngine.Tests
65 xengine.RegionLoaded(scene); 67 xengine.RegionLoaded(scene);
66 } 68 }
67 } 69 }
70 */
68} 71}
diff --git a/OpenSim/Services/Interfaces/IAssetService.cs b/OpenSim/Services/Interfaces/IAssetService.cs
index ec8a71b..6dfe78d 100644
--- a/OpenSim/Services/Interfaces/IAssetService.cs
+++ b/OpenSim/Services/Interfaces/IAssetService.cs
@@ -34,25 +34,53 @@ namespace OpenSim.Services.Interfaces
34 34
35 public interface IAssetService 35 public interface IAssetService
36 { 36 {
37 // Three different ways to retrieve an asset 37 /// <summary>
38 // 38 /// Get an asset synchronously.
39 /// </summary>
40 /// <param name="id"></param>
41 /// <returns></returns>
39 AssetBase Get(string id); 42 AssetBase Get(string id);
43
44 /// <summary>
45 /// Get an asset's metadata
46 /// </summary>
47 /// <param name="id"></param>
48 /// <returns></returns>
40 AssetMetadata GetMetadata(string id); 49 AssetMetadata GetMetadata(string id);
50
41 byte[] GetData(string id); 51 byte[] GetData(string id);
42 52
53 /// <summary>
54 /// Get an asset asynchronously
55 /// </summary>
56 /// <param name="id">The asset id</param>
57 /// <param name="sender">Represents the requester. Passed back via the handler</param>
58 /// <param name="handler">The handler to call back once the asset has been retrieved</param>
59 /// <returns>True if the id was parseable, false otherwise</returns>
43 bool Get(string id, Object sender, AssetRetrieved handler); 60 bool Get(string id, Object sender, AssetRetrieved handler);
44 61
45 // Creates a new asset 62 /// <summary>
46 // Returns a random ID if none is passed into it 63 /// Creates a new asset
47 // 64 /// </summary>
65 /// Returns a random ID if none is passed into it
66 /// <param name="asset"></param>
67 /// <returns></returns>
48 string Store(AssetBase asset); 68 string Store(AssetBase asset);
49 69
50 // Attachments and bare scripts need this!! 70 /// <summary>
51 // 71 /// Update an asset's content
72 /// </summary>
73 /// Attachments and bare scripts need this!!
74 /// <param name="id"> </param>
75 /// <param name="data"></param>
76 /// <returns></returns>
52 bool UpdateContent(string id, byte[] data); 77 bool UpdateContent(string id, byte[] data);
53 78
54 // Kill an asset 79 /// <summary>
55 // 80 /// Delete an asset
81 /// </summary>
82 /// <param name="id"></param>
83 /// <returns></returns>
56 bool Delete(string id); 84 bool Delete(string id);
57 } 85 }
58} 86}
diff --git a/OpenSim/Tests/Common/Mock/TestAssetService.cs b/OpenSim/Tests/Common/Mock/TestAssetService.cs
index 5f1184b..81f123a 100644
--- a/OpenSim/Tests/Common/Mock/TestAssetService.cs
+++ b/OpenSim/Tests/Common/Mock/TestAssetService.cs
@@ -45,7 +45,13 @@ namespace OpenSim.Tests.Common.Mock
45 45
46 public AssetBase Get(string id) 46 public AssetBase Get(string id)
47 { 47 {
48 return Assets[ id ]; 48 AssetBase asset;
49 if (Assets.ContainsKey(id))
50 asset = Assets[id];
51 else
52 asset = null;
53
54 return asset;
49 } 55 }
50 56
51 public AssetMetadata GetMetadata(string id) 57 public AssetMetadata GetMetadata(string id)
@@ -59,8 +65,10 @@ namespace OpenSim.Tests.Common.Mock
59 } 65 }
60 66
61 public bool Get(string id, object sender, AssetRetrieved handler) 67 public bool Get(string id, object sender, AssetRetrieved handler)
62 { 68 {
63 throw new NotImplementedException(); 69 handler(id, sender, Get(id));
70
71 return true;
64 } 72 }
65 73
66 public string Store(AssetBase asset) 74 public string Store(AssetBase asset)