29 using System.Threading;
31 using NUnit.Framework;
33 using OpenSim.Framework;
34 using OpenSim.Region.CoreModules.Framework.EntityTransfer;
35 using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
36 using OpenSim.Region.Framework.Scenes;
37 using OpenSim.Region.ScriptEngine.Shared;
38 using OpenSim.Tests.Common;
40 namespace OpenSim.
Region.ScriptEngine.XEngine.Tests
52 Util.FireAndForgetMethod = FireAndForgetMethod.RegressionTest;
61 Util.FireAndForgetMethod = Util.DefaultFireAndForgetMethod;
70 TestHelpers.InMethod();
73 UUID userId = TestHelpers.ParseTail(0x1);
74 int sceneObjectIdTail = 0x2;
81 xEngineA.DebugLevel = 1;
82 xEngineB.DebugLevel = 1;
84 IConfigSource configSource =
new IniConfigSource();
86 IConfig startupConfig = configSource.AddConfig(
"Startup");
87 startupConfig.Set(
"DefaultScriptEngine",
"XEngine");
88 startupConfig.Set(
"TrustBinaries",
"true");
90 IConfig xEngineConfig = configSource.AddConfig(
"XEngine");
91 xEngineConfig.Set(
"Enabled",
"true");
92 xEngineConfig.Set(
"StartDelay",
"0");
96 xEngineConfig.Set(
"AppDomainLoading",
"false");
98 IConfig modulesConfig = configSource.AddConfig(
"Modules");
99 modulesConfig.Set(
"EntityTransferModule", etmA.Name);
100 modulesConfig.Set(
"SimulationServices", lscm.Name);
103 TestScene sceneA = sh.SetupScene(
"sceneA", TestHelpers.ParseTail(0x100), 1000, 1000, configSource);
104 TestScene sceneB = sh.SetupScene(
"sceneB", TestHelpers.ParseTail(0x200), 1000, 999, configSource);
106 SceneHelpers.SetupSceneModules(
new Scene[] { sceneA, sceneB }, configSource, lscm);
107 SceneHelpers.SetupSceneModules(sceneA, configSource, etmA, xEngineA);
108 SceneHelpers.SetupSceneModules(sceneB, configSource, etmB, xEngineB);
109 sceneA.StartScripts();
110 sceneB.StartScripts();
112 SceneObjectGroup soSceneA = SceneHelpers.AddSceneObject(sceneA, 1, userId,
"so1-", sceneObjectIdTail);
113 soSceneA.AbsolutePosition =
new Vector3(128, 10, 20);
115 string soSceneAName = soSceneA.Name;
116 string scriptItemSceneAName =
"script1";
121 scriptItemSceneA.Name = scriptItemSceneAName;
122 scriptItemSceneA.Folder = soSceneA.UUID;
123 scriptItemSceneA.InvType = (int)InventoryType.LSL;
125 AutoResetEvent chatEvent =
new AutoResetEvent(
false);
127 sceneA.EventManager.OnChatFromWorld += (s, m) => { messageReceived = m; chatEvent.Set(); };
129 sceneA.RezNewScript(userId, scriptItemSceneA,
136 llSay(0, ""Script running"");
139 changed(integer change)
141 llSay(0, ""Changed"");
144 touch_start(integer n)
151 chatEvent.WaitOne(60000);
153 Assert.That(messageReceived, Is.Not.Null,
"No chat message received.");
154 Assert.That(messageReceived.Message, Is.EqualTo(
"Script running"));
161 det[0].Populate(sceneA);
165 messageReceived = null;
167 xEngineA.PostObjectEvent(soSceneA.LocalId, ep);
168 chatEvent.WaitOne(60000);
170 Assert.That(messageReceived.Message, Is.EqualTo(
"1"));
173 AutoResetEvent chatEventB =
new AutoResetEvent(
false);
174 sceneB.EventManager.OnChatFromWorld += (s, m) => { messageReceived = m; chatEventB.Set(); };
176 messageReceived = null;
179 soSceneA.AbsolutePosition =
new Vector3(128, -10, 20);
181 chatEventB.WaitOne(60000);
182 Assert.That(messageReceived, Is.Not.Null,
"No Changed message received.");
183 Assert.That(messageReceived.Message, Is.Not.Null,
"Changed message without content");
184 Assert.That(messageReceived.Message, Is.EqualTo(
"Changed"));
189 TaskInventoryItem scriptItemSceneB = soSceneB.RootPart.Inventory.GetInventoryItem(scriptItemSceneAName);
195 det[0].Populate(sceneB);
200 messageReceived = null;
202 xEngineB.PostObjectEvent(soSceneB.LocalId, ep);
203 chatEventB.WaitOne(60000);
205 Assert.That(messageReceived.Message, Is.EqualTo(
"2"));
A scene object group is conceptually an object in the scene. The object is constituted of SceneObject...
Represents an item in a task inventory
Inventory Item - contains all the properties associated with an individual inventory piece...
Helpers for setting up scenes.
Holds all the data required to execute a scripting event.
void TestScriptCrossOnSameSimulator()
Test script state preservation when a script crosses between regions on the same simulator.
XEngine tests connected with crossing scripts between regions.