* switch to pulsing monitors to perform test sync instead of events, since this doesn't allow one to accidentally forget to reset the event
parent
014e9e2c6d
commit
4e779bbd81
|
@ -44,12 +44,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
|||
[TestFixture]
|
||||
public class InventoryArchiverTests
|
||||
{
|
||||
private EventWaitHandle m_waitHandle = new AutoResetEvent(false);
|
||||
|
||||
private void SaveCompleted(
|
||||
bool succeeded, CachedUserInfo userInfo, string invPath, Stream saveStream, Exception reportedException)
|
||||
{
|
||||
m_waitHandle.Set();
|
||||
lock (this)
|
||||
{
|
||||
Monitor.PulseAll(this);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -110,7 +111,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
|||
archiverModule.OnInventoryArchiveSaved += SaveCompleted;
|
||||
|
||||
archiverModule.ArchiveInventory(userFirstName, userLastName, "Objects", archiveWriteStream);
|
||||
m_waitHandle.WaitOne(60000, true);
|
||||
|
||||
lock (this)
|
||||
{
|
||||
archiverModule.ArchiveInventory(userFirstName, userLastName, "Objects", archiveWriteStream);
|
||||
Monitor.Wait(this, 60000);
|
||||
}
|
||||
|
||||
/*
|
||||
byte[] archive = archiveWriteStream.ToArray();
|
||||
|
|
|
@ -43,11 +43,12 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
|
|||
[TestFixture]
|
||||
public class ArchiverTests
|
||||
{
|
||||
private EventWaitHandle m_waitHandle = new ManualResetEvent(false);
|
||||
|
||||
private void SaveCompleted(string errorMessage)
|
||||
{
|
||||
m_waitHandle.Set();
|
||||
lock (this)
|
||||
{
|
||||
Monitor.PulseAll(this);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -104,11 +105,13 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
|
|||
}
|
||||
|
||||
MemoryStream archiveWriteStream = new MemoryStream();
|
||||
|
||||
scene.EventManager.OnOarFileSaved += SaveCompleted;
|
||||
|
||||
lock (this)
|
||||
{
|
||||
archiverModule.ArchiveRegion(archiveWriteStream);
|
||||
m_waitHandle.WaitOne(60000, true);
|
||||
m_waitHandle.Reset();
|
||||
Monitor.Wait(this, 60000);
|
||||
}
|
||||
|
||||
byte[] archive = archiveWriteStream.ToArray();
|
||||
MemoryStream archiveReadStream = new MemoryStream(archive);
|
||||
|
@ -251,9 +254,12 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
|
|||
|
||||
// Write out this scene
|
||||
scene.EventManager.OnOarFileSaved += SaveCompleted;
|
||||
|
||||
lock (this)
|
||||
{
|
||||
archiverModule.ArchiveRegion(archiveWriteStream);
|
||||
m_waitHandle.WaitOne(60000, true);
|
||||
m_waitHandle.Reset();
|
||||
Monitor.Wait(this, 60000);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue