diff options
author | Justin Clark-Casey (justincc) | 2011-12-03 18:59:54 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-12-03 18:59:54 +0000 |
commit | 4919c6056022053f8632b030a06fd8f48ac02a8e (patch) | |
tree | 098bfeaf1aa751f20e2bc4791f26302e74417d05 /OpenSim/Region/Framework | |
parent | Improve locking in AgentCircuitManager (diff) | |
download | opensim-SC_OLD-4919c6056022053f8632b030a06fd8f48ac02a8e.zip opensim-SC_OLD-4919c6056022053f8632b030a06fd8f48ac02a8e.tar.gz opensim-SC_OLD-4919c6056022053f8632b030a06fd8f48ac02a8e.tar.bz2 opensim-SC_OLD-4919c6056022053f8632b030a06fd8f48ac02a8e.tar.xz |
Add beginning of ScenePresenceAgentTests.TestCreateChildScenePresence()
This required an option to be added to NullRegionData via ConnectionString for it to act as a non-static instance, so that regression tests (which only load this class once) don't get hopeless confused and complex to compensate.
Normal standalone operation unaffected.
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs | 57 |
1 files changed, 46 insertions, 11 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs index 57d22bd..f479e12 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs | |||
@@ -31,7 +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 Timer=System.Timers.Timer; | 34 | using Timer = System.Timers.Timer; |
35 | using Nini.Config; | 35 | using Nini.Config; |
36 | using NUnit.Framework; | 36 | using NUnit.Framework; |
37 | using OpenMetaverse; | 37 | using OpenMetaverse; |
@@ -39,11 +39,13 @@ using OpenSim.Framework; | |||
39 | using OpenSim.Framework.Communications; | 39 | using OpenSim.Framework.Communications; |
40 | using OpenSim.Region.Framework.Scenes; | 40 | using OpenSim.Region.Framework.Scenes; |
41 | using OpenSim.Region.Framework.Interfaces; | 41 | using OpenSim.Region.Framework.Interfaces; |
42 | using OpenSim.Region.ClientStack.Linden; | ||
42 | using OpenSim.Region.CoreModules.Framework.EntityTransfer; | 43 | using OpenSim.Region.CoreModules.Framework.EntityTransfer; |
43 | using OpenSim.Region.CoreModules.World.Serialiser; | 44 | using OpenSim.Region.CoreModules.World.Serialiser; |
44 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; | 45 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; |
45 | using OpenSim.Tests.Common; | 46 | using OpenSim.Tests.Common; |
46 | using OpenSim.Tests.Common.Mock; | 47 | using OpenSim.Tests.Common.Mock; |
48 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | ||
47 | 49 | ||
48 | namespace OpenSim.Region.Framework.Scenes.Tests | 50 | namespace OpenSim.Region.Framework.Scenes.Tests |
49 | { | 51 | { |
@@ -112,14 +114,40 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
112 | Assert.That(scene.AuthenticateHandler.GetAgentCircuits().Count, Is.EqualTo(0)); | 114 | Assert.That(scene.AuthenticateHandler.GetAgentCircuits().Count, Is.EqualTo(0)); |
113 | } | 115 | } |
114 | 116 | ||
117 | [Test] | ||
118 | public void TestCreateChildScenePresence() | ||
119 | { | ||
120 | TestHelpers.InMethod(); | ||
121 | // log4net.Config.XmlConfigurator.Configure(); | ||
122 | |||
123 | LocalSimulationConnectorModule lsc = new LocalSimulationConnectorModule(); | ||
124 | |||
125 | IConfigSource configSource = new IniConfigSource(); | ||
126 | IConfig config = configSource.AddConfig("Modules"); | ||
127 | config.Set("SimulationServices", "LocalSimulationConnectorModule"); | ||
128 | |||
129 | TestScene scene = SceneHelpers.SetupScene(); | ||
130 | SceneHelpers.SetupSceneModules(scene, configSource, lsc); | ||
131 | |||
132 | UUID agentId = TestHelpers.ParseTail(0x01); | ||
133 | AgentCircuitData acd = SceneHelpers.GenerateAgentData(agentId); | ||
134 | |||
135 | GridRegion region = scene.GridService.GetRegionByName(UUID.Zero, scene.RegionInfo.RegionName); | ||
136 | string reason; | ||
137 | scene.SimulationService.CreateAgent(region, acd, (uint)TeleportFlags.ViaLogin, out reason); | ||
138 | |||
139 | Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(agentId), Is.Not.Null); | ||
140 | Assert.That(scene.AuthenticateHandler.GetAgentCircuits().Count, Is.EqualTo(1)); | ||
141 | } | ||
142 | |||
115 | /// <summary> | 143 | /// <summary> |
116 | /// Test that if a root agent logs into a region, a child agent is also established in the neighbouring region | 144 | /// Test that if a root agent logs into a region, a child agent is also established in the neighbouring region |
117 | /// </summary> | 145 | /// </summary> |
118 | /// <remarks> | 146 | /// <remarks> |
119 | /// Please note that unlike the other tests here, this doesn't rely on structures | 147 | /// Please note that unlike the other tests here, this doesn't rely on anything set up in the instance fields. |
120 | /// </remarks> | 148 | /// </remarks> |
121 | [Test] | 149 | [Test] |
122 | public void TestChildAgentEstablished() | 150 | public void TestChildAgentEstablishedInNeighbour() |
123 | { | 151 | { |
124 | TestHelpers.InMethod(); | 152 | TestHelpers.InMethod(); |
125 | // log4net.Config.XmlConfigurator.Configure(); | 153 | // log4net.Config.XmlConfigurator.Configure(); |
@@ -127,18 +155,25 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
127 | UUID agent1Id = UUID.Parse("00000000-0000-0000-0000-000000000001"); | 155 | UUID agent1Id = UUID.Parse("00000000-0000-0000-0000-000000000001"); |
128 | 156 | ||
129 | TestScene myScene1 = SceneHelpers.SetupScene("Neighbour y", UUID.Random(), 1000, 1000); | 157 | TestScene myScene1 = SceneHelpers.SetupScene("Neighbour y", UUID.Random(), 1000, 1000); |
130 | // TestScene myScene2 = SceneHelpers.SetupScene("Neighbour y + 1", UUID.Random(), 1001, 1000); | 158 | TestScene myScene2 = SceneHelpers.SetupScene("Neighbour y + 1", UUID.Random(), 1001, 1000); |
131 | 159 | ||
132 | IConfigSource configSource = new IniConfigSource(); | 160 | IConfigSource configSource = new IniConfigSource(); |
133 | configSource.AddConfig("Modules").Set("EntityTransferModule", "BasicEntityTransferModule"); | 161 | IConfig config = configSource.AddConfig("Startup"); |
162 | config.Set("serverside_object_permissions", true); | ||
163 | config.Set("EventQueue", true); | ||
164 | |||
134 | EntityTransferModule etm = new EntityTransferModule(); | 165 | EntityTransferModule etm = new EntityTransferModule(); |
166 | |||
167 | EventQueueGetModule eqgm1 = new EventQueueGetModule(); | ||
168 | SceneHelpers.SetupSceneModules(myScene1, configSource, etm, eqgm1); | ||
169 | |||
170 | EventQueueGetModule eqgm2 = new EventQueueGetModule(); | ||
171 | SceneHelpers.SetupSceneModules(myScene2, configSource, etm, eqgm2); | ||
135 | 172 | ||
136 | SceneHelpers.SetupSceneModules(myScene1, configSource, etm); | 173 | // SceneHelpers.AddScenePresence(myScene1, agent1Id); |
137 | |||
138 | SceneHelpers.AddScenePresence(myScene1, agent1Id); | ||
139 | // ScenePresence childPresence = myScene2.GetScenePresence(agent1); | 174 | // ScenePresence childPresence = myScene2.GetScenePresence(agent1); |
140 | 175 | // | |
141 | // TODO: Need to do a fair amount of work to allow synchronous establishment of child agents | 176 | // // TODO: Need to do a fair amount of work to allow synchronous establishment of child agents |
142 | // Assert.That(childPresence, Is.Not.Null); | 177 | // Assert.That(childPresence, Is.Not.Null); |
143 | // Assert.That(childPresence.IsChildAgent, Is.True); | 178 | // Assert.That(childPresence.IsChildAgent, Is.True); |
144 | } | 179 | } |