diff options
author | Justin Clark-Casey (justincc) | 2012-07-11 21:43:35 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-07-11 21:43:35 +0100 |
commit | fc2456320646df66b95a06d4cd292c3b2385a8ea (patch) | |
tree | c1f7eaf2c679a9e7d039240146510ffc6a744cd1 /OpenSim | |
parent | Add regression TestRezScriptedAttachmentsFromInventory() though this currentl... (diff) | |
download | opensim-SC_OLD-fc2456320646df66b95a06d4cd292c3b2385a8ea.zip opensim-SC_OLD-fc2456320646df66b95a06d4cd292c3b2385a8ea.tar.gz opensim-SC_OLD-fc2456320646df66b95a06d4cd292c3b2385a8ea.tar.bz2 opensim-SC_OLD-fc2456320646df66b95a06d4cd292c3b2385a8ea.tar.xz |
Add regression TestDetachScriptedAttachmentToInventory()
This currently only does a relatively crude check for a ScriptState node in the serialized xml
Diffstat (limited to 'OpenSim')
8 files changed, 150 insertions, 32 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index efab6ed..64ee7e4 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -339,7 +339,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
339 | ShowAttachInUserInventory(sp, attachmentPt, newAttachmentItemID, group); | 339 | ShowAttachInUserInventory(sp, attachmentPt, newAttachmentItemID, group); |
340 | } | 340 | } |
341 | 341 | ||
342 | public ISceneEntity RezSingleAttachmentFromInventory(IScenePresence sp, UUID itemID, uint AttachmentPt) | 342 | public SceneObjectGroup RezSingleAttachmentFromInventory(IScenePresence sp, UUID itemID, uint AttachmentPt) |
343 | { | 343 | { |
344 | if (!Enabled) | 344 | if (!Enabled) |
345 | return null; | 345 | return null; |
@@ -527,6 +527,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
527 | /// </remarks> | 527 | /// </remarks> |
528 | /// <param name="sp"></param> | 528 | /// <param name="sp"></param> |
529 | /// <param name="grp"></param> | 529 | /// <param name="grp"></param> |
530 | /// <param name="saveAllScripted"></param> | ||
530 | private void UpdateKnownItem(IScenePresence sp, SceneObjectGroup grp, bool saveAllScripted) | 531 | private void UpdateKnownItem(IScenePresence sp, SceneObjectGroup grp, bool saveAllScripted) |
531 | { | 532 | { |
532 | // Saving attachments for NPCs messes them up for the real owner! | 533 | // Saving attachments for NPCs messes them up for the real owner! |
@@ -720,18 +721,23 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
720 | null, assetID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true, | 721 | null, assetID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true, |
721 | false, false, sp.UUID, true); | 722 | false, false, sp.UUID, true); |
722 | 723 | ||
723 | // m_log.DebugFormat( | ||
724 | // "[ATTACHMENTS MODULE]: Retrieved single object {0} for attachment to {1} on point {2}", | ||
725 | // objatt.Name, remoteClient.Name, AttachmentPt); | ||
726 | |||
727 | if (objatt != null) | 724 | if (objatt != null) |
728 | { | 725 | { |
726 | // m_log.DebugFormat( | ||
727 | // "[ATTACHMENTS MODULE]: Rezzed single object {0} for attachment to {1} on point {2} in {3}", | ||
728 | // objatt.Name, sp.Name, attachmentPt, m_scene.Name); | ||
729 | |||
729 | // HasGroupChanged is being set from within RezObject. Ideally it would be set by the caller. | 730 | // HasGroupChanged is being set from within RezObject. Ideally it would be set by the caller. |
730 | objatt.HasGroupChanged = false; | 731 | objatt.HasGroupChanged = false; |
731 | bool tainted = false; | 732 | bool tainted = false; |
732 | if (attachmentPt != 0 && attachmentPt != objatt.AttachmentPoint) | 733 | if (attachmentPt != 0 && attachmentPt != objatt.AttachmentPoint) |
733 | tainted = true; | 734 | tainted = true; |
734 | 735 | ||
736 | // FIXME: Detect whether it's really likely for AttachObject to throw an exception in the normal | ||
737 | // course of events. If not, then it's probably not worth trying to recover the situation | ||
738 | // since this is more likely to trigger further exceptions and confuse later debugging. If | ||
739 | // exceptions can be thrown in expected error conditions (not NREs) then make this consistent | ||
740 | // since other normal error conditions will simply return false instead. | ||
735 | // This will throw if the attachment fails | 741 | // This will throw if the attachment fails |
736 | try | 742 | try |
737 | { | 743 | { |
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs index 416aa6f..81e889d 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs | |||
@@ -31,6 +31,7 @@ using System.Reflection; | |||
31 | using System.Text; | 31 | using System.Text; |
32 | using System.Threading; | 32 | using System.Threading; |
33 | using System.Timers; | 33 | using System.Timers; |
34 | using System.Xml; | ||
34 | using Timer=System.Timers.Timer; | 35 | using Timer=System.Timers.Timer; |
35 | using Nini.Config; | 36 | using Nini.Config; |
36 | using NUnit.Framework; | 37 | using NUnit.Framework; |
@@ -41,10 +42,12 @@ using OpenSim.Region.CoreModules.Avatar.Attachments; | |||
41 | using OpenSim.Region.CoreModules.Framework; | 42 | using OpenSim.Region.CoreModules.Framework; |
42 | using OpenSim.Region.CoreModules.Framework.EntityTransfer; | 43 | using OpenSim.Region.CoreModules.Framework.EntityTransfer; |
43 | using OpenSim.Region.CoreModules.Framework.InventoryAccess; | 44 | using OpenSim.Region.CoreModules.Framework.InventoryAccess; |
44 | using OpenSim.Region.CoreModules.World.Serialiser; | 45 | using OpenSim.Region.CoreModules.Scripting.WorldComm; |
45 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; | 46 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; |
47 | using OpenSim.Region.CoreModules.World.Serialiser; | ||
46 | using OpenSim.Region.Framework.Scenes; | 48 | using OpenSim.Region.Framework.Scenes; |
47 | using OpenSim.Region.Framework.Interfaces; | 49 | using OpenSim.Region.Framework.Interfaces; |
50 | using OpenSim.Region.ScriptEngine.XEngine; | ||
48 | using OpenSim.Services.Interfaces; | 51 | using OpenSim.Services.Interfaces; |
49 | using OpenSim.Tests.Common; | 52 | using OpenSim.Tests.Common; |
50 | using OpenSim.Tests.Common.Mock; | 53 | using OpenSim.Tests.Common.Mock; |
@@ -57,6 +60,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
57 | [TestFixture] | 60 | [TestFixture] |
58 | public class AttachmentsModuleTests : OpenSimTestCase | 61 | public class AttachmentsModuleTests : OpenSimTestCase |
59 | { | 62 | { |
63 | private AutoResetEvent m_chatEvent = new AutoResetEvent(false); | ||
64 | private OSChatMessage m_osChatMessageReceived; | ||
65 | |||
60 | [TestFixtureSetUp] | 66 | [TestFixtureSetUp] |
61 | public void FixtureInit() | 67 | public void FixtureInit() |
62 | { | 68 | { |
@@ -72,16 +78,73 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
72 | Util.FireAndForgetMethod = Util.DefaultFireAndForgetMethod; | 78 | Util.FireAndForgetMethod = Util.DefaultFireAndForgetMethod; |
73 | } | 79 | } |
74 | 80 | ||
75 | private Scene CreateDefaultTestScene() | 81 | private void OnChatFromWorld(object sender, OSChatMessage oscm) |
82 | { | ||
83 | // Console.WriteLine("Got chat [{0}]", oscm.Message); | ||
84 | |||
85 | m_osChatMessageReceived = oscm; | ||
86 | m_chatEvent.Set(); | ||
87 | } | ||
88 | |||
89 | private Scene CreateTestScene() | ||
90 | { | ||
91 | IConfigSource config = new IniConfigSource(); | ||
92 | List<object> modules = new List<object>(); | ||
93 | |||
94 | AddCommonConfig(config, modules); | ||
95 | |||
96 | Scene scene | ||
97 | = new SceneHelpers().SetupScene( | ||
98 | "attachments-test-scene", TestHelpers.ParseTail(999), 1000, 1000, config); | ||
99 | SceneHelpers.SetupSceneModules(scene, config, modules.ToArray()); | ||
100 | |||
101 | return scene; | ||
102 | } | ||
103 | |||
104 | private Scene CreateScriptingEnabledTestScene() | ||
76 | { | 105 | { |
77 | IConfigSource config = new IniConfigSource(); | 106 | IConfigSource config = new IniConfigSource(); |
107 | List<object> modules = new List<object>(); | ||
108 | |||
109 | AddCommonConfig(config, modules); | ||
110 | AddScriptingConfig(config, modules); | ||
111 | |||
112 | Scene scene | ||
113 | = new SceneHelpers().SetupScene( | ||
114 | "attachments-test-scene", TestHelpers.ParseTail(999), 1000, 1000, config); | ||
115 | SceneHelpers.SetupSceneModules(scene, config, modules.ToArray()); | ||
116 | |||
117 | scene.StartScripts(); | ||
118 | |||
119 | return scene; | ||
120 | } | ||
121 | |||
122 | private void AddCommonConfig(IConfigSource config, List<object> modules) | ||
123 | { | ||
78 | config.AddConfig("Modules"); | 124 | config.AddConfig("Modules"); |
79 | config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule"); | 125 | config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule"); |
80 | 126 | ||
81 | Scene scene = new SceneHelpers().SetupScene(); | 127 | modules.Add(new AttachmentsModule()); |
82 | SceneHelpers.SetupSceneModules(scene, config, new AttachmentsModule(), new BasicInventoryAccessModule()); | 128 | modules.Add(new BasicInventoryAccessModule()); |
129 | } | ||
83 | 130 | ||
84 | return scene; | 131 | private void AddScriptingConfig(IConfigSource config, List<object> modules) |
132 | { | ||
133 | IConfig startupConfig = config.AddConfig("Startup"); | ||
134 | startupConfig.Set("DefaultScriptEngine", "XEngine"); | ||
135 | |||
136 | IConfig xEngineConfig = config.AddConfig("XEngine"); | ||
137 | xEngineConfig.Set("Enabled", "true"); | ||
138 | |||
139 | // These tests will not run with AppDomainLoading = true, at least on mono. For unknown reasons, the call | ||
140 | // to AssemblyResolver.OnAssemblyResolve fails. | ||
141 | xEngineConfig.Set("AppDomainLoading", "false"); | ||
142 | |||
143 | modules.Add(new XEngine()); | ||
144 | |||
145 | // Necessary to stop serialization complaining | ||
146 | // FIXME: Stop this being necessary if at all possible | ||
147 | // modules.Add(new WorldCommModule()); | ||
85 | } | 148 | } |
86 | 149 | ||
87 | /// <summary> | 150 | /// <summary> |
@@ -116,7 +179,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
116 | TestHelpers.InMethod(); | 179 | TestHelpers.InMethod(); |
117 | // TestHelpers.EnableLogging(); | 180 | // TestHelpers.EnableLogging(); |
118 | 181 | ||
119 | Scene scene = CreateDefaultTestScene(); | 182 | Scene scene = CreateTestScene(); |
120 | UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1); | 183 | UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1); |
121 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, ua1); | 184 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, ua1); |
122 | 185 | ||
@@ -163,7 +226,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
163 | TestHelpers.InMethod(); | 226 | TestHelpers.InMethod(); |
164 | // TestHelpers.EnableLogging(); | 227 | // TestHelpers.EnableLogging(); |
165 | 228 | ||
166 | Scene scene = CreateDefaultTestScene(); | 229 | Scene scene = CreateTestScene(); |
167 | UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1); | 230 | UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1); |
168 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, ua1); | 231 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, ua1); |
169 | 232 | ||
@@ -190,7 +253,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
190 | TestHelpers.InMethod(); | 253 | TestHelpers.InMethod(); |
191 | // log4net.Config.XmlConfigurator.Configure(); | 254 | // log4net.Config.XmlConfigurator.Configure(); |
192 | 255 | ||
193 | Scene scene = CreateDefaultTestScene(); | 256 | Scene scene = CreateTestScene(); |
194 | UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1); | 257 | UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1); |
195 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, ua1.PrincipalID); | 258 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, ua1.PrincipalID); |
196 | 259 | ||
@@ -225,7 +288,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
225 | { | 288 | { |
226 | TestHelpers.InMethod(); | 289 | TestHelpers.InMethod(); |
227 | 290 | ||
228 | Scene scene = CreateDefaultTestScene(); | 291 | Scene scene = CreateTestScene(); |
229 | UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1); | 292 | UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1); |
230 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, ua1.PrincipalID); | 293 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, ua1.PrincipalID); |
231 | 294 | ||
@@ -248,7 +311,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
248 | TestHelpers.InMethod(); | 311 | TestHelpers.InMethod(); |
249 | // log4net.Config.XmlConfigurator.Configure(); | 312 | // log4net.Config.XmlConfigurator.Configure(); |
250 | 313 | ||
251 | Scene scene = CreateDefaultTestScene(); | 314 | Scene scene = CreateTestScene(); |
252 | UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1); | 315 | UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1); |
253 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, ua1.PrincipalID); | 316 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, ua1.PrincipalID); |
254 | 317 | ||
@@ -278,9 +341,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
278 | public void TestDetachAttachmentToInventory() | 341 | public void TestDetachAttachmentToInventory() |
279 | { | 342 | { |
280 | TestHelpers.InMethod(); | 343 | TestHelpers.InMethod(); |
281 | // log4net.Config.XmlConfigurator.Configure(); | ||
282 | 344 | ||
283 | Scene scene = CreateDefaultTestScene(); | 345 | Scene scene = CreateTestScene(); |
284 | UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1); | 346 | UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1); |
285 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, ua1.PrincipalID); | 347 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, ua1.PrincipalID); |
286 | 348 | ||
@@ -303,6 +365,45 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
303 | } | 365 | } |
304 | 366 | ||
305 | /// <summary> | 367 | /// <summary> |
368 | /// Test specific conditions associated with detaching a scripted attachment from inventory. | ||
369 | /// </summary> | ||
370 | [Test] | ||
371 | public void TestDetachScriptedAttachmentToInventory() | ||
372 | { | ||
373 | TestHelpers.InMethod(); | ||
374 | TestHelpers.EnableLogging(); | ||
375 | |||
376 | Scene scene = CreateScriptingEnabledTestScene(); | ||
377 | UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1); | ||
378 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, ua1); | ||
379 | |||
380 | SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, sp.UUID, "att-name", 0x10); | ||
381 | TaskInventoryHelpers.AddScript(scene, so.RootPart); | ||
382 | InventoryItemBase userItem = UserInventoryHelpers.AddInventoryItem(scene, so, 0x100, 0x1000); | ||
383 | |||
384 | // FIXME: Right now, we have to do a tricksy chat listen to make sure we know when the script is running. | ||
385 | // In the future, we need to be able to do this programatically more predicably. | ||
386 | scene.EventManager.OnChatFromWorld += OnChatFromWorld; | ||
387 | |||
388 | SceneObjectGroup soRezzed | ||
389 | = scene.AttachmentsModule.RezSingleAttachmentFromInventory(sp, userItem.ID, (uint)AttachmentPoint.Chest); | ||
390 | |||
391 | // Wait for chat to signal rezzed script has been started. | ||
392 | m_chatEvent.WaitOne(60000); | ||
393 | |||
394 | scene.AttachmentsModule.DetachSingleAttachmentToInv(sp, soRezzed); | ||
395 | |||
396 | InventoryItemBase userItemUpdated = scene.InventoryService.GetItem(userItem); | ||
397 | AssetBase asset = scene.AssetService.Get(userItemUpdated.AssetID.ToString()); | ||
398 | |||
399 | XmlDocument soXml = new XmlDocument(); | ||
400 | soXml.LoadXml(Encoding.UTF8.GetString(asset.Data)); | ||
401 | |||
402 | XmlNodeList scriptStateNodes = soXml.GetElementsByTagName("ScriptState"); | ||
403 | Assert.That(scriptStateNodes.Count, Is.EqualTo(1)); | ||
404 | } | ||
405 | |||
406 | /// <summary> | ||
306 | /// Test that attachments don't hang about in the scene when the agent is closed | 407 | /// Test that attachments don't hang about in the scene when the agent is closed |
307 | /// </summary> | 408 | /// </summary> |
308 | [Test] | 409 | [Test] |
@@ -311,7 +412,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
311 | TestHelpers.InMethod(); | 412 | TestHelpers.InMethod(); |
312 | // log4net.Config.XmlConfigurator.Configure(); | 413 | // log4net.Config.XmlConfigurator.Configure(); |
313 | 414 | ||
314 | Scene scene = CreateDefaultTestScene(); | 415 | Scene scene = CreateTestScene(); |
315 | UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1); | 416 | UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1); |
316 | InventoryItemBase attItem = CreateAttachmentItem(scene, ua1.PrincipalID, "att", 0x10, 0x20); | 417 | InventoryItemBase attItem = CreateAttachmentItem(scene, ua1.PrincipalID, "att", 0x10, 0x20); |
317 | 418 | ||
@@ -334,7 +435,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
334 | TestHelpers.InMethod(); | 435 | TestHelpers.InMethod(); |
335 | // log4net.Config.XmlConfigurator.Configure(); | 436 | // log4net.Config.XmlConfigurator.Configure(); |
336 | 437 | ||
337 | Scene scene = CreateDefaultTestScene(); | 438 | Scene scene = CreateTestScene(); |
338 | UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1); | 439 | UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1); |
339 | InventoryItemBase attItem = CreateAttachmentItem(scene, ua1.PrincipalID, "att", 0x10, 0x20); | 440 | InventoryItemBase attItem = CreateAttachmentItem(scene, ua1.PrincipalID, "att", 0x10, 0x20); |
340 | 441 | ||
@@ -370,7 +471,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
370 | { | 471 | { |
371 | TestHelpers.InMethod(); | 472 | TestHelpers.InMethod(); |
372 | 473 | ||
373 | Scene scene = CreateDefaultTestScene(); | 474 | Scene scene = CreateTestScene(); |
374 | UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1); | 475 | UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1); |
375 | InventoryItemBase attItem = CreateAttachmentItem(scene, ua1.PrincipalID, "att", 0x10, 0x20); | 476 | InventoryItemBase attItem = CreateAttachmentItem(scene, ua1.PrincipalID, "att", 0x10, 0x20); |
376 | 477 | ||
diff --git a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs index ba35a41..351e603 100644 --- a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs | |||
@@ -92,7 +92,7 @@ namespace OpenSim.Region.Framework.Interfaces | |||
92 | /// <param name="itemID"></param> | 92 | /// <param name="itemID"></param> |
93 | /// <param name="AttachmentPt"></param> | 93 | /// <param name="AttachmentPt"></param> |
94 | /// <returns>The scene object that was attached. Null if the scene object could not be found</returns> | 94 | /// <returns>The scene object that was attached. Null if the scene object could not be found</returns> |
95 | ISceneEntity RezSingleAttachmentFromInventory(IScenePresence sp, UUID itemID, uint AttachmentPt); | 95 | SceneObjectGroup RezSingleAttachmentFromInventory(IScenePresence sp, UUID itemID, uint AttachmentPt); |
96 | 96 | ||
97 | /// <summary> | 97 | /// <summary> |
98 | /// Rez multiple attachments from a user's inventory | 98 | /// Rez multiple attachments from a user's inventory |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index cf2ed1a..821fd81 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | |||
@@ -1295,6 +1295,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1295 | { | 1295 | { |
1296 | if (e != null) | 1296 | if (e != null) |
1297 | { | 1297 | { |
1298 | // m_log.DebugFormat( | ||
1299 | // "[PRIM INVENTORY]: Getting script state from engine {0} for {1} in part {2} in group {3} in {4}", | ||
1300 | // e.Name, item.Name, m_part.Name, m_part.ParentGroup.Name, m_part.ParentGroup.Scene.Name); | ||
1301 | |||
1298 | string n = e.GetXMLState(item.ItemID); | 1302 | string n = e.GetXMLState(item.ItemID); |
1299 | if (n != String.Empty) | 1303 | if (n != String.Empty) |
1300 | { | 1304 | { |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs index 993d10f..5b22860 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs | |||
@@ -233,17 +233,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
233 | m_Timer[engine].UnSetTimerEvents(localID, itemID); | 233 | m_Timer[engine].UnSetTimerEvents(localID, itemID); |
234 | 234 | ||
235 | // Remove from: HttpRequest | 235 | // Remove from: HttpRequest |
236 | IHttpRequestModule iHttpReq = | 236 | IHttpRequestModule iHttpReq = engine.World.RequestModuleInterface<IHttpRequestModule>(); |
237 | engine.World.RequestModuleInterface<IHttpRequestModule>(); | 237 | if (iHttpReq != null) |
238 | iHttpReq.StopHttpRequest(localID, itemID); | 238 | iHttpReq.StopHttpRequest(localID, itemID); |
239 | 239 | ||
240 | IWorldComm comms = engine.World.RequestModuleInterface<IWorldComm>(); | 240 | IWorldComm comms = engine.World.RequestModuleInterface<IWorldComm>(); |
241 | if (comms != null) | 241 | if (comms != null) |
242 | comms.DeleteListener(itemID); | 242 | comms.DeleteListener(itemID); |
243 | 243 | ||
244 | IXMLRPC xmlrpc = engine.World.RequestModuleInterface<IXMLRPC>(); | 244 | IXMLRPC xmlrpc = engine.World.RequestModuleInterface<IXMLRPC>(); |
245 | xmlrpc.DeleteChannels(itemID); | 245 | if (xmlrpc != null) |
246 | xmlrpc.CancelSRDRequests(itemID); | 246 | { |
247 | xmlrpc.DeleteChannels(itemID); | ||
248 | xmlrpc.CancelSRDRequests(itemID); | ||
249 | } | ||
247 | 250 | ||
248 | // Remove Sensors | 251 | // Remove Sensors |
249 | m_SensorRepeat[engine].UnSetSenseRepeaterEvents(localID, itemID); | 252 | m_SensorRepeat[engine].UnSetSenseRepeaterEvents(localID, itemID); |
@@ -305,7 +308,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
305 | { | 308 | { |
306 | List<Object> data = new List<Object>(); | 309 | List<Object> data = new List<Object>(); |
307 | 310 | ||
308 | Object[] listeners=m_Listener[engine].GetSerializationData(itemID); | 311 | Object[] listeners = m_Listener[engine].GetSerializationData(itemID); |
309 | if (listeners.Length > 0) | 312 | if (listeners.Length > 0) |
310 | { | 313 | { |
311 | data.Add("listener"); | 314 | data.Add("listener"); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Listener.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Listener.cs index 93e0261..efa86fc 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Listener.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Listener.cs | |||
@@ -88,13 +88,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
88 | 88 | ||
89 | public Object[] GetSerializationData(UUID itemID) | 89 | public Object[] GetSerializationData(UUID itemID) |
90 | { | 90 | { |
91 | return m_commsPlugin.GetSerializationData(itemID); | 91 | if (m_commsPlugin != null) |
92 | return m_commsPlugin.GetSerializationData(itemID); | ||
93 | else | ||
94 | return new Object[]{}; | ||
92 | } | 95 | } |
93 | 96 | ||
94 | public void CreateFromData(uint localID, UUID itemID, UUID hostID, | 97 | public void CreateFromData(uint localID, UUID itemID, UUID hostID, |
95 | Object[] data) | 98 | Object[] data) |
96 | { | 99 | { |
97 | m_commsPlugin.CreateFromData(localID, itemID, hostID, data); | 100 | if (m_commsPlugin != null) |
101 | m_commsPlugin.CreateFromData(localID, itemID, hostID, data); | ||
98 | } | 102 | } |
99 | } | 103 | } |
100 | } \ No newline at end of file | 104 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index efcae94..e07ae1c 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | |||
@@ -1676,12 +1676,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1676 | 1676 | ||
1677 | public string GetXMLState(UUID itemID) | 1677 | public string GetXMLState(UUID itemID) |
1678 | { | 1678 | { |
1679 | // m_log.DebugFormat("[XEngine]: Getting XML state for {0}", itemID); | 1679 | // m_log.DebugFormat("[XEngine]: Getting XML state for script instance {0}", itemID); |
1680 | 1680 | ||
1681 | IScriptInstance instance = GetInstance(itemID); | 1681 | IScriptInstance instance = GetInstance(itemID); |
1682 | if (instance == null) | 1682 | if (instance == null) |
1683 | { | 1683 | { |
1684 | // m_log.DebugFormat("[XEngine]: Found no script for {0}, returning empty string", itemID); | 1684 | // m_log.DebugFormat("[XEngine]: Found no script instance for {0}, returning empty string", itemID); |
1685 | return ""; | 1685 | return ""; |
1686 | } | 1686 | } |
1687 | 1687 | ||
diff --git a/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs b/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs index c4e29e2..fba03ab 100644 --- a/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs | |||
@@ -81,7 +81,7 @@ namespace OpenSim.Tests.Common | |||
81 | public static TaskInventoryItem AddScript(Scene scene, SceneObjectPart part) | 81 | public static TaskInventoryItem AddScript(Scene scene, SceneObjectPart part) |
82 | { | 82 | { |
83 | AssetScriptText ast = new AssetScriptText(); | 83 | AssetScriptText ast = new AssetScriptText(); |
84 | ast.Source = "default { state_entry() {} }"; | 84 | ast.Source = "default { state_entry() { llSay(0, \"Hello World\"); } }"; |
85 | ast.Encode(); | 85 | ast.Encode(); |
86 | 86 | ||
87 | UUID assetUuid = new UUID("00000000-0000-0000-1000-000000000000"); | 87 | UUID assetUuid = new UUID("00000000-0000-0000-1000-000000000000"); |