diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Tests/Common/Helpers/SceneHelpers.cs (renamed from OpenSim/Tests/Common/Helpers/SceneSetupHelpers.cs) | 51 |
1 files changed, 39 insertions, 12 deletions
diff --git a/OpenSim/Tests/Common/Helpers/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs index bef0481..ea433a6 100644 --- a/OpenSim/Tests/Common/Helpers/SceneSetupHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs | |||
@@ -40,6 +40,7 @@ using OpenSim.Region.Framework; | |||
40 | using OpenSim.Region.Framework.Interfaces; | 40 | using OpenSim.Region.Framework.Interfaces; |
41 | using OpenSim.Region.Framework.Scenes; | 41 | using OpenSim.Region.Framework.Scenes; |
42 | using OpenSim.Region.CoreModules.Avatar.Gods; | 42 | using OpenSim.Region.CoreModules.Avatar.Gods; |
43 | using OpenSim.Region.CoreModules.Asset; | ||
43 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset; | 44 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset; |
44 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Authentication; | 45 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Authentication; |
45 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory; | 46 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory; |
@@ -54,8 +55,13 @@ namespace OpenSim.Tests.Common | |||
54 | /// <summary> | 55 | /// <summary> |
55 | /// Helpers for setting up scenes. | 56 | /// Helpers for setting up scenes. |
56 | /// </summary> | 57 | /// </summary> |
57 | public class SceneSetupHelpers | 58 | public class SceneHelpers |
58 | { | 59 | { |
60 | public static TestScene SetupScene() | ||
61 | { | ||
62 | return SetupScene(null); | ||
63 | } | ||
64 | |||
59 | /// <summary> | 65 | /// <summary> |
60 | /// Set up a test scene | 66 | /// Set up a test scene |
61 | /// </summary> | 67 | /// </summary> |
@@ -63,9 +69,14 @@ namespace OpenSim.Tests.Common | |||
63 | /// Automatically starts service threads, as would the normal runtime. | 69 | /// Automatically starts service threads, as would the normal runtime. |
64 | /// </remarks> | 70 | /// </remarks> |
65 | /// <returns></returns> | 71 | /// <returns></returns> |
66 | public static TestScene SetupScene() | 72 | public static TestScene SetupScene(CoreAssetCache cache) |
73 | { | ||
74 | return SetupScene("Unit test region", UUID.Random(), 1000, 1000, cache); | ||
75 | } | ||
76 | |||
77 | public static TestScene SetupScene(string name, UUID id, uint x, uint y) | ||
67 | { | 78 | { |
68 | return SetupScene("Unit test region", UUID.Random(), 1000, 1000); | 79 | return SetupScene(name, id, x, y, null); |
69 | } | 80 | } |
70 | 81 | ||
71 | /// <summary> | 82 | /// <summary> |
@@ -78,7 +89,7 @@ namespace OpenSim.Tests.Common | |||
78 | /// <param name="y">Y co-ordinate of the region</param> | 89 | /// <param name="y">Y co-ordinate of the region</param> |
79 | /// <param name="cm">This should be the same if simulating two scenes within a standalone</param> | 90 | /// <param name="cm">This should be the same if simulating two scenes within a standalone</param> |
80 | /// <returns></returns> | 91 | /// <returns></returns> |
81 | public static TestScene SetupScene(string name, UUID id, uint x, uint y) | 92 | public static TestScene SetupScene(string name, UUID id, uint x, uint y, CoreAssetCache cache) |
82 | { | 93 | { |
83 | Console.WriteLine("Setting up test scene {0}", name); | 94 | Console.WriteLine("Setting up test scene {0}", name); |
84 | 95 | ||
@@ -103,7 +114,7 @@ namespace OpenSim.Tests.Common | |||
103 | godsModule.Initialise(testScene, new IniConfigSource()); | 114 | godsModule.Initialise(testScene, new IniConfigSource()); |
104 | testScene.AddModule(godsModule.Name, godsModule); | 115 | testScene.AddModule(godsModule.Name, godsModule); |
105 | 116 | ||
106 | LocalAssetServicesConnector assetService = StartAssetService(testScene); | 117 | LocalAssetServicesConnector assetService = StartAssetService(testScene, cache); |
107 | StartAuthenticationService(testScene); | 118 | StartAuthenticationService(testScene); |
108 | LocalInventoryServicesConnector inventoryService = StartInventoryService(testScene); | 119 | LocalInventoryServicesConnector inventoryService = StartInventoryService(testScene); |
109 | StartGridService(testScene); | 120 | StartGridService(testScene); |
@@ -132,7 +143,7 @@ namespace OpenSim.Tests.Common | |||
132 | return testScene; | 143 | return testScene; |
133 | } | 144 | } |
134 | 145 | ||
135 | private static LocalAssetServicesConnector StartAssetService(Scene testScene) | 146 | private static LocalAssetServicesConnector StartAssetService(Scene testScene, CoreAssetCache cache) |
136 | { | 147 | { |
137 | LocalAssetServicesConnector assetService = new LocalAssetServicesConnector(); | 148 | LocalAssetServicesConnector assetService = new LocalAssetServicesConnector(); |
138 | IConfigSource config = new IniConfigSource(); | 149 | IConfigSource config = new IniConfigSource(); |
@@ -145,6 +156,20 @@ namespace OpenSim.Tests.Common | |||
145 | 156 | ||
146 | assetService.Initialise(config); | 157 | assetService.Initialise(config); |
147 | assetService.AddRegion(testScene); | 158 | assetService.AddRegion(testScene); |
159 | |||
160 | if (cache != null) | ||
161 | { | ||
162 | IConfigSource cacheConfig = new IniConfigSource(); | ||
163 | cacheConfig.AddConfig("Modules"); | ||
164 | cacheConfig.Configs["Modules"].Set("AssetCaching", "CoreAssetCache"); | ||
165 | cacheConfig.AddConfig("AssetCache"); | ||
166 | |||
167 | cache.Initialise(cacheConfig); | ||
168 | cache.AddRegion(testScene); | ||
169 | cache.RegionLoaded(testScene); | ||
170 | testScene.AddRegionModule(cache.Name, cache); | ||
171 | } | ||
172 | |||
148 | assetService.RegionLoaded(testScene); | 173 | assetService.RegionLoaded(testScene); |
149 | testScene.AddRegionModule(assetService.Name, assetService); | 174 | testScene.AddRegionModule(assetService.Name, assetService); |
150 | 175 | ||
@@ -331,6 +356,8 @@ namespace OpenSim.Tests.Common | |||
331 | agentData.InventoryFolder = UUID.Zero; | 356 | agentData.InventoryFolder = UUID.Zero; |
332 | agentData.startpos = Vector3.Zero; | 357 | agentData.startpos = Vector3.Zero; |
333 | agentData.CapsPath = "http://wibble.com"; | 358 | agentData.CapsPath = "http://wibble.com"; |
359 | agentData.ServiceURLs = new Dictionary<string, object>(); | ||
360 | agentData.Appearance = new AvatarAppearance(); | ||
334 | 361 | ||
335 | return agentData; | 362 | return agentData; |
336 | } | 363 | } |
@@ -341,9 +368,9 @@ namespace OpenSim.Tests.Common | |||
341 | /// <param name="scene"></param> | 368 | /// <param name="scene"></param> |
342 | /// <param name="agentId"></param> | 369 | /// <param name="agentId"></param> |
343 | /// <returns></returns> | 370 | /// <returns></returns> |
344 | public static TestClient AddRootAgent(Scene scene, UUID agentId) | 371 | public static ScenePresence AddScenePresence(Scene scene, UUID agentId) |
345 | { | 372 | { |
346 | return AddRootAgent(scene, GenerateAgentData(agentId)); | 373 | return AddScenePresence(scene, GenerateAgentData(agentId)); |
347 | } | 374 | } |
348 | 375 | ||
349 | /// <summary> | 376 | /// <summary> |
@@ -364,7 +391,7 @@ namespace OpenSim.Tests.Common | |||
364 | /// <param name="scene"></param> | 391 | /// <param name="scene"></param> |
365 | /// <param name="agentData"></param> | 392 | /// <param name="agentData"></param> |
366 | /// <returns></returns> | 393 | /// <returns></returns> |
367 | public static TestClient AddRootAgent(Scene scene, AgentCircuitData agentData) | 394 | public static ScenePresence AddScenePresence(Scene scene, AgentCircuitData agentData) |
368 | { | 395 | { |
369 | string reason; | 396 | string reason; |
370 | 397 | ||
@@ -379,14 +406,14 @@ namespace OpenSim.Tests.Common | |||
379 | 406 | ||
380 | // Stage 2: add the new client as a child agent to the scene | 407 | // Stage 2: add the new client as a child agent to the scene |
381 | TestClient client = new TestClient(agentData, scene); | 408 | TestClient client = new TestClient(agentData, scene); |
382 | scene.AddNewClient(client); | 409 | scene.AddNewClient(client, PresenceType.User); |
383 | 410 | ||
384 | // Stage 3: Complete the entrance into the region. This converts the child agent into a root agent. | 411 | // Stage 3: Complete the entrance into the region. This converts the child agent into a root agent. |
385 | ScenePresence scp = scene.GetScenePresence(agentData.AgentID); | 412 | ScenePresence scp = scene.GetScenePresence(agentData.AgentID); |
386 | scp.CompleteMovement(client); | 413 | scp.CompleteMovement(client, true); |
387 | //scp.MakeRootAgent(new Vector3(90, 90, 90), true); | 414 | //scp.MakeRootAgent(new Vector3(90, 90, 90), true); |
388 | 415 | ||
389 | return client; | 416 | return scp; |
390 | } | 417 | } |
391 | 418 | ||
392 | /// <summary> | 419 | /// <summary> |