* Make archiver tests pump the asset server manually instead of starting the normal runtime thread

* This may eliminate the occasional archive test freezes, since they appeared to occur when somehow the asset server didn't pick up on the presence of a request in the asset 
quque
0.6.5-rc1
Justin Clarke Casey 2009-04-14 18:49:45 +00:00
parent 017faf0eff
commit d0744f8eca
6 changed files with 58 additions and 8 deletions

View File

@ -67,7 +67,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
InventoryArchiverModule archiverModule = new InventoryArchiverModule(); InventoryArchiverModule archiverModule = new InventoryArchiverModule();
Scene scene = SceneSetupHelpers.SetupScene(); Scene scene = SceneSetupHelpers.SetupScene(false);
SceneSetupHelpers.SetupSceneModules(scene, archiverModule); SceneSetupHelpers.SetupSceneModules(scene, archiverModule);
CommunicationsManager cm = scene.CommsManager; CommunicationsManager cm = scene.CommsManager;
@ -119,6 +119,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
lock (this) lock (this)
{ {
archiverModule.ArchiveInventory(userFirstName, userLastName, "Objects", archiveWriteStream); archiverModule.ArchiveInventory(userFirstName, userLastName, "Objects", archiveWriteStream);
AssetServerBase assetServer = (AssetServerBase)scene.CommsManager.AssetCache.AssetServer;
while (assetServer.HasWaitingRequests())
assetServer.ProcessNextRequest();
Monitor.Wait(this, 60000); Monitor.Wait(this, 60000);
} }

View File

@ -34,6 +34,7 @@ using NUnit.Framework;
using NUnit.Framework.SyntaxHelpers; using NUnit.Framework.SyntaxHelpers;
using OpenMetaverse; using OpenMetaverse;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Communications.Cache;
using OpenSim.Framework.Serialization; using OpenSim.Framework.Serialization;
using OpenSim.Region.CoreModules.World.Serialiser; using OpenSim.Region.CoreModules.World.Serialiser;
using OpenSim.Region.CoreModules.World.Terrain; using OpenSim.Region.CoreModules.World.Terrain;
@ -67,7 +68,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
SerialiserModule serialiserModule = new SerialiserModule(); SerialiserModule serialiserModule = new SerialiserModule();
TerrainModule terrainModule = new TerrainModule(); TerrainModule terrainModule = new TerrainModule();
Scene scene = SceneSetupHelpers.SetupScene(); Scene scene = SceneSetupHelpers.SetupScene(false);
SceneSetupHelpers.SetupSceneModules(scene, archiverModule, serialiserModule, terrainModule); SceneSetupHelpers.SetupSceneModules(scene, archiverModule, serialiserModule, terrainModule);
SceneObjectPart part1; SceneObjectPart part1;
@ -114,6 +115,10 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
lock (this) lock (this)
{ {
archiverModule.ArchiveRegion(archiveWriteStream); archiverModule.ArchiveRegion(archiveWriteStream);
AssetServerBase assetServer = (AssetServerBase)scene.CommsManager.AssetCache.AssetServer;
while (assetServer.HasWaitingRequests())
assetServer.ProcessNextRequest();
Monitor.Wait(this, 60000); Monitor.Wait(this, 60000);
} }

View File

@ -57,7 +57,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
public UUID agent1, agent2, agent3; public UUID agent1, agent2, agent3;
public static Random random; public static Random random;
public ulong region1,region2,region3; public ulong region1,region2,region3;
public CommunicationsManager cm; public TestCommunicationsManager cm;
public AgentCircuitData acd1; public AgentCircuitData acd1;
public SceneObjectGroup sog1, sog2, sog3; public SceneObjectGroup sog1, sog2, sog3;
public TestClient testclient; public TestClient testclient;

View File

