29 using System.Collections.Generic;
30 using System.Threading;
32 using NUnit.Framework;
34 using OpenSim.Framework;
35 using OpenSim.Region.Framework.Scenes;
36 using OpenSim.Region.ScriptEngine.Shared.Api;
37 using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
38 using OpenSim.Services.Interfaces;
39 using OpenSim.Tests.Common;
41 namespace OpenSim.
Region.ScriptEngine.Shared.Tests
46 private Scene m_scene;
57 SceneHelpers.SetupSceneModules(m_scene, m_engine);
63 TestHelpers.InMethod();
66 UUID userId = TestHelpers.ParseTail(0x1);
68 UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(m_scene, userId);
71 TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene.AssetService, part);
74 apiGrp1.Initialize(m_engine, part, scriptItem);
77 apiGrp1.LlRequestAgentDataCacheTimeoutMs = 20000;
83 Assert.That(m_engine.PostedEvents.ContainsKey(scriptItem.ItemID));
85 List<EventParams> events = m_engine.PostedEvents[scriptItem.ItemID];
86 Assert.That(events.Count, Is.EqualTo(1));
88 Assert.That(eventParams.EventName, Is.EqualTo(
"dataserver"));
90 string data = eventParams.Params[1].ToString();
91 Assert.AreEqual(0, int.Parse(data));
93 m_engine.PostedEvents.Clear();
97 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, ua1);
102 Assert.That(m_engine.PostedEvents.ContainsKey(scriptItem.ItemID));
104 List<EventParams> events = m_engine.PostedEvents[scriptItem.ItemID];
105 Assert.That(events.Count, Is.EqualTo(1));
107 Assert.That(eventParams.EventName, Is.EqualTo(
"dataserver"));
109 string data = eventParams.Params[1].ToString();
110 Assert.AreEqual(0, int.Parse(data));
112 m_engine.PostedEvents.Clear();
115 apiGrp1.LlRequestAgentDataCacheTimeoutMs = 1;
118 Thread.Sleep(apiGrp1.LlRequestAgentDataCacheTimeoutMs + 1);
123 Assert.That(m_engine.PostedEvents.ContainsKey(scriptItem.ItemID));
125 List<EventParams> events = m_engine.PostedEvents[scriptItem.ItemID];
126 Assert.That(events.Count, Is.EqualTo(1));
128 Assert.That(eventParams.EventName, Is.EqualTo(
"dataserver"));
130 string data = eventParams.Params[1].ToString();
131 Assert.AreEqual(1, int.Parse(data));
133 m_engine.PostedEvents.Clear();
136 m_scene.CloseAgent(userId,
false);
138 Thread.Sleep(apiGrp1.LlRequestAgentDataCacheTimeoutMs + 1 + 1);
143 Assert.That(m_engine.PostedEvents.ContainsKey(scriptItem.ItemID));
145 List<EventParams> events = m_engine.PostedEvents[scriptItem.ItemID];
146 Assert.That(events.Count, Is.EqualTo(1));
148 Assert.That(eventParams.EventName, Is.EqualTo(
"dataserver"));
150 string data = eventParams.Params[1].ToString();
151 Assert.AreEqual(0, int.Parse(data));
153 m_engine.PostedEvents.Clear();
Contains all LSL ll-functions. This class will be in Default AppDomain.
Represents an item in a task inventory
void TestLlRequestAgentDataOnline()
Helpers for setting up scenes.
Holds all the data required to execute a scripting event.