diff options
author | Justin Clark-Casey (justincc) | 2013-02-26 23:36:36 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2013-02-26 23:36:36 +0000 |
commit | b8a7c8b26f3005eed5b161c37509b06b1d604967 (patch) | |
tree | 67304ff03ac6331b33bfa75201da1a529feec0bd /OpenSim/Tests | |
parent | BulletSim: fix crash around race condition when a mesh asset cannot (diff) | |
download | opensim-SC-b8a7c8b26f3005eed5b161c37509b06b1d604967.zip opensim-SC-b8a7c8b26f3005eed5b161c37509b06b1d604967.tar.gz opensim-SC-b8a7c8b26f3005eed5b161c37509b06b1d604967.tar.bz2 opensim-SC-b8a7c8b26f3005eed5b161c37509b06b1d604967.tar.xz |
Add regression test for llRequestUrl()
Diffstat (limited to 'OpenSim/Tests')
-rw-r--r-- | OpenSim/Tests/Common/Mock/MockScriptEngine.cs | 57 |
1 files changed, 51 insertions, 6 deletions
diff --git a/OpenSim/Tests/Common/Mock/MockScriptEngine.cs b/OpenSim/Tests/Common/Mock/MockScriptEngine.cs index 78bab5b..6a53fe7 100644 --- a/OpenSim/Tests/Common/Mock/MockScriptEngine.cs +++ b/OpenSim/Tests/Common/Mock/MockScriptEngine.cs | |||
@@ -40,10 +40,33 @@ namespace OpenSim.Tests.Common | |||
40 | { | 40 | { |
41 | public class MockScriptEngine : INonSharedRegionModule, IScriptModule, IScriptEngine | 41 | public class MockScriptEngine : INonSharedRegionModule, IScriptModule, IScriptEngine |
42 | { | 42 | { |
43 | public IConfigSource ConfigSource { get; private set; } | ||
44 | |||
45 | public IConfig Config { get; private set; } | ||
46 | |||
43 | private Scene m_scene; | 47 | private Scene m_scene; |
44 | 48 | ||
49 | /// <summary> | ||
50 | /// Expose posted events to tests. | ||
51 | /// </summary> | ||
52 | public Dictionary<UUID, List<EventParams>> PostedEvents { get; private set; } | ||
53 | |||
54 | /// <summary> | ||
55 | /// A very primitive way of hooking text cose to a posed event. | ||
56 | /// </summary> | ||
57 | /// <remarks> | ||
58 | /// May be replaced with something that uses more original code in the future. | ||
59 | /// </remarks> | ||
60 | public event Action<UUID, EventParams> PostEventHook; | ||
61 | |||
45 | public void Initialise(IConfigSource source) | 62 | public void Initialise(IConfigSource source) |
46 | { | 63 | { |
64 | ConfigSource = source; | ||
65 | |||
66 | // Can set later on if required | ||
67 | Config = new IniConfig("MockScriptEngine", ConfigSource); | ||
68 | |||
69 | PostedEvents = new Dictionary<UUID, List<EventParams>>(); | ||
47 | } | 70 | } |
48 | 71 | ||
49 | public void Close() | 72 | public void Close() |
@@ -85,7 +108,28 @@ namespace OpenSim.Tests.Common | |||
85 | 108 | ||
86 | public bool PostScriptEvent(UUID itemID, string name, object[] args) | 109 | public bool PostScriptEvent(UUID itemID, string name, object[] args) |
87 | { | 110 | { |
88 | return false; | 111 | // Console.WriteLine("Posting event {0} for {1}", name, itemID); |
112 | |||
113 | EventParams evParams = new EventParams(name, args, null); | ||
114 | |||
115 | List<EventParams> eventsForItem; | ||
116 | |||
117 | if (!PostedEvents.ContainsKey(itemID)) | ||
118 | { | ||
119 | eventsForItem = new List<EventParams>(); | ||
120 | PostedEvents.Add(itemID, eventsForItem); | ||
121 | } | ||
122 | else | ||
123 | { | ||
124 | eventsForItem = PostedEvents[itemID]; | ||
125 | } | ||
126 | |||
127 | eventsForItem.Add(evParams); | ||
128 | |||
129 | if (PostEventHook != null) | ||
130 | PostEventHook(itemID, evParams); | ||
131 | |||
132 | return true; | ||
89 | } | 133 | } |
90 | 134 | ||
91 | public bool PostObjectEvent(UUID itemID, string name, object[] args) | 135 | public bool PostObjectEvent(UUID itemID, string name, object[] args) |
@@ -195,11 +239,7 @@ namespace OpenSim.Tests.Common | |||
195 | 239 | ||
196 | public Scene World { get { return m_scene; } } | 240 | public Scene World { get { return m_scene; } } |
197 | 241 | ||
198 | public IScriptModule ScriptModule { get { throw new System.NotImplementedException(); } } | 242 | public IScriptModule ScriptModule { get { return this; } } |
199 | |||
200 | public IConfig Config { get { throw new System.NotImplementedException (); } } | ||
201 | |||
202 | public IConfigSource ConfigSource { get { throw new System.NotImplementedException (); } } | ||
203 | 243 | ||
204 | public string ScriptEnginePath { get { throw new System.NotImplementedException (); }} | 244 | public string ScriptEnginePath { get { throw new System.NotImplementedException (); }} |
205 | 245 | ||
@@ -210,5 +250,10 @@ namespace OpenSim.Tests.Common | |||
210 | public string[] ScriptReferencedAssemblies { get { throw new System.NotImplementedException (); } } | 250 | public string[] ScriptReferencedAssemblies { get { throw new System.NotImplementedException (); } } |
211 | 251 | ||
212 | public ParameterInfo[] ScriptBaseClassParameters { get { throw new System.NotImplementedException (); } } | 252 | public ParameterInfo[] ScriptBaseClassParameters { get { throw new System.NotImplementedException (); } } |
253 | |||
254 | public void ClearPostedEvents() | ||
255 | { | ||
256 | PostedEvents.Clear(); | ||
257 | } | ||
213 | } | 258 | } |
214 | } \ No newline at end of file | 259 | } \ No newline at end of file |