29 using System.Collections.Generic;
30 using System.Threading;
32 using NUnit.Framework;
34 using OpenSim.Framework;
35 using OpenSim.Region.CoreModules.Scripting.WorldComm;
36 using OpenSim.Region.Framework.Scenes;
37 using OpenSim.Region.Framework.Interfaces;
38 using OpenSim.Tests.Common;
50 private AutoResetEvent m_chatEvent =
new AutoResetEvent(
false);
60 IniConfigSource configSource =
new IniConfigSource();
62 IConfig startupConfig = configSource.AddConfig(
"Startup");
63 startupConfig.Set(
"DefaultScriptEngine",
"XEngine");
65 IConfig xEngineConfig = configSource.AddConfig(
"XEngine");
66 xEngineConfig.Set(
"Enabled",
"true");
67 xEngineConfig.Set(
"StartDelay",
"0");
71 xEngineConfig.Set(
"AppDomainLoading",
"false");
73 m_scene =
new SceneHelpers().SetupScene(
"My Test", UUID.Random(), 1000, 1000, configSource);
74 SceneHelpers.SetupSceneModules(m_scene, configSource, m_xEngine);
75 m_scene.StartScripts();
88 TestHelpers.InMethod();
89 TestHelpers.EnableLogging();
91 UUID userId = TestHelpers.ParseTail(0x1);
94 string itemName =
"TestStartScript() Item";
96 SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, userId,
"TestStartScriptPart_", 0x100);
97 m_scene.AddNewSceneObject(so,
true);
101 itemTemplate.Name = itemName;
102 itemTemplate.Folder = so.UUID;
103 itemTemplate.InvType = (int)InventoryType.LSL;
105 m_scene.EventManager.OnChatFromWorld += OnChatFromWorld;
107 SceneObjectPart partWhereRezzed = m_scene.RezNewScript(userId, itemTemplate);
109 m_chatEvent.WaitOne(60000);
111 Assert.That(m_osChatMessageReceived, Is.Not.Null,
"No chat message received in TestStartScript()");
112 Assert.That(m_osChatMessageReceived.Message, Is.EqualTo(
"Script running"));
115 TaskInventoryItem scriptItem = partWhereRezzed.Inventory.GetInventoryItem(itemName);
117 SceneObjectPartInventory.TryGetScriptInstanceRunning(m_scene, scriptItem, out running), Is.True);
118 Assert.That(running, Is.True);
121 private void OnChatFromWorld(
object sender,
OSChatMessage oscm)
125 m_osChatMessageReceived = oscm;
A scene object group is conceptually an object in the scene. The object is constituted of SceneObject...
Represents an item in a task inventory
void TestCompileAndStartScript()
Test compilation and starting of a script.
Inventory Item - contains all the properties associated with an individual inventory piece...
Helpers for setting up scenes.
Interactive OpenSim region server