@ -60,7 +60,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
UUID sceneAId = UUID.Parse("00000000-0000-0000-0000-000000000100"); UUID sceneAId = UUID.Parse("00000000-0000-0000-0000-000000000100");
UUID sceneBId = UUID.Parse("00000000-0000-0000-0000-000000000200"); UUID sceneBId = UUID.Parse("00000000-0000-0000-0000-000000000200");
CommunicationsManager cm = new TestCommunicationsManager(); TestCommunicationsManager cm = new TestCommunicationsManager();
// shared module // shared module
IRegionModule interregionComms = new RESTInterregionComms(); IRegionModule interregionComms = new RESTInterregionComms();

View File

@ -61,7 +61,6 @@ namespace OpenSim.Tests.Common.Mock
SQLAssetServer assetService = new SQLAssetServer(new TestAssetDataPlugin()); SQLAssetServer assetService = new SQLAssetServer(new TestAssetDataPlugin());
m_assetCache = new AssetCache(assetService); m_assetCache = new AssetCache(assetService);
m_assetCache.AssetServer.Start();
LocalInventoryService lis = new LocalInventoryService(); LocalInventoryService lis = new LocalInventoryService();
lis.AddPlugin(m_inventoryDataPlugin); lis.AddPlugin(m_inventoryDataPlugin);
@ -76,5 +75,13 @@ namespace OpenSim.Tests.Common.Mock
LocalBackEndServices gs = new LocalBackEndServices(); LocalBackEndServices gs = new LocalBackEndServices();
m_gridService = gs; m_gridService = gs;
} }
/// <summary>
/// Start services that take care of business using their own threads.
/// </summary>
public void StartServices()
{
m_assetCache.AssetServer.Start();
}
} }
} }

View File

@ -52,10 +52,25 @@ namespace OpenSim.Tests.Common.Setup
/// <summary> /// <summary>
/// Set up a test scene /// Set up a test scene
/// </summary> /// </summary>
///
/// Automatically starts service threads, as would the normal runtime.
///
/// <returns></returns> /// <returns></returns>
public static TestScene SetupScene() public static TestScene SetupScene()
{ {
return SetupScene("Unit test region", UUID.Random(), 1000, 1000, new TestCommunicationsManager()); return SetupScene(true);
}
/// <summary>
/// Set up a test scene
/// </summary>
///
/// <param name="startServices">Start associated service threads for the scene</param>
/// <returns></returns>
public static TestScene SetupScene(bool startServices)
{
return SetupScene(
"Unit test region", UUID.Random(), 1000, 1000, new TestCommunicationsManager(), startServices);
} }
/// <summary> /// <summary>
@ -67,7 +82,23 @@ namespace OpenSim.Tests.Common.Setup
/// <param name="y">Y co-ordinate of the region</param> /// <param name="y">Y co-ordinate of the region</param>
/// <param name="cm">This should be the same if simulating two scenes within a standalone</param> /// <param name="cm">This should be the same if simulating two scenes within a standalone</param>
/// <returns></returns> /// <returns></returns>
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)
{
return SetupScene(name, id, x, y, cm, true);
}
/// <summary>
/// Set up a test scene
/// </summary>
/// <param name="name">Name of the region</param>
/// <param name="id">ID of the region</param>
/// <param name="x">X co-ordinate of the region</param>
/// <param name="y">Y co-ordinate of the region</param>
/// <param name="cm">This should be the same if simulating two scenes within a standalone</param>
/// <param name="startServices">Start associated threads for the services used by the scene</param>
/// <returns></returns>
public static TestScene SetupScene(
string name, UUID id, uint x, uint y, TestCommunicationsManager cm, bool startServices)
{ {
Console.WriteLine("Setting up test scene {0}", name); Console.WriteLine("Setting up test scene {0}", name);
@ -102,6 +133,9 @@ namespace OpenSim.Tests.Common.Setup
testScene.PhysicsScene testScene.PhysicsScene
= physicsPluginManager.GetPhysicsScene("basicphysics", "ZeroMesher", configSource, "test"); = physicsPluginManager.GetPhysicsScene("basicphysics", "ZeroMesher", configSource, "test");
if (startServices)
cm.StartServices();
return testScene; return testScene;
} }