diff options
author | Justin Clark-Casey (justincc) | 2011-08-16 23:05:08 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-08-16 23:05:08 +0100 |
commit | 57e54d84d641787d40a2b45549f6f2d373c5f2f2 (patch) | |
tree | 2a9dfca1ecde4281a59ec682d833c1007ccafbd2 /OpenSim/Region | |
parent | Move some previously common code back into separate tests. Remove unused reg... (diff) | |
download | opensim-SC-57e54d84d641787d40a2b45549f6f2d373c5f2f2.zip opensim-SC-57e54d84d641787d40a2b45549f6f2d373c5f2f2.tar.gz opensim-SC-57e54d84d641787d40a2b45549f6f2d373c5f2f2.tar.bz2 opensim-SC-57e54d84d641787d40a2b45549f6f2d373c5f2f2.tar.xz |
Add new FireAndForgetMethod.None.
This executes the callback on the same thread that made the request. Designed for use only by regression tests that rely on a predicable event ordering.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs | 46 |
1 files changed, 33 insertions, 13 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs index c524090..7f25864 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs | |||
@@ -37,10 +37,11 @@ using NUnit.Framework; | |||
37 | using OpenMetaverse; | 37 | using OpenMetaverse; |
38 | using OpenSim.Framework; | 38 | using OpenSim.Framework; |
39 | using OpenSim.Framework.Communications; | 39 | using OpenSim.Framework.Communications; |
40 | using OpenSim.Region.Framework.Scenes; | 40 | using OpenSim.Region.CoreModules.Avatar.Attachments; |
41 | using OpenSim.Region.Framework.Interfaces; | ||
42 | using OpenSim.Region.CoreModules.World.Serialiser; | 41 | using OpenSim.Region.CoreModules.World.Serialiser; |
43 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; | 42 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; |
43 | using OpenSim.Region.Framework.Scenes; | ||
44 | using OpenSim.Region.Framework.Interfaces; | ||
44 | using OpenSim.Tests.Common; | 45 | using OpenSim.Tests.Common; |
45 | using OpenSim.Tests.Common.Mock; | 46 | using OpenSim.Tests.Common.Mock; |
46 | 47 | ||
@@ -61,18 +62,25 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
61 | [SetUp] | 62 | [SetUp] |
62 | public void Init() | 63 | public void Init() |
63 | { | 64 | { |
64 | scene = SceneHelpers.SetupScene("Neighbour x", UUID.Random(), 1000, 1000); | 65 | // Don't allow tests to be bamboozled by asynchronous events. Execute everything on the same thread. |
66 | Util.FireAndForgetMethod = FireAndForgetMethod.None; | ||
65 | 67 | ||
66 | ISharedRegionModule interregionComms = new LocalSimulationConnectorModule(); | 68 | scene = SceneHelpers.SetupScene("Neighbour x", UUID.Random(), 1000, 1000); |
67 | interregionComms.Initialise(new IniConfigSource()); | 69 | SceneHelpers.SetupSceneModules(scene, new AttachmentsModule()); |
68 | interregionComms.PostInitialise(); | ||
69 | SceneHelpers.SetupSceneModules(scene, new IniConfigSource(), interregionComms); | ||
70 | 70 | ||
71 | agent1 = UUID.Random(); | 71 | agent1 = UUID.Random(); |
72 | random = new Random(); | 72 | random = new Random(); |
73 | sog1 = NewSOG(UUID.Random(), scene, agent1); | 73 | sog1 = NewSOG(UUID.Random(), scene, agent1); |
74 | sog2 = NewSOG(UUID.Random(), scene, agent1); | 74 | sog2 = NewSOG(UUID.Random(), scene, agent1); |
75 | } | 75 | } |
76 | |||
77 | [TearDown] | ||
78 | public void TearDown() | ||
79 | { | ||
80 | // We must set this back afterwards, otherwise later tests will fail since they're expecting multiple | ||
81 | // threads. Possibly, later tests should be rewritten not to worry about such things. | ||
82 | Util.FireAndForgetMethod = Util.DefaultFireAndForgetMethod; | ||
83 | } | ||
76 | 84 | ||
77 | [Test] | 85 | [Test] |
78 | public void TestAddAttachments() | 86 | public void TestAddAttachments() |
@@ -100,11 +108,23 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
100 | Assert.That(presence.HasAttachments(), Is.False); | 108 | Assert.That(presence.HasAttachments(), Is.False); |
101 | } | 109 | } |
102 | 110 | ||
103 | // [Test] | 111 | [Test] |
104 | // public void TestRezAttachmentsOnAvatarEntrance() | 112 | public void TestRezAttachmentsOnAvatarEntrance() |
105 | // { | 113 | { |
106 | // ScenePresence presence = scene.GetScenePresence(agent1); | 114 | TestHelpers.InMethod(); |
107 | // } | 115 | // log4net.Config.XmlConfigurator.Configure(); |
116 | |||
117 | UUID spId = TestHelpers.ParseTail(0x1); | ||
118 | UUID attItemId = TestHelpers.ParseTail(0x2); | ||
119 | UUID attAssetId = TestHelpers.ParseTail(0x3); | ||
120 | |||
121 | AgentCircuitData acd = SceneHelpers.GenerateAgentData(spId); | ||
122 | acd.Appearance = new AvatarAppearance(); | ||
123 | acd.Appearance.SetAttachment((int)AttachmentPoint.Chest, attItemId, attAssetId); | ||
124 | ScenePresence presence = SceneHelpers.AddScenePresence(scene, acd); | ||
125 | |||
126 | // Assert.That(presence.HasAttachments(), Is.True); | ||
127 | } | ||
108 | 128 | ||
109 | // I'm commenting this test because scene setup NEEDS InventoryService to | 129 | // I'm commenting this test because scene setup NEEDS InventoryService to |
110 | // be non-null | 130 | // be non-null |