From 134f86e8d5c414409631b25b8c6f0ee45fbd8631 Mon Sep 17 00:00:00 2001
From: David Walter Seikel
Date: Thu, 3 Nov 2016 21:44:39 +1000
Subject: Initial update to OpenSim 0.8.2.1 source code.
---
.../XEngine/Api/Runtime/XEngineScriptBase.cs | 61 +++
.../Region/ScriptEngine/XEngine/EventManager.cs | 10 +-
.../XEngine/Properties/AssemblyInfo.cs | 7 +-
.../XEngine/Resources/XEngine.addin.xml | 13 -
.../XEngine/Tests/XEngineBasicTests.cs | 129 +++++
.../XEngine/Tests/XEngineCrossingTests.cs | 195 +++++++
.../XEngine/Tests/XEnginePersistenceTests.cs | 152 +++++
.../ScriptEngine/XEngine/Tests/XEngineTest.cs | 130 -----
OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 609 ++++++++++++++-------
OpenSim/Region/ScriptEngine/XEngine/XWorkItem.cs | 10 +-
10 files changed, 972 insertions(+), 344 deletions(-)
create mode 100644 OpenSim/Region/ScriptEngine/XEngine/Api/Runtime/XEngineScriptBase.cs
delete mode 100644 OpenSim/Region/ScriptEngine/XEngine/Resources/XEngine.addin.xml
create mode 100644 OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineBasicTests.cs
create mode 100644 OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineCrossingTests.cs
create mode 100644 OpenSim/Region/ScriptEngine/XEngine/Tests/XEnginePersistenceTests.cs
delete mode 100644 OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineTest.cs
mode change 100644 => 100755 OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
(limited to 'OpenSim/Region/ScriptEngine/XEngine')
diff --git a/OpenSim/Region/ScriptEngine/XEngine/Api/Runtime/XEngineScriptBase.cs b/OpenSim/Region/ScriptEngine/XEngine/Api/Runtime/XEngineScriptBase.cs
new file mode 100644
index 0000000..f4211c8
--- /dev/null
+++ b/OpenSim/Region/ScriptEngine/XEngine/Api/Runtime/XEngineScriptBase.cs
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) Contributors, http://opensimulator.org/
+ * See CONTRIBUTORS.TXT for a full list of copyright holders.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the OpenSimulator Project nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+using System;
+using System.Runtime.Remoting;
+using System.Runtime.Remoting.Lifetime;
+using System.Security.Permissions;
+using System.Threading;
+using System.Reflection;
+using System.Collections;
+using System.Collections.Generic;
+using OpenSim.Region.ScriptEngine.Interfaces;
+using OpenSim.Region.ScriptEngine.Shared;
+using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
+
+namespace OpenSim.Region.ScriptEngine.XEngine.ScriptBase
+{
+ public class XEngineScriptBase : ScriptBaseClass
+ {
+ ///
+ /// Used for script sleeps when we are using co-operative script termination.
+ ///
+ /// null if co-operative script termination is not active
+ WaitHandle m_coopSleepHandle;
+
+ public XEngineScriptBase(WaitHandle coopSleepHandle) : base()
+ {
+ m_coopSleepHandle = coopSleepHandle;
+ }
+
+ public void opensim_reserved_CheckForCoopTermination()
+ {
+ if (m_coopSleepHandle != null && m_coopSleepHandle.WaitOne(0))
+ throw new ScriptCoopStopException();
+ }
+ }
+}
\ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs
index 9405075..0ff2da3 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs
@@ -52,7 +52,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
{
myScriptEngine = _ScriptEngine;
- m_log.Info("[XEngine] Hooking up to server events");
+// m_log.Info("[XEngine] Hooking up to server events");
myScriptEngine.World.EventManager.OnAttach += attach;
myScriptEngine.World.EventManager.OnObjectGrab += touch_start;
myScriptEngine.World.EventManager.OnObjectGrabbing += touch;
@@ -62,6 +62,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
myScriptEngine.World.EventManager.OnScriptNotAtTargetEvent += not_at_target;
myScriptEngine.World.EventManager.OnScriptAtRotTargetEvent += at_rot_target;
myScriptEngine.World.EventManager.OnScriptNotAtRotTargetEvent += not_at_rot_target;
+ myScriptEngine.World.EventManager.OnScriptMovingStartEvent += moving_start;
+ myScriptEngine.World.EventManager.OnScriptMovingEndEvent += moving_end;
myScriptEngine.World.EventManager.OnScriptControlEvent += control;
myScriptEngine.World.EventManager.OnScriptColliderStart += collision_start;
myScriptEngine.World.EventManager.OnScriptColliding += collision;
@@ -69,7 +71,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
myScriptEngine.World.EventManager.OnScriptLandColliderStart += land_collision_start;
myScriptEngine.World.EventManager.OnScriptLandColliding += land_collision;
myScriptEngine.World.EventManager.OnScriptLandColliderEnd += land_collision_end;
- IMoneyModule money=myScriptEngine.World.RequestModuleInterface();
+ IMoneyModule money = myScriptEngine.World.RequestModuleInterface();
if (money != null)
{
money.OnObjectPaid+=HandleObjectPaid;
@@ -419,14 +421,14 @@ namespace OpenSim.Region.ScriptEngine.XEngine
// dataserver: not handled here
// link_message: not handled here
- public void moving_start(uint localID, UUID itemID)
+ public void moving_start(uint localID)
{
myScriptEngine.PostObjectEvent(localID, new EventParams(
"moving_start",new object[0],
new DetectParams[0]));
}
- public void moving_end(uint localID, UUID itemID)
+ public void moving_end(uint localID)
{
myScriptEngine.PostObjectEvent(localID, new EventParams(
"moving_end",new object[0],
diff --git a/OpenSim/Region/ScriptEngine/XEngine/Properties/AssemblyInfo.cs b/OpenSim/Region/ScriptEngine/XEngine/Properties/AssemblyInfo.cs
index bd26a8b..665929d 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/Properties/AssemblyInfo.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/Properties/AssemblyInfo.cs
@@ -1,6 +1,7 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
+using Mono.Addins;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
@@ -29,5 +30,7 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
-[assembly: AssemblyVersion("0.7.5.*")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
+[assembly: AssemblyVersion("0.8.3.*")]
+
+[assembly: Addin("OpenSim.Region.ScriptEngine.XEngine", OpenSim.VersionInfo.VersionNumber)]
+[assembly: AddinDependency("OpenSim.Region.Framework", OpenSim.VersionInfo.VersionNumber)]
diff --git a/OpenSim/Region/ScriptEngine/XEngine/Resources/XEngine.addin.xml b/OpenSim/Region/ScriptEngine/XEngine/Resources/XEngine.addin.xml
deleted file mode 100644
index 96c9c3a..0000000
--- a/OpenSim/Region/ScriptEngine/XEngine/Resources/XEngine.addin.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineBasicTests.cs b/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineBasicTests.cs
new file mode 100644
index 0000000..878e571
--- /dev/null
+++ b/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineBasicTests.cs
@@ -0,0 +1,129 @@
+/*
+ * Copyright (c) Contributors, http://opensimulator.org/
+ * See CONTRIBUTORS.TXT for a full list of copyright holders.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the OpenSimulator Project nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Threading;
+using Nini.Config;
+using NUnit.Framework;
+using OpenMetaverse;
+using OpenSim.Framework;
+using OpenSim.Region.CoreModules.Scripting.WorldComm;
+using OpenSim.Region.Framework.Scenes;
+using OpenSim.Region.Framework.Interfaces;
+using OpenSim.Tests.Common;
+
+namespace OpenSim.Region.ScriptEngine.XEngine.Tests
+{
+ ///
+ /// Basic XEngine tests.
+ ///
+ [TestFixture]
+ public class XEngineBasicTests : OpenSimTestCase
+ {
+ private TestScene m_scene;
+ private XEngine m_xEngine;
+ private AutoResetEvent m_chatEvent = new AutoResetEvent(false);
+ private OSChatMessage m_osChatMessageReceived;
+
+ [TestFixtureSetUp]
+ public void Init()
+ {
+ //AppDomain.CurrentDomain.SetData("APPBASE", Environment.CurrentDirectory + "/bin");
+// Console.WriteLine(AppDomain.CurrentDomain.BaseDirectory);
+ m_xEngine = new XEngine();
+
+ IniConfigSource configSource = new IniConfigSource();
+
+ IConfig startupConfig = configSource.AddConfig("Startup");
+ startupConfig.Set("DefaultScriptEngine", "XEngine");
+
+ IConfig xEngineConfig = configSource.AddConfig("XEngine");
+ xEngineConfig.Set("Enabled", "true");
+ xEngineConfig.Set("StartDelay", "0");
+
+ // These tests will not run with AppDomainLoading = true, at least on mono. For unknown reasons, the call
+ // to AssemblyResolver.OnAssemblyResolve fails.
+ xEngineConfig.Set("AppDomainLoading", "false");
+
+ m_scene = new SceneHelpers().SetupScene("My Test", UUID.Random(), 1000, 1000, configSource);
+ SceneHelpers.SetupSceneModules(m_scene, configSource, m_xEngine);
+ m_scene.StartScripts();
+ }
+
+ ///
+ /// Test compilation and starting of a script.
+ ///
+ ///
+ /// This is a less than ideal regression test since it involves an asynchronous operation (in this case,
+ /// compilation of the script).
+ ///
+ [Test]
+ public void TestCompileAndStartScript()
+ {
+ TestHelpers.InMethod();
+ TestHelpers.EnableLogging();
+
+ UUID userId = TestHelpers.ParseTail(0x1);
+// UUID objectId = TestHelpers.ParseTail(0x100);
+// UUID itemId = TestHelpers.ParseTail(0x3);
+ string itemName = "TestStartScript() Item";
+
+ SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, userId, "TestStartScriptPart_", 0x100);
+ m_scene.AddNewSceneObject(so, true);
+
+ InventoryItemBase itemTemplate = new InventoryItemBase();
+// itemTemplate.ID = itemId;
+ itemTemplate.Name = itemName;
+ itemTemplate.Folder = so.UUID;
+ itemTemplate.InvType = (int)InventoryType.LSL;
+
+ m_scene.EventManager.OnChatFromWorld += OnChatFromWorld;
+
+ SceneObjectPart partWhereRezzed = m_scene.RezNewScript(userId, itemTemplate);
+
+ m_chatEvent.WaitOne(60000);
+
+ Assert.That(m_osChatMessageReceived, Is.Not.Null, "No chat message received in TestStartScript()");
+ Assert.That(m_osChatMessageReceived.Message, Is.EqualTo("Script running"));
+
+ bool running;
+ TaskInventoryItem scriptItem = partWhereRezzed.Inventory.GetInventoryItem(itemName);
+ Assert.That(
+ SceneObjectPartInventory.TryGetScriptInstanceRunning(m_scene, scriptItem, out running), Is.True);
+ Assert.That(running, Is.True);
+ }
+
+ private void OnChatFromWorld(object sender, OSChatMessage oscm)
+ {
+// Console.WriteLine("Got chat [{0}]", oscm.Message);
+
+ m_osChatMessageReceived = oscm;
+ m_chatEvent.Set();
+ }
+ }
+}
\ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineCrossingTests.cs b/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineCrossingTests.cs
new file mode 100644
index 0000000..587695f
--- /dev/null
+++ b/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineCrossingTests.cs
@@ -0,0 +1,195 @@
+/*
+ * Copyright (c) Contributors, http://opensimulator.org/
+ * See CONTRIBUTORS.TXT for a full list of copyright holders.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the OpenSimulator Project nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+using System;
+using System.Threading;
+using Nini.Config;
+using NUnit.Framework;
+using OpenMetaverse;
+using OpenSim.Framework;
+using OpenSim.Region.CoreModules.Framework.EntityTransfer;
+using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
+using OpenSim.Region.Framework.Scenes;
+using OpenSim.Region.ScriptEngine.Shared;
+using OpenSim.Tests.Common;
+
+namespace OpenSim.Region.ScriptEngine.XEngine.Tests
+{
+ ///
+ /// XEngine tests connected with crossing scripts between regions.
+ ///
+ [TestFixture]
+ public class XEngineCrossingTests : OpenSimTestCase
+ {
+ [TestFixtureSetUp]
+ public void FixtureInit()
+ {
+ // Don't allow tests to be bamboozled by asynchronous events. Execute everything on the same thread.
+ Util.FireAndForgetMethod = FireAndForgetMethod.RegressionTest;
+ }
+
+ [TestFixtureTearDown]
+ public void TearDown()
+ {
+ // We must set this back afterwards, otherwise later tests will fail since they're expecting multiple
+ // threads. Possibly, later tests should be rewritten so none of them require async stuff (which regression
+ // tests really shouldn't).
+ Util.FireAndForgetMethod = Util.DefaultFireAndForgetMethod;
+ }
+
+ ///
+ /// Test script state preservation when a script crosses between regions on the same simulator.
+ ///
+ [Test]
+ public void TestScriptCrossOnSameSimulator()
+ {
+ TestHelpers.InMethod();
+// TestHelpers.EnableLogging();
+
+ UUID userId = TestHelpers.ParseTail(0x1);
+ int sceneObjectIdTail = 0x2;
+
+ EntityTransferModule etmA = new EntityTransferModule();
+ EntityTransferModule etmB = new EntityTransferModule();
+ LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule();
+ XEngine xEngineA = new XEngine();
+ XEngine xEngineB = new XEngine();
+ xEngineA.DebugLevel = 1;
+ xEngineB.DebugLevel = 1;
+
+ IConfigSource configSource = new IniConfigSource();
+
+ IConfig startupConfig = configSource.AddConfig("Startup");
+ startupConfig.Set("DefaultScriptEngine", "XEngine");
+
+ IConfig xEngineConfig = configSource.AddConfig("XEngine");
+ xEngineConfig.Set("Enabled", "true");
+ xEngineConfig.Set("StartDelay", "0");
+
+ // These tests will not run with AppDomainLoading = true, at least on mono. For unknown reasons, the call
+ // to AssemblyResolver.OnAssemblyResolve fails.
+ xEngineConfig.Set("AppDomainLoading", "false");
+
+ IConfig modulesConfig = configSource.AddConfig("Modules");
+ modulesConfig.Set("EntityTransferModule", etmA.Name);
+ modulesConfig.Set("SimulationServices", lscm.Name);
+
+ SceneHelpers sh = new SceneHelpers();
+ TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000, configSource);
+ TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1000, 999, configSource);
+
+ SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, configSource, lscm);
+ SceneHelpers.SetupSceneModules(sceneA, configSource, etmA, xEngineA);
+ SceneHelpers.SetupSceneModules(sceneB, configSource, etmB, xEngineB);
+ sceneA.StartScripts();
+ sceneB.StartScripts();
+
+ SceneObjectGroup soSceneA = SceneHelpers.AddSceneObject(sceneA, 1, userId, "so1-", sceneObjectIdTail);
+ soSceneA.AbsolutePosition = new Vector3(128, 10, 20);
+
+ // CREATE SCRIPT TODO
+ InventoryItemBase scriptItemSceneA = new InventoryItemBase();
+ // itemTemplate.ID = itemId;
+ scriptItemSceneA.Name = "script1";
+ scriptItemSceneA.Folder = soSceneA.UUID;
+ scriptItemSceneA.InvType = (int)InventoryType.LSL;
+
+ AutoResetEvent chatEvent = new AutoResetEvent(false);
+ OSChatMessage messageReceived = null;
+ sceneA.EventManager.OnChatFromWorld += (s, m) => { messageReceived = m; chatEvent.Set(); };
+
+ sceneA.RezNewScript(userId, scriptItemSceneA,
+@"integer c = 0;
+
+default
+{
+ state_entry()
+ {
+ llSay(0, ""Script running"");
+ }
+
+ changed(integer change)
+ {
+ llSay(0, ""Changed"");
+ }
+
+ touch_start(integer n)
+ {
+ c = c + 1;
+ llSay(0, (string)c);
+ }
+}");
+
+ chatEvent.WaitOne(60000);
+
+ Assert.That(messageReceived, Is.Not.Null, "No chat message received.");
+ Assert.That(messageReceived.Message, Is.EqualTo("Script running"));
+
+ {
+ // XXX: Should not be doing this so directly. Should call some variant of EventManager.touch() instead.
+ DetectParams[] det = new DetectParams[1];
+ det[0] = new DetectParams();
+ det[0].Key = userId;
+ det[0].Populate(sceneA);
+
+ EventParams ep = new EventParams("touch_start", new Object[] { new LSL_Types.LSLInteger(1) }, det);
+
+ xEngineA.PostObjectEvent(soSceneA.LocalId, ep);
+ chatEvent.WaitOne(60000);
+
+ Assert.That(messageReceived.Message, Is.EqualTo("1"));
+ }
+
+ sceneB.EventManager.OnChatFromWorld += (s, m) => { messageReceived = m; chatEvent.Set(); };
+
+ // Cross with a negative value
+ soSceneA.AbsolutePosition = new Vector3(128, -10, 20);
+
+ chatEvent.WaitOne(60000);
+ Assert.That(messageReceived.Message, Is.EqualTo("Changed"));
+
+ // TEST sending event to moved prim and output
+ {
+ SceneObjectGroup soSceneB = sceneB.GetSceneObjectGroup(soSceneA.Name);
+ TaskInventoryItem scriptItemSceneB = soSceneB.RootPart.Inventory.GetInventoryItem(scriptItemSceneA.Name);
+
+ // XXX: Should not be doing this so directly. Should call some variant of EventManager.touch() instead.
+ DetectParams[] det = new DetectParams[1];
+ det[0] = new DetectParams();
+ det[0].Key = userId;
+ det[0].Populate(sceneB);
+
+ EventParams ep = new EventParams("touch_start", new Object[] { new LSL_Types.LSLInteger(1) }, det);
+
+ xEngineB.PostObjectEvent(soSceneB.LocalId, ep);
+ chatEvent.WaitOne(60000);
+
+ Assert.That(messageReceived.Message, Is.EqualTo("2"));
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/XEngine/Tests/XEnginePersistenceTests.cs b/OpenSim/Region/ScriptEngine/XEngine/Tests/XEnginePersistenceTests.cs
new file mode 100644
index 0000000..2ef4058
--- /dev/null
+++ b/OpenSim/Region/ScriptEngine/XEngine/Tests/XEnginePersistenceTests.cs
@@ -0,0 +1,152 @@
+/*
+ * Copyright (c) Contributors, http://opensimulator.org/
+ * See CONTRIBUTORS.TXT for a full list of copyright holders.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the OpenSimulator Project nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Threading;
+using Nini.Config;
+using NUnit.Framework;
+using OpenMetaverse;
+using OpenSim.Framework;
+using OpenSim.Region.CoreModules.Avatar.Attachments;
+using OpenSim.Region.CoreModules.Framework.InventoryAccess;
+using OpenSim.Region.Framework.Scenes;
+using OpenSim.Region.ScriptEngine.XEngine;
+using OpenSim.Services.Interfaces;
+using OpenSim.Tests.Common;
+
+namespace OpenSim.Region.ScriptEngine.Tests
+{
+ [TestFixture]
+ public class XEnginePersistenceTests : OpenSimTestCase
+ {
+ private AutoResetEvent m_chatEvent = new AutoResetEvent(false);
+
+ private void OnChatFromWorld(object sender, OSChatMessage oscm)
+ {
+ // Console.WriteLine("Got chat [{0}]", oscm.Message);
+
+ // m_osChatMessageReceived = oscm;
+ m_chatEvent.Set();
+ }
+
+ private void AddCommonConfig(IConfigSource config, List