* 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]
|
[TestFixture]
|
||||||
public class InventoryArchiverTests
|
public class InventoryArchiverTests
|
||||||
{
|
{
|
||||||
private EventWaitHandle m_waitHandle = new AutoResetEvent(false);
|
|
||||||
|
|
||||||
private void SaveCompleted(
|
private void SaveCompleted(
|
||||||
bool succeeded, CachedUserInfo userInfo, string invPath, Stream saveStream, Exception reportedException)
|
bool succeeded, CachedUserInfo userInfo, string invPath, Stream saveStream, Exception reportedException)
|
||||||
{
|
{
|
||||||
m_waitHandle.Set();
|
lock (this)
|
||||||
|
{
|
||||||
|
Monitor.PulseAll(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -109,8 +110,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
||||||
MemoryStream archiveWriteStream = new MemoryStream();
|
MemoryStream archiveWriteStream = new MemoryStream();
|
||||||
archiverModule.OnInventoryArchiveSaved += SaveCompleted;
|
archiverModule.OnInventoryArchiveSaved += SaveCompleted;
|
||||||
|
|
||||||
archiverModule.ArchiveInventory(userFirstName, userLastName, "Objects", archiveWriteStream);
|
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();
|
byte[] archive = archiveWriteStream.ToArray();
|
||||||
|
|
|
@ -43,11 +43,12 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class ArchiverTests
|
public class ArchiverTests
|
||||||
{
|
{
|
||||||
private EventWaitHandle m_waitHandle = new ManualResetEvent(false);
|
|
||||||
|
|
||||||
private void SaveCompleted(string errorMessage)
|
private void SaveCompleted(string errorMessage)
|
||||||
{
|
{
|
||||||
m_waitHandle.Set();
|
lock (this)
|
||||||
|
{
|
||||||
|
Monitor.PulseAll(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -103,12 +104,14 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
|
||||||
scene.AddNewSceneObject(new SceneObjectGroup(part2), false);
|
scene.AddNewSceneObject(new SceneObjectGroup(part2), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
MemoryStream archiveWriteStream = new MemoryStream();
|
MemoryStream archiveWriteStream = new MemoryStream();
|
||||||
|
|
||||||
scene.EventManager.OnOarFileSaved += SaveCompleted;
|
scene.EventManager.OnOarFileSaved += SaveCompleted;
|
||||||
archiverModule.ArchiveRegion(archiveWriteStream);
|
|
||||||
m_waitHandle.WaitOne(60000, true);
|
lock (this)
|
||||||
m_waitHandle.Reset();
|
{
|
||||||
|
archiverModule.ArchiveRegion(archiveWriteStream);
|
||||||
|
Monitor.Wait(this, 60000);
|
||||||
|
}
|
||||||
|
|
||||||
byte[] archive = archiveWriteStream.ToArray();
|
byte[] archive = archiveWriteStream.ToArray();
|
||||||
MemoryStream archiveReadStream = new MemoryStream(archive);
|
MemoryStream archiveReadStream = new MemoryStream(archive);
|
||||||
|
@ -251,9 +254,12 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
|
||||||
|
|
||||||
// Write out this scene
|
// Write out this scene
|
||||||
scene.EventManager.OnOarFileSaved += SaveCompleted;
|
scene.EventManager.OnOarFileSaved += SaveCompleted;
|
||||||
archiverModule.ArchiveRegion(archiveWriteStream);
|
|
||||||
m_waitHandle.WaitOne(60000, true);
|
lock (this)
|
||||||
m_waitHandle.Reset();
|
{
|
||||||
|
archiverModule.ArchiveRegion(archiveWriteStream);
|
||||||
|
Monitor.Wait(this, 60000);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue