diff options
Diffstat (limited to 'OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs')
-rw-r--r-- | OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs | 95 |
1 files changed, 19 insertions, 76 deletions
diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs index 8b16496..5be70bc 100644 --- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs +++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs | |||
@@ -132,24 +132,11 @@ namespace OpenSim.Tests.Common.Setup | |||
132 | public static TestScene SetupScene( | 132 | public static TestScene SetupScene( |
133 | string name, UUID id, uint x, uint y, String realServices) | 133 | string name, UUID id, uint x, uint y, String realServices) |
134 | { | 134 | { |
135 | bool newScene = false; | ||
136 | |||
137 | Console.WriteLine("Setting up test scene {0}", name); | 135 | Console.WriteLine("Setting up test scene {0}", name); |
138 | 136 | ||
139 | // REFACTORING PROBLEM! | ||
140 | //// If cm is the same as our last commsManager used, this means the tester wants to link | ||
141 | //// regions. In this case, don't use the sameshared region modules and dont initialize them again. | ||
142 | //// Also, no need to start another MainServer and MainConsole instance. | ||
143 | //if (cm == null || cm != commsManager) | ||
144 | //{ | ||
145 | // System.Console.WriteLine("Starting a brand new scene"); | ||
146 | // newScene = true; | ||
147 | MainConsole.Instance = new MockConsole("TEST PROMPT"); | ||
148 | // MainServer.Instance = new BaseHttpServer(980); | ||
149 | // commsManager = cm; | ||
150 | //} | ||
151 | |||
152 | // We must set up a console otherwise setup of some modules may fail | 137 | // We must set up a console otherwise setup of some modules may fail |
138 | MainConsole.Instance = new MockConsole("TEST PROMPT"); | ||
139 | |||
153 | RegionInfo regInfo = new RegionInfo(x, y, new IPEndPoint(IPAddress.Loopback, 9000), "127.0.0.1"); | 140 | RegionInfo regInfo = new RegionInfo(x, y, new IPEndPoint(IPAddress.Loopback, 9000), "127.0.0.1"); |
154 | regInfo.RegionName = name; | 141 | regInfo.RegionName = name; |
155 | regInfo.RegionID = id; | 142 | regInfo.RegionID = id; |
@@ -164,50 +151,27 @@ namespace OpenSim.Tests.Common.Setup | |||
164 | TestScene testScene = new TestScene( | 151 | TestScene testScene = new TestScene( |
165 | regInfo, acm, scs, simDataService, estateDataService, null, false, false, false, configSource, null); | 152 | regInfo, acm, scs, simDataService, estateDataService, null, false, false, false, configSource, null); |
166 | 153 | ||
167 | INonSharedRegionModule capsModule = new CapabilitiesModule(); | ||
168 | capsModule.Initialise(new IniConfigSource()); | ||
169 | testScene.AddRegionModule(capsModule.Name, capsModule); | ||
170 | capsModule.AddRegion(testScene); | ||
171 | |||
172 | IRegionModule godsModule = new GodsModule(); | 154 | IRegionModule godsModule = new GodsModule(); |
173 | godsModule.Initialise(testScene, new IniConfigSource()); | 155 | godsModule.Initialise(testScene, new IniConfigSource()); |
174 | testScene.AddModule(godsModule.Name, godsModule); | 156 | testScene.AddModule(godsModule.Name, godsModule); |
175 | realServices = realServices.ToLower(); | 157 | realServices = realServices.ToLower(); |
176 | // IConfigSource config = new IniConfigSource(); | ||
177 | 158 | ||
178 | // If we have a brand new scene, need to initialize shared region modules | 159 | if (realServices.Contains("asset")) |
179 | if ((m_assetService == null && m_inventoryService == null) || newScene) | 160 | StartAssetService(testScene, true); |
180 | { | ||
181 | if (realServices.Contains("asset")) | ||
182 | StartAssetService(testScene, true); | ||
183 | else | ||
184 | StartAssetService(testScene, false); | ||
185 | |||
186 | // For now, always started a 'real' authentication service | ||
187 | StartAuthenticationService(testScene, true); | ||
188 | |||
189 | if (realServices.Contains("inventory")) | ||
190 | StartInventoryService(testScene, true); | ||
191 | else | ||
192 | StartInventoryService(testScene, false); | ||
193 | |||
194 | StartGridService(testScene, true); | ||
195 | StartUserAccountService(testScene); | ||
196 | StartPresenceService(testScene); | ||
197 | } | ||
198 | // If not, make sure the shared module gets references to this new scene | ||
199 | else | 161 | else |
200 | { | 162 | StartAssetService(testScene, false); |
201 | m_assetService.AddRegion(testScene); | ||
202 | m_assetService.RegionLoaded(testScene); | ||
203 | m_inventoryService.AddRegion(testScene); | ||
204 | m_inventoryService.RegionLoaded(testScene); | ||
205 | m_userAccountService.AddRegion(testScene); | ||
206 | m_userAccountService.RegionLoaded(testScene); | ||
207 | m_presenceService.AddRegion(testScene); | ||
208 | m_presenceService.RegionLoaded(testScene); | ||
209 | 163 | ||
210 | } | 164 | // For now, always started a 'real' authentication service |
165 | StartAuthenticationService(testScene, true); | ||
166 | |||
167 | if (realServices.Contains("inventory")) | ||
168 | StartInventoryService(testScene, true); | ||
169 | else | ||
170 | StartInventoryService(testScene, false); | ||
171 | |||
172 | StartGridService(testScene, true); | ||
173 | StartUserAccountService(testScene); | ||
174 | StartPresenceService(testScene); | ||
211 | 175 | ||
212 | m_inventoryService.PostInitialise(); | 176 | m_inventoryService.PostInitialise(); |
213 | m_assetService.PostInitialise(); | 177 | m_assetService.PostInitialise(); |
@@ -504,12 +468,10 @@ namespace OpenSim.Tests.Common.Setup | |||
504 | TestClient client = new TestClient(agentData, scene); | 468 | TestClient client = new TestClient(agentData, scene); |
505 | scene.AddNewClient(client); | 469 | scene.AddNewClient(client); |
506 | 470 | ||
507 | // Stage 3: Invoke agent crossing, which converts the child agent into a root agent (with appearance, | 471 | // Stage 3: Complete the entrance into the region. This converts the child agent into a root agent. |
508 | // inventory, etc.) | ||
509 | //scene.AgentCrossing(agentData.AgentID, new Vector3(90, 90, 90), false); OBSOLETE | ||
510 | |||
511 | ScenePresence scp = scene.GetScenePresence(agentData.AgentID); | 472 | ScenePresence scp = scene.GetScenePresence(agentData.AgentID); |
512 | scp.MakeRootAgent(new Vector3(90, 90, 90), true); | 473 | scp.CompleteMovement(client); |
474 | //scp.MakeRootAgent(new Vector3(90, 90, 90), true); | ||
513 | 475 | ||
514 | return client; | 476 | return client; |
515 | } | 477 | } |
@@ -543,24 +505,5 @@ namespace OpenSim.Tests.Common.Setup | |||
543 | 505 | ||
544 | return part; | 506 | return part; |
545 | } | 507 | } |
546 | |||
547 | /// <summary> | ||
548 | /// Delete a scene object asynchronously | ||
549 | /// </summary> | ||
550 | /// <param name="scene"></param> | ||
551 | /// <param name="part"></param> | ||
552 | /// <param name="action"></param> | ||
553 | /// <param name="destinationId"></param> | ||
554 | /// <param name="client"></param> | ||
555 | public static void DeleteSceneObjectAsync( | ||
556 | TestScene scene, SceneObjectPart part, DeRezAction action, UUID destinationId, IClientAPI client) | ||
557 | { | ||
558 | // Turn off the timer on the async sog deleter - we'll crank it by hand within a unit test | ||
559 | AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; | ||
560 | sogd.Enabled = false; | ||
561 | |||
562 | scene.DeRezObjects(client, new List<uint>() { part.LocalId }, UUID.Zero, action, destinationId); | ||
563 | sogd.InventoryDeQueueAndDelete(); | ||
564 | } | ||
565 | } | 508 | } |
566 | } | 509 | } |