Merge branch 'master' of ssh://MyConnection/var/git/opensim
commit
2c09634aed
|
@ -38,51 +38,50 @@
|
||||||
the assembly here as an exec, and you add the fail clause later.
|
the assembly here as an exec, and you add the fail clause later.
|
||||||
This lets all the unit tests run and tells you if they fail at the
|
This lets all the unit tests run and tells you if they fail at the
|
||||||
end, instead of stopping short -->
|
end, instead of stopping short -->
|
||||||
<exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.framework.tests">
|
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.framework.tests">
|
||||||
<arg value="./bin/OpenSim.Framework.Tests.dll" />
|
<arg value="./bin/OpenSim.Framework.Tests.dll" />
|
||||||
</exec>
|
</exec>
|
||||||
|
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.framework.tests)==0}" />
|
||||||
|
|
||||||
<exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.framework.communications.tests">
|
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.framework.communications.tests">
|
||||||
<arg value="./bin/OpenSim.Framework.Communications.Tests.dll" />
|
<arg value="./bin/OpenSim.Framework.Communications.Tests.dll" />
|
||||||
</exec>
|
</exec>
|
||||||
|
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.framework.communications.tests)==0}" />
|
||||||
|
|
||||||
<exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.framework.servers.tests">
|
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.framework.servers.tests">
|
||||||
<arg value="./bin/OpenSim.Framework.Servers.Tests.dll" />
|
<arg value="./bin/OpenSim.Framework.Servers.Tests.dll" />
|
||||||
</exec>
|
</exec>
|
||||||
|
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.framework.servers.tests)==0}" />
|
||||||
|
|
||||||
<exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.region.clientstack.lindenudp.tests">
|
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.region.clientstack.lindenudp.tests">
|
||||||
<arg value="./bin/OpenSim.Region.ClientStack.LindenUDP.Tests.dll" />
|
<arg value="./bin/OpenSim.Region.ClientStack.LindenUDP.Tests.dll" />
|
||||||
</exec>
|
</exec>
|
||||||
|
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.clientstack.lindenudp.tests)==0}" />
|
||||||
|
|
||||||
<exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.region.scriptengine.tests">
|
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.region.scriptengine.tests">
|
||||||
<arg value="./bin/OpenSim.Region.ScriptEngine.Tests.dll" />
|
<arg value="./bin/OpenSim.Region.ScriptEngine.Tests.dll" />
|
||||||
</exec>
|
</exec>
|
||||||
|
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.scriptengine.tests)==0}" />
|
||||||
|
|
||||||
<exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.region.coremodules.tests">
|
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.region.coremodules.tests">
|
||||||
<arg value="./bin/OpenSim.Region.CoreModules.Tests.dll" />
|
<arg value="./bin/OpenSim.Region.CoreModules.Tests.dll" />
|
||||||
</exec>
|
</exec>
|
||||||
|
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.coremodules.tests)==0}" />
|
||||||
|
|
||||||
<exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.region.framework.tests">
|
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.region.framework.tests">
|
||||||
<arg value="./bin/OpenSim.Region.Framework.Tests.dll" />
|
<arg value="./bin/OpenSim.Region.Framework.Tests.dll" />
|
||||||
</exec>
|
</exec>
|
||||||
|
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.framework.tests)==0}" />
|
||||||
|
|
||||||
<exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.data.sqlite.tests">
|
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.data.sqlite.tests">
|
||||||
<arg value="./bin/OpenSim.Data.SQLite.Tests.dll" />
|
<arg value="./bin/OpenSim.Data.SQLite.Tests.dll" />
|
||||||
</exec>
|
</exec>
|
||||||
|
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.data.sqlite.tests)==0}" />
|
||||||
|
|
||||||
<exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.data.mysql.tests">
|
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.data.mysql.tests">
|
||||||
<arg value="./bin/OpenSim.Data.MySQL.Tests.dll" />
|
<arg value="./bin/OpenSim.Data.MySQL.Tests.dll" />
|
||||||
</exec>
|
</exec>
|
||||||
|
|
||||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.framework.communications.tests)==0}" />
|
|
||||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.framework.tests)==0}" />
|
|
||||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.data.sqlite.tests)==0}" />
|
|
||||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.data.mysql.tests)==0}" />
|
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.data.mysql.tests)==0}" />
|
||||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.framework.tests)==0}" />
|
|
||||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.coremodules.tests)==0}" />
|
|
||||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.clientstack.lindenudp.tests)==0}" />
|
|
||||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.scriptengine.tests)==0}" />
|
|
||||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.framework.servers.tests)==0}" />
|
|
||||||
|
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
|
|
|
@ -59,6 +59,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
protected TarArchiveWriter m_archiveWriter;
|
protected TarArchiveWriter m_archiveWriter;
|
||||||
protected UuidGatherer m_assetGatherer;
|
protected UuidGatherer m_assetGatherer;
|
||||||
|
|
||||||
|
/// <value>
|
||||||
|
/// ID of this request
|
||||||
|
/// </value>
|
||||||
|
protected Guid m_id;
|
||||||
|
|
||||||
/// <value>
|
/// <value>
|
||||||
/// Used to collect the uuids of the assets that we need to save into the archive
|
/// Used to collect the uuids of the assets that we need to save into the archive
|
||||||
/// </value>
|
/// </value>
|
||||||
|
@ -78,8 +83,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
/// Constructor
|
/// Constructor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public InventoryArchiveWriteRequest(
|
public InventoryArchiveWriteRequest(
|
||||||
InventoryArchiverModule module, CachedUserInfo userInfo, string invPath, string savePath)
|
Guid id, InventoryArchiverModule module, CachedUserInfo userInfo, string invPath, string savePath)
|
||||||
: this(
|
: this(
|
||||||
|
id,
|
||||||
module,
|
module,
|
||||||
userInfo,
|
userInfo,
|
||||||
invPath,
|
invPath,
|
||||||
|
@ -91,8 +97,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
/// Constructor
|
/// Constructor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public InventoryArchiveWriteRequest(
|
public InventoryArchiveWriteRequest(
|
||||||
InventoryArchiverModule module, CachedUserInfo userInfo, string invPath, Stream saveStream)
|
Guid id, InventoryArchiverModule module, CachedUserInfo userInfo, string invPath, Stream saveStream)
|
||||||
{
|
{
|
||||||
|
m_id = id;
|
||||||
m_module = module;
|
m_module = module;
|
||||||
m_userInfo = userInfo;
|
m_userInfo = userInfo;
|
||||||
m_invPath = invPath;
|
m_invPath = invPath;
|
||||||
|
@ -116,7 +123,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
succeeded = false;
|
succeeded = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_module.TriggerInventoryArchiveSaved(succeeded, m_userInfo, m_invPath, m_saveStream, reportedException);
|
m_module.TriggerInventoryArchiveSaved(
|
||||||
|
m_id, succeeded, m_userInfo, m_invPath, m_saveStream, reportedException);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void SaveInvItem(InventoryItemBase inventoryItem, string path)
|
protected void SaveInvItem(InventoryItemBase inventoryItem, string path)
|
||||||
|
@ -199,7 +207,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
InventoryFolderImpl inventoryFolder = null;
|
InventoryFolderImpl inventoryFolder = null;
|
||||||
InventoryItemBase inventoryItem = null;
|
InventoryItemBase inventoryItem = null;
|
||||||
|
|
||||||
/*
|
|
||||||
if (!m_userInfo.HasReceivedInventory)
|
if (!m_userInfo.HasReceivedInventory)
|
||||||
{
|
{
|
||||||
// If the region server has access to the user admin service (by which users are created),
|
// If the region server has access to the user admin service (by which users are created),
|
||||||
|
@ -221,7 +228,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
m_userInfo.FetchInventory();
|
m_userInfo.FetchInventory();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
bool foundStar = false;
|
bool foundStar = false;
|
||||||
|
|
||||||
|
@ -274,7 +280,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
// We couldn't find the path indicated
|
// We couldn't find the path indicated
|
||||||
m_saveStream.Close();
|
m_saveStream.Close();
|
||||||
m_module.TriggerInventoryArchiveSaved(
|
m_module.TriggerInventoryArchiveSaved(
|
||||||
false, m_userInfo, m_invPath, m_saveStream,
|
m_id, false, m_userInfo, m_invPath, m_saveStream,
|
||||||
new Exception(string.Format("Could not find inventory entry at path {0}", m_invPath)));
|
new Exception(string.Format("Could not find inventory entry at path {0}", m_invPath)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The file to load and save inventory if no filename has been specified
|
/// The file to load and save inventory if no filename has been specified
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected const string DEFAULT_INV_BACKUP_FILENAME = "user-inventory_iar.tar.gz";
|
protected const string DEFAULT_INV_BACKUP_FILENAME = "user-inventory_iar.tar.gz";
|
||||||
|
|
||||||
|
/// <value>
|
||||||
|
/// Pending save completions initiated from the console
|
||||||
|
/// </value>
|
||||||
|
protected List<Guid> m_pendingConsoleSaves = new List<Guid>();
|
||||||
|
|
||||||
/// <value>
|
/// <value>
|
||||||
/// All scenes that this module knows about
|
/// All scenes that this module knows about
|
||||||
|
@ -106,32 +111,33 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
/// Trigger the inventory archive saved event.
|
/// Trigger the inventory archive saved event.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected internal void TriggerInventoryArchiveSaved(
|
protected internal void TriggerInventoryArchiveSaved(
|
||||||
bool succeeded, CachedUserInfo userInfo, string invPath, Stream saveStream, Exception reportedException)
|
Guid id, bool succeeded, CachedUserInfo userInfo, string invPath, Stream saveStream,
|
||||||
|
Exception reportedException)
|
||||||
{
|
{
|
||||||
InventoryArchiveSaved handlerInventoryArchiveSaved = OnInventoryArchiveSaved;
|
InventoryArchiveSaved handlerInventoryArchiveSaved = OnInventoryArchiveSaved;
|
||||||
if (handlerInventoryArchiveSaved != null)
|
if (handlerInventoryArchiveSaved != null)
|
||||||
handlerInventoryArchiveSaved(succeeded, userInfo, invPath, saveStream, reportedException);
|
handlerInventoryArchiveSaved(id, succeeded, userInfo, invPath, saveStream, reportedException);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ArchiveInventory(string firstName, string lastName, string invPath, Stream saveStream)
|
public void ArchiveInventory(Guid id, string firstName, string lastName, string invPath, Stream saveStream)
|
||||||
{
|
{
|
||||||
if (m_scenes.Count > 0)
|
if (m_scenes.Count > 0)
|
||||||
{
|
{
|
||||||
CachedUserInfo userInfo = GetUserInfo(firstName, lastName);
|
CachedUserInfo userInfo = GetUserInfo(firstName, lastName);
|
||||||
|
|
||||||
if (userInfo != null)
|
if (userInfo != null)
|
||||||
new InventoryArchiveWriteRequest(this, userInfo, invPath, saveStream).Execute();
|
new InventoryArchiveWriteRequest(id, this, userInfo, invPath, saveStream).Execute();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ArchiveInventory(string firstName, string lastName, string invPath, string savePath)
|
public void ArchiveInventory(Guid id, string firstName, string lastName, string invPath, string savePath)
|
||||||
{
|
{
|
||||||
if (m_scenes.Count > 0)
|
if (m_scenes.Count > 0)
|
||||||
{
|
{
|
||||||
CachedUserInfo userInfo = GetUserInfo(firstName, lastName);
|
CachedUserInfo userInfo = GetUserInfo(firstName, lastName);
|
||||||
|
|
||||||
if (userInfo != null)
|
if (userInfo != null)
|
||||||
new InventoryArchiveWriteRequest(this, userInfo, invPath, savePath).Execute();
|
new InventoryArchiveWriteRequest(id, this, userInfo, invPath, savePath).Execute();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -215,13 +221,26 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
m_log.InfoFormat(
|
m_log.InfoFormat(
|
||||||
"[INVENTORY ARCHIVER]: Saving archive {0} from inventory path {1} for {2} {3}",
|
"[INVENTORY ARCHIVER]: Saving archive {0} from inventory path {1} for {2} {3}",
|
||||||
savePath, invPath, firstName, lastName);
|
savePath, invPath, firstName, lastName);
|
||||||
|
|
||||||
ArchiveInventory(firstName, lastName, invPath, savePath);
|
Guid id = Guid.NewGuid();
|
||||||
}
|
ArchiveInventory(id, firstName, lastName, invPath, savePath);
|
||||||
|
|
||||||
|
lock (m_pendingConsoleSaves)
|
||||||
|
m_pendingConsoleSaves.Add(id);
|
||||||
|
}
|
||||||
|
|
||||||
private void SaveInvConsoleCommandCompleted(
|
private void SaveInvConsoleCommandCompleted(
|
||||||
bool succeeded, CachedUserInfo userInfo, string invPath, Stream saveStream, Exception reportedException)
|
Guid id, bool succeeded, CachedUserInfo userInfo, string invPath, Stream saveStream,
|
||||||
|
Exception reportedException)
|
||||||
{
|
{
|
||||||
|
lock (m_pendingConsoleSaves)
|
||||||
|
{
|
||||||
|
if (m_pendingConsoleSaves.Contains(id))
|
||||||
|
m_pendingConsoleSaves.Remove(id);
|
||||||
|
else
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (succeeded)
|
if (succeeded)
|
||||||
{
|
{
|
||||||
m_log.InfoFormat("[INVENTORY ARCHIVER]: Saved archive for {0}", userInfo.UserProfile.Name);
|
m_log.InfoFormat("[INVENTORY ARCHIVER]: Saved archive for {0}", userInfo.UserProfile.Name);
|
||||||
|
|
|
@ -55,6 +55,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class InventoryArchiverTests
|
public class InventoryArchiverTests
|
||||||
{
|
{
|
||||||
|
protected ManualResetEvent mre = new ManualResetEvent(false);
|
||||||
|
|
||||||
private void InventoryReceived(UUID userId)
|
private void InventoryReceived(UUID userId)
|
||||||
{
|
{
|
||||||
lock (this)
|
lock (this)
|
||||||
|
@ -64,12 +66,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SaveCompleted(
|
private void SaveCompleted(
|
||||||
bool succeeded, CachedUserInfo userInfo, string invPath, Stream saveStream, Exception reportedException)
|
Guid id, bool succeeded, CachedUserInfo userInfo, string invPath, Stream saveStream,
|
||||||
|
Exception reportedException)
|
||||||
{
|
{
|
||||||
lock (this)
|
mre.Set();
|
||||||
{
|
|
||||||
Monitor.PulseAll(this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -152,11 +152,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
||||||
MemoryStream archiveWriteStream = new MemoryStream();
|
MemoryStream archiveWriteStream = new MemoryStream();
|
||||||
archiverModule.OnInventoryArchiveSaved += SaveCompleted;
|
archiverModule.OnInventoryArchiveSaved += SaveCompleted;
|
||||||
|
|
||||||
lock (this)
|
mre.Reset();
|
||||||
{
|
archiverModule.ArchiveInventory(
|
||||||
archiverModule.ArchiveInventory(userFirstName, userLastName, "Objects", archiveWriteStream);
|
Guid.NewGuid(), userFirstName, userLastName, "Objects", archiveWriteStream);
|
||||||
Monitor.Wait(this, 60000);
|
mre.WaitOne();
|
||||||
}
|
|
||||||
|
|
||||||
byte[] archive = archiveWriteStream.ToArray();
|
byte[] archive = archiveWriteStream.ToArray();
|
||||||
MemoryStream archiveReadStream = new MemoryStream(archive);
|
MemoryStream archiveReadStream = new MemoryStream(archive);
|
||||||
|
|
|
@ -34,13 +34,14 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used for the OnInventoryArchiveSaved event.
|
/// Used for the OnInventoryArchiveSaved event.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="id">Request id</param>
|
||||||
/// <param name="succeeded">true if the save succeeded, false otherwise</param>
|
/// <param name="succeeded">true if the save succeeded, false otherwise</param>
|
||||||
/// <param name="userInfo">The user for whom the save was conducted</param>
|
/// <param name="userInfo">The user for whom the save was conducted</param>
|
||||||
/// <param name="invPath">The inventory path saved</param>
|
/// <param name="invPath">The inventory path saved</param>
|
||||||
/// <param name="savePath">The stream to which the archive was saved</param>
|
/// <param name="savePath">The stream to which the archive was saved</param>
|
||||||
/// <param name="reportedException">Contains the exception generated if the save did not succeed</param>
|
/// <param name="reportedException">Contains the exception generated if the save did not succeed</param>
|
||||||
public delegate void InventoryArchiveSaved(
|
public delegate void InventoryArchiveSaved(
|
||||||
bool succeeded, CachedUserInfo userInfo, string invPath, Stream saveStream, Exception reportedException);
|
Guid id, bool succeeded, CachedUserInfo userInfo, string invPath, Stream saveStream, Exception reportedException);
|
||||||
|
|
||||||
public interface IInventoryArchiverModule
|
public interface IInventoryArchiverModule
|
||||||
{
|
{
|
||||||
|
@ -61,10 +62,11 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Archive a user's inventory folder to the given stream
|
/// Archive a user's inventory folder to the given stream
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="id">ID representing this request. This will later be returned in the save event</param>
|
||||||
/// <param name="firstName"></param>
|
/// <param name="firstName"></param>
|
||||||
/// <param name="lastName"></param>
|
/// <param name="lastName"></param>
|
||||||
/// <param name="invPath">The inventory path from which the inventory should be saved.</param>
|
/// <param name="invPath">The inventory path from which the inventory should be saved.</param>
|
||||||
/// <param name="saveStream">The stream to which the inventory archive will be saved</param>
|
/// <param name="saveStream">The stream to which the inventory archive will be saved</param>
|
||||||
void ArchiveInventory(string firstName, string lastName, string invPath, Stream saveStream);
|
void ArchiveInventory(Guid id, string firstName, string lastName, string invPath, Stream saveStream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue