diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index c140ec09d3..01e5ae0c89 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs @@ -67,7 +67,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests InventoryArchiverModule archiverModule = new InventoryArchiverModule(); - Scene scene = SceneSetupHelpers.SetupScene(); + Scene scene = SceneSetupHelpers.SetupScene(false); SceneSetupHelpers.SetupSceneModules(scene, archiverModule); CommunicationsManager cm = scene.CommsManager; @@ -119,6 +119,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests lock (this) { archiverModule.ArchiveInventory(userFirstName, userLastName, "Objects", archiveWriteStream); + AssetServerBase assetServer = (AssetServerBase)scene.CommsManager.AssetCache.AssetServer; + while (assetServer.HasWaitingRequests()) + assetServer.ProcessNextRequest(); + Monitor.Wait(this, 60000); } diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs index 04c3289186..165a607d52 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs @@ -34,6 +34,7 @@ using NUnit.Framework; using NUnit.Framework.SyntaxHelpers; using OpenMetaverse; using OpenSim.Framework; +using OpenSim.Framework.Communications.Cache; using OpenSim.Framework.Serialization; using OpenSim.Region.CoreModules.World.Serialiser; using OpenSim.Region.CoreModules.World.Terrain; @@ -67,7 +68,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests SerialiserModule serialiserModule = new SerialiserModule(); TerrainModule terrainModule = new TerrainModule(); - Scene scene = SceneSetupHelpers.SetupScene(); + Scene scene = SceneSetupHelpers.SetupScene(false); SceneSetupHelpers.SetupSceneModules(scene, archiverModule, serialiserModule, terrainModule); SceneObjectPart part1; @@ -114,6 +115,10 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests lock (this) { archiverModule.ArchiveRegion(archiveWriteStream); + AssetServerBase assetServer = (AssetServerBase)scene.CommsManager.AssetCache.AssetServer; + while (assetServer.HasWaitingRequests()) + assetServer.ProcessNextRequest(); + Monitor.Wait(this, 60000); } diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs index c7813055cd..c00ef3ce2d 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs @@ -57,7 +57,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests public UUID agent1, agent2, agent3; public static Random random; public ulong region1,region2,region3; - public CommunicationsManager cm; + public TestCommunicationsManager cm; public AgentCircuitData acd1; public SceneObjectGroup sog1, sog2, sog3; public TestClient testclient; diff --git a/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs index 80d2ba9b30..a0c956e167 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs @@ -60,7 +60,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests UUID sceneAId = UUID.Parse("00000000-0000-0000-0000-000000000100"); UUID sceneBId = UUID.Parse("00000000-0000-0000-0000-000000000200"); - CommunicationsManager cm = new TestCommunicationsManager(); + TestCommunicationsManager cm = new TestCommunicationsManager(); // shared module IRegionModule interregionComms = new RESTInterregionComms(); diff --git a/OpenSim/Tests/Common/Mock/TestCommunicationsManager.cs b/OpenSim/Tests/Common/Mock/TestCommunicationsManager.cs index 3b39d36a9c..93891c031d 100644 --- a/OpenSim/Tests/Common/Mock/TestCommunicationsManager.cs +++ b/OpenSim/Tests/Common/Mock/TestCommunicationsManager.cs @@ -60,8 +60,7 @@ namespace OpenSim.Tests.Common.Mock m_inventoryDataPlugin = new TestInventoryDataPlugin(); SQLAssetServer assetService = new SQLAssetServer(new TestAssetDataPlugin()); - m_assetCache = new AssetCache(assetService); - m_assetCache.AssetServer.Start(); + m_assetCache = new AssetCache(assetService); LocalInventoryService lis = new LocalInventoryService(); lis.AddPlugin(m_inventoryDataPlugin); @@ -76,5 +75,13 @@ namespace OpenSim.Tests.Common.Mock LocalBackEndServices gs = new LocalBackEndServices(); m_gridService = gs; } + + /// + /// Start services that take care of business using their own threads. + /// + public void StartServices() + { + m_assetCache.AssetServer.Start(); + } } } diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs index 3bcd949c03..ea4f0af54c 100644 --- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs +++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs @@ -52,10 +52,39 @@ namespace OpenSim.Tests.Common.Setup /// /// Set up a test scene /// + /// + /// Automatically starts service threads, as would the normal runtime. + /// /// public static TestScene SetupScene() { - return SetupScene("Unit test region", UUID.Random(), 1000, 1000, new TestCommunicationsManager()); + return SetupScene(true); + } + + /// + /// Set up a test scene + /// + /// + /// Start associated service threads for the scene + /// + public static TestScene SetupScene(bool startServices) + { + return SetupScene( + "Unit test region", UUID.Random(), 1000, 1000, new TestCommunicationsManager(), startServices); + } + + /// + /// Set up a test scene + /// + /// Name of the region + /// ID of the region + /// X co-ordinate of the region + /// Y co-ordinate of the region + /// This should be the same if simulating two scenes within a standalone + /// + public static TestScene SetupScene(string name, UUID id, uint x, uint y, TestCommunicationsManager cm) + { + return SetupScene(name, id, x, y, cm, true); } /// @@ -66,8 +95,10 @@ namespace OpenSim.Tests.Common.Setup /// X co-ordinate of the region /// Y co-ordinate of the region /// This should be the same if simulating two scenes within a standalone + /// Start associated threads for the services used by the scene /// - public static TestScene SetupScene(string name, UUID id, uint x, uint y, CommunicationsManager cm) + public static TestScene SetupScene( + string name, UUID id, uint x, uint y, TestCommunicationsManager cm, bool startServices) { Console.WriteLine("Setting up test scene {0}", name); @@ -102,6 +133,9 @@ namespace OpenSim.Tests.Common.Setup testScene.PhysicsScene = physicsPluginManager.GetPhysicsScene("basicphysics", "ZeroMesher", configSource, "test"); + if (startServices) + cm.StartServices(); + return testScene; }