diff options
author | Teravus Ovares (Dan Olivares) | 2009-08-14 14:16:02 -0400 |
---|---|---|
committer | Teravus Ovares (Dan Olivares) | 2009-08-14 14:16:02 -0400 |
commit | 755464170300e89bc92b5b4b8f1c22f14161d75d (patch) | |
tree | a5441ddc4496b00a927d5fbe9ffcf614635a5cd2 /OpenSim | |
parent | * allocate the dictionary for AgentCircuitData.ChildrenCapSeeds when creating... (diff) | |
parent | Remove NRE catching on TestReplicateArchivePathToUserInventory() since race f... (diff) | |
download | opensim-SC-755464170300e89bc92b5b4b8f1c22f14161d75d.zip opensim-SC-755464170300e89bc92b5b4b8f1c22f14161d75d.tar.gz opensim-SC-755464170300e89bc92b5b4b8f1c22f14161d75d.tar.bz2 opensim-SC-755464170300e89bc92b5b4b8f1c22f14161d75d.tar.xz |
Merge branch 'master' of ssh://MyConnection/var/git/opensim
Diffstat (limited to 'OpenSim')
8 files changed, 435 insertions, 49 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 @@ | |||
1 | using System; | ||
2 | using System.Collections; | ||
3 | using System.Collections.Generic; | ||
4 | using System.Drawing; | ||
5 | using System.Linq; | ||
6 | using System.Linq.Expressions; | ||
7 | using System.Reflection; | ||
8 | using NUnit.Framework; | ||
9 | using NUnit.Framework.Constraints; | ||
10 | using NUnit.Framework.SyntaxHelpers; | ||
11 | using OpenMetaverse; | ||
12 | using OpenSim.Framework; | ||
13 | |||
14 | namespace 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 @@ | |||
1 | using System; | ||
2 | using System.Collections; | ||
3 | using System.Reflection; | ||
4 | using System.Text; | ||
5 | using NUnit.Framework; | ||
6 | using OpenMetaverse; | ||
7 | using OpenSim.Framework; | ||
8 | |||
9 | namespace 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..2169e36 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs | |||
@@ -395,17 +395,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
395 | userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager, InventoryReceived); | 395 | userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager, InventoryReceived); |
396 | Monitor.Wait(this, 60000); | 396 | Monitor.Wait(this, 60000); |
397 | } | 397 | } |
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 | 398 | ||
410 | Console.WriteLine("userInfo.RootFolder 1: {0}", userInfo.RootFolder); | 399 | Console.WriteLine("userInfo.RootFolder 1: {0}", userInfo.RootFolder); |
411 | 400 | ||
@@ -429,22 +418,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
429 | 418 | ||
430 | Console.WriteLine("userInfo.RootFolder 2: {0}", userInfo.RootFolder); | 419 | Console.WriteLine("userInfo.RootFolder 2: {0}", userInfo.RootFolder); |
431 | 420 | ||
432 | try | 421 | new InventoryArchiveReadRequest(userInfo, null, (Stream)null, null, null) |
433 | { | 422 | .ReplicateArchivePathToUserInventory( |
434 | new InventoryArchiveReadRequest(userInfo, null, (Stream)null, null, null) | 423 | itemArchivePath, false, userInfo.RootFolder, foldersCreated, nodesLoaded); |
435 | .ReplicateArchivePathToUserInventory(itemArchivePath, false, userInfo.RootFolder, foldersCreated, nodesLoaded); | 424 | |
436 | 425 | Console.WriteLine("userInfo.RootFolder 3: {0}", userInfo.RootFolder); | |
437 | Console.WriteLine("userInfo.RootFolder 3: {0}", userInfo.RootFolder); | 426 | InventoryFolderImpl folder1 = userInfo.RootFolder.FindFolderByPath("a"); |
438 | InventoryFolderImpl folder1 = userInfo.RootFolder.FindFolderByPath("a"); | 427 | Assert.That(folder1, Is.Not.Null, "Could not find folder a"); |
439 | Assert.That(folder1, Is.Not.Null, "Could not find folder a"); | 428 | InventoryFolderImpl folder2 = folder1.FindFolderByPath("b"); |
440 | InventoryFolderImpl folder2 = folder1.FindFolderByPath("b"); | 429 | 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 | } | 430 | } |
449 | } | 431 | } |
450 | } | 432 | } |
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 | ||
54 | namespace OpenSim.Region.ScriptEngine.Shared.Instance | 54 | namespace 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 | } |