aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/CoreModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs2
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs86
-rw-r--r--OpenSim/Tests/Common/Mock/MockScriptEngine.cs214
3 files changed, 301 insertions, 1 deletions
diff --git a/OpenSim/Region/CoreModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs b/OpenSim/Region/CoreModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs
index f6e1d39..6bf50d2 100644
--- a/OpenSim/Region/CoreModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs
@@ -41,7 +41,7 @@ using System.Linq.Expressions;
41namespace OpenSim.Region.CoreModules.Scripting.ScriptModuleComms 41namespace OpenSim.Region.CoreModules.Scripting.ScriptModuleComms
42{ 42{
43 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "ScriptModuleCommsModule")] 43 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "ScriptModuleCommsModule")]
44 class ScriptModuleCommsModule : INonSharedRegionModule, IScriptModuleComms 44 public class ScriptModuleCommsModule : INonSharedRegionModule, IScriptModuleComms
45 { 45 {
46 private static readonly ILog m_log = 46 private static readonly ILog m_log =
47 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 47 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs
new file mode 100644
index 0000000..4b6ddd6
--- /dev/null
+++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs
@@ -0,0 +1,86 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Reflection;
31using System.Text;
32using log4net;
33using Nini.Config;
34using NUnit.Framework;
35using OpenMetaverse;
36using OpenSim.Framework;
37using OpenSim.Region.CoreModules.Scripting.ScriptModuleComms;
38using OpenSim.Region.Framework.Scenes;
39using OpenSim.Region.ScriptEngine.Shared;
40using OpenSim.Region.ScriptEngine.Shared.Api;
41using OpenSim.Services.Interfaces;
42using OpenSim.Tests.Common;
43using OpenSim.Tests.Common.Mock;
44
45namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
46{
47 /// <summary>
48 /// Tests for inventory functions in LSL
49 /// </summary>
50 [TestFixture]
51 public class LSL_ApiInventoryTests : OpenSimTestCase
52 {
53 private Scene m_scene;
54 private MockScriptEngine m_engine;
55 private ScriptModuleCommsModule m_smcm;
56
57 [SetUp]
58 public override void SetUp()
59 {
60 base.SetUp();
61
62 IConfigSource configSource = new IniConfigSource();
63 IConfig jsonStoreConfig = configSource.AddConfig("JsonStore");
64 jsonStoreConfig.Set("Enabled", "true");
65
66 m_engine = new MockScriptEngine();
67 m_smcm = new ScriptModuleCommsModule();
68 JsonStoreModule jsm = new JsonStoreModule();
69 JsonStoreScriptModule jssm = new JsonStoreScriptModule();
70
71 m_scene = new SceneHelpers().SetupScene();
72 SceneHelpers.SetupSceneModules(m_scene, configSource, m_engine, m_smcm, jsm, jssm);
73 }
74
75 [Test]
76 public void TestJsonCreateStore()
77 {
78 TestHelpers.InMethod();
79// log4net.Config.XmlConfigurator.Configure();
80
81 UUID storeId = (UUID)m_smcm.InvokeOperation(UUID.Zero, UUID.Zero, "JsonCreateStore", new object[] { "{}" });
82
83 Assert.That(storeId, Is.Not.EqualTo(UUID.Zero));
84 }
85 }
86} \ No newline at end of file
diff --git a/OpenSim/Tests/Common/Mock/MockScriptEngine.cs b/OpenSim/Tests/Common/Mock/MockScriptEngine.cs
new file mode 100644
index 0000000..51f2712
--- /dev/null
+++ b/OpenSim/Tests/Common/Mock/MockScriptEngine.cs
@@ -0,0 +1,214 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections;
30using System.Collections.Generic;
31using System.Reflection;
32using Nini.Config;
33using OpenMetaverse;
34using OpenSim.Region.Framework.Interfaces;
35using OpenSim.Region.Framework.Scenes;
36using OpenSim.Region.ScriptEngine.Interfaces;
37using OpenSim.Region.ScriptEngine.Shared;
38
39namespace OpenSim.Tests.Common
40{
41 public class MockScriptEngine : INonSharedRegionModule, IScriptModule, IScriptEngine
42 {
43 private Scene m_scene;
44
45 public void Initialise(IConfigSource source)
46 {
47 }
48
49 public void Close()
50 {
51 }
52
53 public void AddRegion(Scene scene)
54 {
55 m_scene = scene;
56
57 m_scene.StackModuleInterface<IScriptModule>(this);
58 }
59
60 public void RemoveRegion(Scene scene)
61 {
62 }
63
64 public void RegionLoaded(Scene scene)
65 {
66 }
67
68 public string Name { get { return "Mock Script Engine"; } }
69 public string ScriptEngineName { get { return Name; } }
70
71 public Type ReplaceableInterface { get { return null; } }
72
73 public event ScriptRemoved OnScriptRemoved;
74 public event ObjectRemoved OnObjectRemoved;
75
76 public string GetXMLState (UUID itemID)
77 {
78 throw new System.NotImplementedException ();
79 }
80
81 public bool SetXMLState(UUID itemID, string xml)
82 {
83 throw new System.NotImplementedException ();
84 }
85
86 public bool PostScriptEvent(UUID itemID, string name, object[] args)
87 {
88 throw new System.NotImplementedException ();
89 }
90
91 public bool PostObjectEvent(UUID itemID, string name, object[] args)
92 {
93 throw new System.NotImplementedException ();
94 }
95
96 public void SuspendScript(UUID itemID)
97 {
98 throw new System.NotImplementedException ();
99 }
100
101 public void ResumeScript(UUID itemID)
102 {
103 throw new System.NotImplementedException ();
104 }
105
106 public ArrayList GetScriptErrors(UUID itemID)
107 {
108 throw new System.NotImplementedException ();
109 }
110
111 public bool HasScript(UUID itemID, out bool running)
112 {
113 throw new System.NotImplementedException ();
114 }
115
116 public bool GetScriptState(UUID itemID)
117 {
118 throw new System.NotImplementedException ();
119 }
120
121 public void SaveAllState()
122 {
123 throw new System.NotImplementedException ();
124 }
125
126 public void StartProcessing()
127 {
128 throw new System.NotImplementedException ();
129 }
130
131 public float GetScriptExecutionTime(List<UUID> itemIDs)
132 {
133 throw new System.NotImplementedException ();
134 }
135
136 public Dictionary<uint, float> GetObjectScriptsExecutionTimes()
137 {
138 throw new System.NotImplementedException ();
139 }
140
141 public IScriptWorkItem QueueEventHandler(object parms)
142 {
143 throw new System.NotImplementedException ();
144 }
145
146 public bool PostScriptEvent(UUID itemID,EventParams parms)
147 {
148 throw new System.NotImplementedException ();
149 }
150
151 public bool PostObjectEvent (uint localID, EventParams parms)
152 {
153 throw new System.NotImplementedException ();
154 }
155
156 public DetectParams GetDetectParams(UUID item, int number)
157 {
158 throw new System.NotImplementedException ();
159 }
160
161 public void SetMinEventDelay(UUID itemID, double delay)
162 {
163 throw new System.NotImplementedException ();
164 }
165
166 public int GetStartParameter(UUID itemID)
167 {
168 throw new System.NotImplementedException ();
169 }
170
171 public void SetScriptState(UUID itemID, bool state)
172 {
173 throw new System.NotImplementedException ();
174 }
175
176 public void SetState(UUID itemID, string newState)
177 {
178 throw new System.NotImplementedException ();
179 }
180
181 public void ApiResetScript(UUID itemID)
182 {
183 throw new System.NotImplementedException ();
184 }
185
186 public void ResetScript (UUID itemID)
187 {
188 throw new System.NotImplementedException ();
189 }
190
191 public IScriptApi GetApi(UUID itemID, string name)
192 {
193 throw new System.NotImplementedException ();
194 }
195
196 public Scene World { get { return m_scene; } }
197
198 public IScriptModule ScriptModule { get { throw new System.NotImplementedException(); } }
199
200 public IConfig Config { get { throw new System.NotImplementedException (); } }
201
202 public IConfigSource ConfigSource { get { throw new System.NotImplementedException (); } }
203
204 public string ScriptEnginePath { get { throw new System.NotImplementedException (); }}
205
206 public string ScriptClassName { get { throw new System.NotImplementedException (); } }
207
208 public string ScriptBaseClassName { get { throw new System.NotImplementedException (); } }
209
210 public string[] ScriptReferencedAssemblies { get { throw new System.NotImplementedException (); } }
211
212 public ParameterInfo[] ScriptBaseClassParameters { get { throw new System.NotImplementedException (); } }
213 }
214} \ No newline at end of file