Merge branch 'master' into careminster-presence-refactor
commit
542e6b8af4
|
@ -127,15 +127,10 @@
|
||||||
</exec>
|
</exec>
|
||||||
<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.framework.tests)==0}" />
|
||||||
|
|
||||||
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.data.sqlite.tests">
|
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.data.tests">
|
||||||
<arg value="./bin/OpenSim.Data.SQLite.Tests.dll" />
|
<arg value="./bin/OpenSim.Data.Tests.dll" />
|
||||||
</exec>
|
</exec>
|
||||||
<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.tests)==0}" />
|
||||||
|
|
||||||
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.data.mysql.tests">
|
|
||||||
<arg value="./bin/OpenSim.Data.MySQL.Tests.dll" />
|
|
||||||
</exec>
|
|
||||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.data.mysql.tests)==0}" />
|
|
||||||
|
|
||||||
<delete dir="%temp%"/>
|
<delete dir="%temp%"/>
|
||||||
|
|
||||||
|
@ -297,14 +292,9 @@
|
||||||
<arg value="-xml=test-results/OpenSim.Region.Framework.Tests.dll-Results.xml" />
|
<arg value="-xml=test-results/OpenSim.Region.Framework.Tests.dll-Results.xml" />
|
||||||
</exec>
|
</exec>
|
||||||
|
|
||||||
<exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.data.sqlite.tests">
|
<exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.data.tests">
|
||||||
<arg value="./bin/OpenSim.Data.SQLite.Tests.dll" />
|
<arg value="./bin/OpenSim.Data.Tests.dll" />
|
||||||
<arg value="-xml=test-results/OpenSim.Data.SQLite.Tests.dll-Results.xml" />
|
<arg value="-xml=test-results/OpenSim.Data.Tests.dll-Results.xml" />
|
||||||
</exec>
|
|
||||||
|
|
||||||
<exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.data.mysql.tests">
|
|
||||||
<arg value="./bin/OpenSim.Data.MySQL.Tests.dll" />
|
|
||||||
<arg value="-xml=test-results/OpenSim.Data.MySQL.Tests.dll-Results.xml" />
|
|
||||||
</exec>
|
</exec>
|
||||||
|
|
||||||
<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.framework.tests)==0}" />
|
||||||
|
@ -313,8 +303,7 @@
|
||||||
<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.region.scriptengine.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.coremodules.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.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.tests)==0}" />
|
||||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.data.mysql.tests)==0}" />
|
|
||||||
|
|
||||||
</target>
|
</target>
|
||||||
<!-- <exec program="nunit-console.exe" failonerror="false" resultproperty="testresult.acceptancetestassembly"> -->
|
<!-- <exec program="nunit-console.exe" failonerror="false" resultproperty="testresult.acceptancetestassembly"> -->
|
||||||
|
|
|
@ -39,8 +39,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
||||||
|
|
||||||
public class RestAppearanceServices : IRest
|
public class RestAppearanceServices : IRest
|
||||||
{
|
{
|
||||||
|
// private static readonly int PARM_USERID = 0;
|
||||||
private static readonly int PARM_USERID = 0;
|
|
||||||
|
|
||||||
// private static readonly int PARM_PATH = 1;
|
// private static readonly int PARM_PATH = 1;
|
||||||
|
|
||||||
|
@ -64,6 +63,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
||||||
{
|
{
|
||||||
Rest.Log.InfoFormat("{0} Domain is relative, adding absolute prefix", MsgId);
|
Rest.Log.InfoFormat("{0} Domain is relative, adding absolute prefix", MsgId);
|
||||||
qPrefix = String.Format("{0}{1}{2}", Rest.Prefix, Rest.UrlPathSeparator, qPrefix);
|
qPrefix = String.Format("{0}{1}{2}", Rest.Prefix, Rest.UrlPathSeparator, qPrefix);
|
||||||
|
qPrefix = String.Format("{0}{1}{2}", Rest.Prefix, Rest.UrlPathSeparator, qPrefix);
|
||||||
Rest.Log.InfoFormat("{0} Domain is now <{1}>", MsgId, qPrefix);
|
Rest.Log.InfoFormat("{0} Domain is now <{1}>", MsgId, qPrefix);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -294,31 +294,31 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name=rdata>HTTP service request work area</param>
|
/// <param name=rdata>HTTP service request work area</param>
|
||||||
|
|
||||||
private void DoGet(AppearanceRequestData rdata)
|
// private void DoGet(AppearanceRequestData rdata)
|
||||||
{
|
// {
|
||||||
AvatarData adata = Rest.AvatarServices.GetAvatar(rdata.userProfile.ID);
|
// AvatarData adata = Rest.AvatarServices.GetAvatar(rdata.userProfile.ID);
|
||||||
|
//
|
||||||
if (adata == null)
|
// if (adata == null)
|
||||||
{
|
// {
|
||||||
rdata.Fail(Rest.HttpStatusCodeNoContent,
|
// rdata.Fail(Rest.HttpStatusCodeNoContent,
|
||||||
String.Format("appearance data not found for user {0} {1}",
|
// String.Format("appearance data not found for user {0} {1}",
|
||||||
rdata.userProfile.FirstName, rdata.userProfile.SurName));
|
// rdata.userProfile.FirstName, rdata.userProfile.SurName));
|
||||||
}
|
// }
|
||||||
rdata.userAppearance = adata.ToAvatarAppearance(rdata.userProfile.ID);
|
// rdata.userAppearance = adata.ToAvatarAppearance(rdata.userProfile.ID);
|
||||||
|
//
|
||||||
rdata.initXmlWriter();
|
// rdata.initXmlWriter();
|
||||||
|
//
|
||||||
FormatUserAppearance(rdata);
|
// FormatUserAppearance(rdata);
|
||||||
|
//
|
||||||
// Indicate a successful request
|
// // Indicate a successful request
|
||||||
|
//
|
||||||
rdata.Complete();
|
// rdata.Complete();
|
||||||
|
//
|
||||||
// Send the response to the user. The body will be implicitly
|
// // Send the response to the user. The body will be implicitly
|
||||||
// constructed from the result of the XML writer.
|
// // constructed from the result of the XML writer.
|
||||||
|
//
|
||||||
rdata.Respond(String.Format("Appearance {0} Normal completion", rdata.method));
|
// rdata.Respond(String.Format("Appearance {0} Normal completion", rdata.method));
|
||||||
}
|
// }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// POST adds NEW information to the user profile database.
|
/// POST adds NEW information to the user profile database.
|
||||||
|
@ -326,112 +326,112 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
||||||
/// characteristics supplied in the request.
|
/// characteristics supplied in the request.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
||||||
private void DoExtend(AppearanceRequestData rdata)
|
// private void DoExtend(AppearanceRequestData rdata)
|
||||||
{
|
// {
|
||||||
|
//
|
||||||
bool created = false;
|
// bool created = false;
|
||||||
bool modified = false;
|
// bool modified = false;
|
||||||
string newnode = String.Empty;
|
// string newnode = String.Empty;
|
||||||
|
//
|
||||||
Rest.Log.DebugFormat("{0} POST ENTRY", MsgId);
|
// Rest.Log.DebugFormat("{0} POST ENTRY", MsgId);
|
||||||
|
//
|
||||||
//AvatarAppearance old = Rest.AvatarServices.GetUserAppearance(rdata.userProfile.ID);
|
// //AvatarAppearance old = Rest.AvatarServices.GetUserAppearance(rdata.userProfile.ID);
|
||||||
|
//
|
||||||
rdata.userAppearance = new AvatarAppearance();
|
// rdata.userAppearance = new AvatarAppearance();
|
||||||
|
//
|
||||||
// Although the following behavior is admitted by HTTP I am becoming
|
// // Although the following behavior is admitted by HTTP I am becoming
|
||||||
// increasingly doubtful that it is appropriate for REST. If I attempt to
|
// // increasingly doubtful that it is appropriate for REST. If I attempt to
|
||||||
// add a new record, and it already exists, then it seems to me that the
|
// // add a new record, and it already exists, then it seems to me that the
|
||||||
// attempt should fail, rather than update the existing record.
|
// // attempt should fail, rather than update the existing record.
|
||||||
AvatarData adata = null;
|
// AvatarData adata = null;
|
||||||
if (GetUserAppearance(rdata))
|
// if (GetUserAppearance(rdata))
|
||||||
{
|
// {
|
||||||
modified = rdata.userAppearance != null;
|
// modified = rdata.userAppearance != null;
|
||||||
created = !modified;
|
// created = !modified;
|
||||||
adata = new AvatarData(rdata.userAppearance);
|
// adata = new AvatarData(rdata.userAppearance);
|
||||||
Rest.AvatarServices.SetAvatar(rdata.userProfile.ID, adata);
|
// Rest.AvatarServices.SetAvatar(rdata.userProfile.ID, adata);
|
||||||
// Rest.UserServices.UpdateUserProfile(rdata.userProfile);
|
// // Rest.UserServices.UpdateUserProfile(rdata.userProfile);
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
created = true;
|
// created = true;
|
||||||
adata = new AvatarData(rdata.userAppearance);
|
// adata = new AvatarData(rdata.userAppearance);
|
||||||
Rest.AvatarServices.SetAvatar(rdata.userProfile.ID, adata);
|
// Rest.AvatarServices.SetAvatar(rdata.userProfile.ID, adata);
|
||||||
// Rest.UserServices.UpdateUserProfile(rdata.userProfile);
|
// // Rest.UserServices.UpdateUserProfile(rdata.userProfile);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (created)
|
// if (created)
|
||||||
{
|
// {
|
||||||
newnode = String.Format("{0} {1}", rdata.userProfile.FirstName,
|
// newnode = String.Format("{0} {1}", rdata.userProfile.FirstName,
|
||||||
rdata.userProfile.SurName);
|
// rdata.userProfile.SurName);
|
||||||
// Must include a location header with a URI that identifies the new resource.
|
// // Must include a location header with a URI that identifies the new resource.
|
||||||
|
//
|
||||||
rdata.AddHeader(Rest.HttpHeaderLocation,String.Format("http://{0}{1}:{2}{3}{4}",
|
// rdata.AddHeader(Rest.HttpHeaderLocation,String.Format("http://{0}{1}:{2}{3}{4}",
|
||||||
rdata.hostname,rdata.port,rdata.path,Rest.UrlPathSeparator, newnode));
|
// rdata.hostname,rdata.port,rdata.path,Rest.UrlPathSeparator, newnode));
|
||||||
rdata.Complete(Rest.HttpStatusCodeCreated);
|
// rdata.Complete(Rest.HttpStatusCodeCreated);
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
if (modified)
|
// if (modified)
|
||||||
{
|
// {
|
||||||
rdata.Complete(Rest.HttpStatusCodeOK);
|
// rdata.Complete(Rest.HttpStatusCodeOK);
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
rdata.Complete(Rest.HttpStatusCodeNoContent);
|
// rdata.Complete(Rest.HttpStatusCodeNoContent);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
rdata.Respond(String.Format("Appearance {0} : Normal completion", rdata.method));
|
// rdata.Respond(String.Format("Appearance {0} : Normal completion", rdata.method));
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This updates the user's appearance. not all aspects need to be provided,
|
/// This updates the user's appearance. not all aspects need to be provided,
|
||||||
/// only those supplied will be changed.
|
/// only those supplied will be changed.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
||||||
private void DoUpdate(AppearanceRequestData rdata)
|
// private void DoUpdate(AppearanceRequestData rdata)
|
||||||
{
|
// {
|
||||||
|
//
|
||||||
// REFACTORING PROBLEM This was commented out. It doesn't work for 0.7
|
// // REFACTORING PROBLEM This was commented out. It doesn't work for 0.7
|
||||||
|
//
|
||||||
//bool created = false;
|
// //bool created = false;
|
||||||
//bool modified = false;
|
// //bool modified = false;
|
||||||
|
//
|
||||||
|
//
|
||||||
//rdata.userAppearance = Rest.AvatarServices.GetUserAppearance(rdata.userProfile.ID);
|
// //rdata.userAppearance = Rest.AvatarServices.GetUserAppearance(rdata.userProfile.ID);
|
||||||
|
//
|
||||||
//// If the user exists then this is considered a modification regardless
|
// //// If the user exists then this is considered a modification regardless
|
||||||
//// of what may, or may not be, specified in the payload.
|
// //// of what may, or may not be, specified in the payload.
|
||||||
|
//
|
||||||
//if (rdata.userAppearance != null)
|
// //if (rdata.userAppearance != null)
|
||||||
//{
|
// //{
|
||||||
// modified = true;
|
// // modified = true;
|
||||||
// Rest.AvatarServices.UpdateUserAppearance(rdata.userProfile.ID, rdata.userAppearance);
|
// // Rest.AvatarServices.UpdateUserAppearance(rdata.userProfile.ID, rdata.userAppearance);
|
||||||
// Rest.UserServices.UpdateUserProfile(rdata.userProfile);
|
// // Rest.UserServices.UpdateUserProfile(rdata.userProfile);
|
||||||
//}
|
// //}
|
||||||
|
//
|
||||||
//if (created)
|
// //if (created)
|
||||||
//{
|
// //{
|
||||||
// rdata.Complete(Rest.HttpStatusCodeCreated);
|
// // rdata.Complete(Rest.HttpStatusCodeCreated);
|
||||||
//}
|
// //}
|
||||||
//else
|
// //else
|
||||||
//{
|
// //{
|
||||||
// if (modified)
|
// // if (modified)
|
||||||
// {
|
// // {
|
||||||
// rdata.Complete(Rest.HttpStatusCodeOK);
|
// // rdata.Complete(Rest.HttpStatusCodeOK);
|
||||||
// }
|
// // }
|
||||||
// else
|
// // else
|
||||||
// {
|
// // {
|
||||||
// rdata.Complete(Rest.HttpStatusCodeNoContent);
|
// // rdata.Complete(Rest.HttpStatusCodeNoContent);
|
||||||
// }
|
// // }
|
||||||
//}
|
// //}
|
||||||
|
//
|
||||||
rdata.Respond(String.Format("Appearance {0} : Normal completion", rdata.method));
|
// rdata.Respond(String.Format("Appearance {0} : Normal completion", rdata.method));
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Delete the specified user's appearance. This actually performs a reset
|
/// Delete the specified user's appearance. This actually performs a reset
|
||||||
|
@ -439,31 +439,29 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
||||||
/// Existing ownership is preserved. All prior updates are lost and can not
|
/// Existing ownership is preserved. All prior updates are lost and can not
|
||||||
/// be recovered.
|
/// be recovered.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
// private void DoDelete(AppearanceRequestData rdata)
|
||||||
private void DoDelete(AppearanceRequestData rdata)
|
// {
|
||||||
{
|
// AvatarData adata = Rest.AvatarServices.GetAvatar(rdata.userProfile.ID);
|
||||||
AvatarData adata = Rest.AvatarServices.GetAvatar(rdata.userProfile.ID);
|
//
|
||||||
|
// if (adata != null)
|
||||||
if (adata != null)
|
// {
|
||||||
{
|
// AvatarAppearance old = adata.ToAvatarAppearance(rdata.userProfile.ID);
|
||||||
AvatarAppearance old = adata.ToAvatarAppearance(rdata.userProfile.ID);
|
// rdata.userAppearance = new AvatarAppearance();
|
||||||
rdata.userAppearance = new AvatarAppearance();
|
// rdata.userAppearance.Owner = old.Owner;
|
||||||
rdata.userAppearance.Owner = old.Owner;
|
// adata = new AvatarData(rdata.userAppearance);
|
||||||
adata = new AvatarData(rdata.userAppearance);
|
//
|
||||||
|
// Rest.AvatarServices.SetAvatar(rdata.userProfile.ID, adata);
|
||||||
Rest.AvatarServices.SetAvatar(rdata.userProfile.ID, adata);
|
//
|
||||||
|
// rdata.Complete();
|
||||||
rdata.Complete();
|
// }
|
||||||
}
|
// else
|
||||||
else
|
// {
|
||||||
{
|
//
|
||||||
|
// rdata.Complete(Rest.HttpStatusCodeNoContent);
|
||||||
rdata.Complete(Rest.HttpStatusCodeNoContent);
|
// }
|
||||||
}
|
//
|
||||||
|
// rdata.Respond(String.Format("Appearance {0} : Normal completion", rdata.method));
|
||||||
rdata.Respond(String.Format("Appearance {0} : Normal completion", rdata.method));
|
// }
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion method-specific processing
|
#endregion method-specific processing
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -141,7 +141,17 @@ namespace OpenSim.Framework.Console
|
||||||
CommandInfo commandInfo = (CommandInfo)dict[String.Empty];
|
CommandInfo commandInfo = (CommandInfo)dict[String.Empty];
|
||||||
help.Add(commandInfo.help_text);
|
help.Add(commandInfo.help_text);
|
||||||
help.Add(commandInfo.long_help);
|
help.Add(commandInfo.long_help);
|
||||||
|
|
||||||
|
string descriptiveHelp = commandInfo.descriptive_help;
|
||||||
|
|
||||||
|
// If we do have some descriptive help then insert a spacing line before and after for readability.
|
||||||
|
if (descriptiveHelp != string.Empty)
|
||||||
|
help.Add(string.Empty);
|
||||||
|
|
||||||
help.Add(commandInfo.descriptive_help);
|
help.Add(commandInfo.descriptive_help);
|
||||||
|
|
||||||
|
if (descriptiveHelp != string.Empty)
|
||||||
|
help.Add(string.Empty);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -182,8 +192,7 @@ namespace OpenSim.Framework.Console
|
||||||
public void AddCommand(string module, bool shared, string command,
|
public void AddCommand(string module, bool shared, string command,
|
||||||
string help, string longhelp, CommandDelegate fn)
|
string help, string longhelp, CommandDelegate fn)
|
||||||
{
|
{
|
||||||
AddCommand(module, shared, command, help, longhelp,
|
AddCommand(module, shared, command, help, longhelp, String.Empty, fn);
|
||||||
String.Empty, fn);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -286,7 +286,11 @@ namespace OpenSim.Framework.Servers
|
||||||
|
|
||||||
EnhanceVersionInformation();
|
EnhanceVersionInformation();
|
||||||
|
|
||||||
m_log.Info("[STARTUP]: Version: " + m_version + "\n");
|
m_log.Info("[STARTUP]: OpenSimulator version: " + m_version + Environment.NewLine);
|
||||||
|
// clr version potentially is more confusing than helpful, since it doesn't tell us if we're running under Mono/MS .NET and
|
||||||
|
// the clr version number doesn't match the project version number under Mono.
|
||||||
|
//m_log.Info("[STARTUP]: Virtual machine runtime version: " + Environment.Version + Environment.NewLine);
|
||||||
|
m_log.Info("[STARTUP]: Operating system version: " + Environment.OSVersion + Environment.NewLine);
|
||||||
|
|
||||||
StartupSpecific();
|
StartupSpecific();
|
||||||
|
|
||||||
|
|
|
@ -251,14 +251,20 @@ namespace OpenSim
|
||||||
"Save named prim to XML2", SavePrimsXml2);
|
"Save named prim to XML2", SavePrimsXml2);
|
||||||
|
|
||||||
m_console.Commands.AddCommand("region", false, "load oar",
|
m_console.Commands.AddCommand("region", false, "load oar",
|
||||||
"load oar [--merge] [--skip-assets] <oar name>",
|
"load oar [--merge] [--skip-assets] [<OAR path>]",
|
||||||
"Load a region's data from OAR archive. --merge will merge the oar with the existing scene. --skip-assets will load the oar but ignore the assets it contains",
|
"Load a region's data from an OAR archive.",
|
||||||
|
"--merge will merge the OAR with the existing scene." + Environment.NewLine
|
||||||
|
+ "--skip-assets will load the OAR but ignore the assets it contains." + Environment.NewLine
|
||||||
|
+ "The path can be either a filesystem location or a URI."
|
||||||
|
+ " If this is not given then the command looks for an OAR named region.oar in the current directory.",
|
||||||
LoadOar);
|
LoadOar);
|
||||||
|
|
||||||
m_console.Commands.AddCommand("region", false, "save oar",
|
m_console.Commands.AddCommand("region", false, "save oar",
|
||||||
"save oar <oar name>",
|
"save oar [<OAR path>]",
|
||||||
"Save a region's data to an OAR archive",
|
"Save a region's data to an OAR archive.",
|
||||||
"More information on forthcoming options here soon", SaveOar);
|
"The OAR path must be a filesystem path."
|
||||||
|
+ " If this is not given then the oar is saved to region.oar in the current directory.",
|
||||||
|
SaveOar);
|
||||||
|
|
||||||
m_console.Commands.AddCommand("region", false, "edit scale",
|
m_console.Commands.AddCommand("region", false, "edit scale",
|
||||||
"edit scale <name> <x> <y> <z>",
|
"edit scale <name> <x> <y> <z>",
|
||||||
|
|
|
@ -37,7 +37,6 @@ using log4net;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Communications;
|
using OpenSim.Framework.Communications;
|
||||||
|
|
||||||
using OpenSim.Framework.Communications.Osp;
|
using OpenSim.Framework.Communications.Osp;
|
||||||
using OpenSim.Framework.Serialization;
|
using OpenSim.Framework.Serialization;
|
||||||
using OpenSim.Framework.Serialization.External;
|
using OpenSim.Framework.Serialization.External;
|
||||||
|
@ -72,7 +71,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
scene,
|
scene,
|
||||||
userInfo,
|
userInfo,
|
||||||
invPath,
|
invPath,
|
||||||
new GZipStream(new FileStream(loadPath, FileMode.Open), CompressionMode.Decompress))
|
new GZipStream(ArchiveHelpers.GetStream(loadPath), CompressionMode.Decompress))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,6 @@ using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Serialization;
|
using OpenSim.Framework.Serialization;
|
||||||
using OpenSim.Framework.Serialization.External;
|
using OpenSim.Framework.Serialization.External;
|
||||||
using OpenSim.Framework.Communications;
|
using OpenSim.Framework.Communications;
|
||||||
|
|
||||||
using OpenSim.Framework.Communications.Osp;
|
using OpenSim.Framework.Communications.Osp;
|
||||||
using OpenSim.Region.CoreModules.World.Archiver;
|
using OpenSim.Region.CoreModules.World.Archiver;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
|
|
|
@ -91,13 +91,26 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
|
|
||||||
scene.AddCommand(
|
scene.AddCommand(
|
||||||
this, "load iar",
|
this, "load iar",
|
||||||
"load iar <first> <last> <inventory path> <password> [<archive path>]",
|
"load iar <first> <last> <inventory path> <password> [<IAR path>]",
|
||||||
"Load user inventory archive.", HandleLoadInvConsoleCommand);
|
"Load user inventory archive (IAR).",
|
||||||
|
"<first> is user's first name." + Environment.NewLine
|
||||||
|
+ "<last> is user's last name." + Environment.NewLine
|
||||||
|
+ "<inventory path> is the path inside the user's inventory where the IAR should be loaded." + Environment.NewLine
|
||||||
|
+ "<password> is the user's password." + Environment.NewLine
|
||||||
|
+ "<IAR path> is the filesystem path or URI from which to load the IAR."
|
||||||
|
+ string.Format(" If this is not given then the filename {0} in the current directory is used", DEFAULT_INV_BACKUP_FILENAME),
|
||||||
|
HandleLoadInvConsoleCommand);
|
||||||
|
|
||||||
scene.AddCommand(
|
scene.AddCommand(
|
||||||
this, "save iar",
|
this, "save iar",
|
||||||
"save iar <first> <last> <inventory path> <password> [<archive path>]",
|
"save iar <first> <last> <inventory path> <password> [<IAR path>]",
|
||||||
"Save user inventory archive.", HandleSaveInvConsoleCommand);
|
"Save user inventory archive (IAR).",
|
||||||
|
"<first> is the user's first name." + Environment.NewLine
|
||||||
|
+ "<last> is the user's last name." + Environment.NewLine
|
||||||
|
+ "<inventory path> is the path inside the user's inventory for the folder/item to be saved." + Environment.NewLine
|
||||||
|
+ "<IAR path> is the filesystem path at which to save the IAR."
|
||||||
|
+ string.Format(" If this is not given then the filename {0} in the current directory is used", DEFAULT_INV_BACKUP_FILENAME),
|
||||||
|
HandleSaveInvConsoleCommand);
|
||||||
|
|
||||||
m_aScene = scene;
|
m_aScene = scene;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,6 @@ using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Serialization;
|
using OpenSim.Framework.Serialization;
|
||||||
using OpenSim.Framework.Serialization.External;
|
using OpenSim.Framework.Serialization.External;
|
||||||
using OpenSim.Framework.Communications;
|
using OpenSim.Framework.Communications;
|
||||||
|
|
||||||
using OpenSim.Framework.Communications.Osp;
|
using OpenSim.Framework.Communications.Osp;
|
||||||
using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver;
|
using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver;
|
||||||
using OpenSim.Region.CoreModules.World.Serialiser;
|
using OpenSim.Region.CoreModules.World.Serialiser;
|
||||||
|
@ -77,125 +76,118 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
||||||
// Commenting for now! The mock inventory service needs more beef, at least for
|
// Commenting for now! The mock inventory service needs more beef, at least for
|
||||||
// GetFolderForType
|
// GetFolderForType
|
||||||
// REFACTORING PROBLEM. This needs to be rewritten.
|
// REFACTORING PROBLEM. This needs to be rewritten.
|
||||||
|
//[Test]
|
||||||
|
public void TestSaveIarV0_1()
|
||||||
|
{
|
||||||
|
TestHelper.InMethod();
|
||||||
|
log4net.Config.XmlConfigurator.Configure();
|
||||||
|
|
||||||
// [Test]
|
InventoryArchiverModule archiverModule = new InventoryArchiverModule(true);
|
||||||
// public void TestSaveIarV0_1()
|
|
||||||
// {
|
|
||||||
// TestHelper.InMethod();
|
|
||||||
// //log4net.Config.XmlConfigurator.Configure();
|
|
||||||
|
|
||||||
// InventoryArchiverModule archiverModule = new InventoryArchiverModule(true);
|
Scene scene = SceneSetupHelpers.SetupScene("Inventory");
|
||||||
|
SceneSetupHelpers.SetupSceneModules(scene, archiverModule);
|
||||||
|
|
||||||
// Scene scene = SceneSetupHelpers.SetupScene("Inventory");
|
// Create user
|
||||||
// SceneSetupHelpers.SetupSceneModules(scene, archiverModule);
|
string userFirstName = "Jock";
|
||||||
// CommunicationsManager cm = scene.CommsManager;
|
string userLastName = "Stirrup";
|
||||||
|
string userPassword = "troll";
|
||||||
|
UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020");
|
||||||
|
UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userId, userPassword);
|
||||||
|
|
||||||
// // Create user
|
// Create asset
|
||||||
// string userFirstName = "Jock";
|
SceneObjectGroup object1;
|
||||||
// string userLastName = "Stirrup";
|
SceneObjectPart part1;
|
||||||
// UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020");
|
{
|
||||||
|
string partName = "My Little Dog Object";
|
||||||
|
UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040");
|
||||||
|
PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere();
|
||||||
|
Vector3 groupPosition = new Vector3(10, 20, 30);
|
||||||
|
Quaternion rotationOffset = new Quaternion(20, 30, 40, 50);
|
||||||
|
Vector3 offsetPosition = new Vector3(5, 10, 15);
|
||||||
|
|
||||||
// lock (this)
|
part1
|
||||||
// {
|
= new SceneObjectPart(
|
||||||
// UserProfileTestUtils.CreateUserWithInventory(
|
ownerId, shape, groupPosition, rotationOffset, offsetPosition);
|
||||||
// cm, userFirstName, userLastName, userId, InventoryReceived);
|
part1.Name = partName;
|
||||||
// Monitor.Wait(this, 60000);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // Create asset
|
object1 = new SceneObjectGroup(part1);
|
||||||
// SceneObjectGroup object1;
|
scene.AddNewSceneObject(object1, false);
|
||||||
// SceneObjectPart part1;
|
}
|
||||||
// {
|
|
||||||
// string partName = "My Little Dog Object";
|
|
||||||
// UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040");
|
|
||||||
// PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere();
|
|
||||||
// Vector3 groupPosition = new Vector3(10, 20, 30);
|
|
||||||
// Quaternion rotationOffset = new Quaternion(20, 30, 40, 50);
|
|
||||||
// Vector3 offsetPosition = new Vector3(5, 10, 15);
|
|
||||||
|
|
||||||
// part1
|
UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060");
|
||||||
// = new SceneObjectPart(
|
AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1);
|
||||||
// ownerId, shape, groupPosition, rotationOffset, offsetPosition);
|
scene.AssetService.Store(asset1);
|
||||||
// part1.Name = partName;
|
|
||||||
|
|
||||||
// object1 = new SceneObjectGroup(part1);
|
// Create item
|
||||||
// scene.AddNewSceneObject(object1, false);
|
UUID item1Id = UUID.Parse("00000000-0000-0000-0000-000000000080");
|
||||||
// }
|
InventoryItemBase item1 = new InventoryItemBase();
|
||||||
|
item1.Name = "My Little Dog";
|
||||||
|
item1.AssetID = asset1.FullID;
|
||||||
|
item1.ID = item1Id;
|
||||||
|
InventoryFolderBase objsFolder
|
||||||
|
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects");
|
||||||
|
item1.Folder = objsFolder.ID;
|
||||||
|
scene.AddInventoryItem(userId, item1);
|
||||||
|
|
||||||
// UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060");
|
MemoryStream archiveWriteStream = new MemoryStream();
|
||||||
// AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1);
|
archiverModule.OnInventoryArchiveSaved += SaveCompleted;
|
||||||
// scene.AssetService.Store(asset1);
|
|
||||||
|
|
||||||
// // Create item
|
mre.Reset();
|
||||||
// UUID item1Id = UUID.Parse("00000000-0000-0000-0000-000000000080");
|
archiverModule.ArchiveInventory(
|
||||||
// InventoryItemBase item1 = new InventoryItemBase();
|
Guid.NewGuid(), userFirstName, userLastName, "Objects", userPassword, archiveWriteStream);
|
||||||
// item1.Name = "My Little Dog";
|
mre.WaitOne(60000, false);
|
||||||
// item1.AssetID = asset1.FullID;
|
|
||||||
// item1.ID = item1Id;
|
|
||||||
// InventoryFolderBase objsFolder
|
|
||||||
// = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects");
|
|
||||||
// item1.Folder = objsFolder.ID;
|
|
||||||
// scene.AddInventoryItem(userId, item1);
|
|
||||||
|
|
||||||
// MemoryStream archiveWriteStream = new MemoryStream();
|
byte[] archive = archiveWriteStream.ToArray();
|
||||||
// archiverModule.OnInventoryArchiveSaved += SaveCompleted;
|
MemoryStream archiveReadStream = new MemoryStream(archive);
|
||||||
|
TarArchiveReader tar = new TarArchiveReader(archiveReadStream);
|
||||||
|
|
||||||
// mre.Reset();
|
//bool gotControlFile = false;
|
||||||
// archiverModule.ArchiveInventory(
|
bool gotObject1File = false;
|
||||||
// Guid.NewGuid(), userFirstName, userLastName, "Objects", "troll", archiveWriteStream);
|
//bool gotObject2File = false;
|
||||||
// mre.WaitOne(60000, false);
|
string expectedObject1FileName = InventoryArchiveWriteRequest.CreateArchiveItemName(item1);
|
||||||
|
string expectedObject1FilePath = string.Format(
|
||||||
|
"{0}{1}{2}",
|
||||||
|
ArchiveConstants.INVENTORY_PATH,
|
||||||
|
InventoryArchiveWriteRequest.CreateArchiveFolderName(objsFolder),
|
||||||
|
expectedObject1FileName);
|
||||||
|
|
||||||
// byte[] archive = archiveWriteStream.ToArray();
|
string filePath;
|
||||||
// MemoryStream archiveReadStream = new MemoryStream(archive);
|
TarArchiveReader.TarEntryType tarEntryType;
|
||||||
// TarArchiveReader tar = new TarArchiveReader(archiveReadStream);
|
|
||||||
|
|
||||||
// //bool gotControlFile = false;
|
|
||||||
// bool gotObject1File = false;
|
|
||||||
// //bool gotObject2File = false;
|
|
||||||
// string expectedObject1FileName = InventoryArchiveWriteRequest.CreateArchiveItemName(item1);
|
|
||||||
// string expectedObject1FilePath = string.Format(
|
|
||||||
// "{0}{1}{2}",
|
|
||||||
// ArchiveConstants.INVENTORY_PATH,
|
|
||||||
// InventoryArchiveWriteRequest.CreateArchiveFolderName(objsFolder),
|
|
||||||
// expectedObject1FileName);
|
|
||||||
|
|
||||||
// string filePath;
|
|
||||||
// TarArchiveReader.TarEntryType tarEntryType;
|
|
||||||
|
|
||||||
// Console.WriteLine("Reading archive");
|
// Console.WriteLine("Reading archive");
|
||||||
|
|
||||||
// while (tar.ReadEntry(out filePath, out tarEntryType) != null)
|
while (tar.ReadEntry(out filePath, out tarEntryType) != null)
|
||||||
// {
|
{
|
||||||
// Console.WriteLine("Got {0}", filePath);
|
Console.WriteLine("Got {0}", filePath);
|
||||||
|
|
||||||
//// if (ArchiveConstants.CONTROL_FILE_PATH == filePath)
|
// if (ArchiveConstants.CONTROL_FILE_PATH == filePath)
|
||||||
//// {
|
|
||||||
//// gotControlFile = true;
|
|
||||||
//// }
|
|
||||||
|
|
||||||
// if (filePath.StartsWith(ArchiveConstants.INVENTORY_PATH) && filePath.EndsWith(".xml"))
|
|
||||||
// {
|
// {
|
||||||
//// string fileName = filePath.Remove(0, "Objects/".Length);
|
// gotControlFile = true;
|
||||||
////
|
|
||||||
//// if (fileName.StartsWith(part1.Name))
|
|
||||||
//// {
|
|
||||||
// Assert.That(expectedObject1FilePath, Is.EqualTo(filePath));
|
|
||||||
// gotObject1File = true;
|
|
||||||
//// }
|
|
||||||
//// else if (fileName.StartsWith(part2.Name))
|
|
||||||
//// {
|
|
||||||
//// Assert.That(fileName, Is.EqualTo(expectedObject2FileName));
|
|
||||||
//// gotObject2File = true;
|
|
||||||
//// }
|
|
||||||
// }
|
// }
|
||||||
// }
|
|
||||||
|
|
||||||
//// Assert.That(gotControlFile, Is.True, "No control file in archive");
|
if (filePath.StartsWith(ArchiveConstants.INVENTORY_PATH) && filePath.EndsWith(".xml"))
|
||||||
// Assert.That(gotObject1File, Is.True, "No item1 file in archive");
|
{
|
||||||
//// Assert.That(gotObject2File, Is.True, "No object2 file in archive");
|
// string fileName = filePath.Remove(0, "Objects/".Length);
|
||||||
|
//
|
||||||
|
// if (fileName.StartsWith(part1.Name))
|
||||||
|
// {
|
||||||
|
Assert.That(expectedObject1FilePath, Is.EqualTo(filePath));
|
||||||
|
gotObject1File = true;
|
||||||
|
// }
|
||||||
|
// else if (fileName.StartsWith(part2.Name))
|
||||||
|
// {
|
||||||
|
// Assert.That(fileName, Is.EqualTo(expectedObject2FileName));
|
||||||
|
// gotObject2File = true;
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// // TODO: Test presence of more files and contents of files.
|
// Assert.That(gotControlFile, Is.True, "No control file in archive");
|
||||||
// }
|
Assert.That(gotObject1File, Is.True, "No item1 file in archive");
|
||||||
|
// Assert.That(gotObject2File, Is.True, "No object2 file in archive");
|
||||||
|
|
||||||
|
// TODO: Test presence of more files and contents of files.
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where
|
/// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where
|
||||||
|
@ -541,56 +533,41 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Test replication of an archive path to the user's inventory.
|
/// Test replication of an archive path to the user's inventory.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
//[Test]
|
[Test]
|
||||||
//public void TestReplicateArchivePathToUserInventory()
|
public void TestReplicateArchivePathToUserInventory()
|
||||||
//{
|
{
|
||||||
// TestHelper.InMethod();
|
TestHelper.InMethod();
|
||||||
|
//log4net.Config.XmlConfigurator.Configure();
|
||||||
|
|
||||||
// //log4net.Config.XmlConfigurator.Configure();
|
Scene scene = SceneSetupHelpers.SetupScene("inventory");
|
||||||
|
UserAccount ua1 = UserProfileTestUtils.CreateUserWithInventory(scene);
|
||||||
|
|
||||||
// Scene scene = SceneSetupHelpers.SetupScene("inventory");
|
Dictionary <string, InventoryFolderBase> foldersCreated = new Dictionary<string, InventoryFolderBase>();
|
||||||
// CommunicationsManager commsManager = scene.CommsManager;
|
List<InventoryNodeBase> nodesLoaded = new List<InventoryNodeBase>();
|
||||||
// CachedUserInfo userInfo;
|
|
||||||
|
|
||||||
// lock (this)
|
string folder1Name = "a";
|
||||||
// {
|
string folder2Name = "b";
|
||||||
// // !!! REFACTORING PROBLEM. This needs to be rewritten
|
string itemName = "c.lsl";
|
||||||
// userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager, InventoryReceived);
|
|
||||||
// Monitor.Wait(this, 60000);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// //Console.WriteLine("userInfo.RootFolder 1: {0}", userInfo.RootFolder);
|
string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1Name, UUID.Random());
|
||||||
|
string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random());
|
||||||
|
string itemArchiveName = InventoryArchiveWriteRequest.CreateArchiveItemName(itemName, UUID.Random());
|
||||||
|
|
||||||
// Dictionary <string, InventoryFolderBase> foldersCreated = new Dictionary<string, InventoryFolderBase>();
|
string itemArchivePath
|
||||||
// List<InventoryNodeBase> nodesLoaded = new List<InventoryNodeBase>();
|
= string.Format(
|
||||||
|
"{0}{1}{2}{3}",
|
||||||
|
ArchiveConstants.INVENTORY_PATH, folder1ArchiveName, folder2ArchiveName, itemArchiveName);
|
||||||
|
|
||||||
// string folder1Name = "a";
|
new InventoryArchiveReadRequest(scene, ua1, null, (Stream)null)
|
||||||
// string folder2Name = "b";
|
.ReplicateArchivePathToUserInventory(
|
||||||
// string itemName = "c.lsl";
|
itemArchivePath, false, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
|
||||||
|
foldersCreated, nodesLoaded);
|
||||||
|
|
||||||
// string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1Name, UUID.Random());
|
InventoryFolderBase folder1
|
||||||
// string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random());
|
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, ua1.PrincipalID, "a");
|
||||||
// string itemArchiveName = InventoryArchiveWriteRequest.CreateArchiveItemName(itemName, UUID.Random());
|
Assert.That(folder1, Is.Not.Null, "Could not find folder a");
|
||||||
|
InventoryFolderBase folder2 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, "b");
|
||||||
// string itemArchivePath
|
Assert.That(folder2, Is.Not.Null, "Could not find folder b");
|
||||||
// = string.Format(
|
}
|
||||||
// "{0}{1}{2}{3}",
|
|
||||||
// ArchiveConstants.INVENTORY_PATH, folder1ArchiveName, folder2ArchiveName, itemArchiveName);
|
|
||||||
|
|
||||||
// //Console.WriteLine("userInfo.RootFolder 2: {0}", userInfo.RootFolder);
|
|
||||||
|
|
||||||
// new InventoryArchiveReadRequest(scene, userInfo, null, (Stream)null)
|
|
||||||
// .ReplicateArchivePathToUserInventory(
|
|
||||||
// itemArchivePath, false, scene.InventoryService.GetRootFolder(userInfo.UserProfile.ID),
|
|
||||||
// foldersCreated, nodesLoaded);
|
|
||||||
|
|
||||||
// //Console.WriteLine("userInfo.RootFolder 3: {0}", userInfo.RootFolder);
|
|
||||||
// //InventoryFolderImpl folder1 = userInfo.RootFolder.FindFolderByPath("a");
|
|
||||||
// InventoryFolderBase folder1
|
|
||||||
// = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userInfo.UserProfile.ID, "a");
|
|
||||||
// Assert.That(folder1, Is.Not.Null, "Could not find folder a");
|
|
||||||
// InventoryFolderBase folder2 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, "b");
|
|
||||||
// Assert.That(folder2, Is.Not.Null, "Could not find folder b");
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -25,6 +25,9 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Net;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenSim.Framework.Serialization;
|
using OpenSim.Framework.Serialization;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
|
@ -60,5 +63,66 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||||
{
|
{
|
||||||
return ArchiveConstants.CreateOarObjectPath(sog.Name, sog.UUID, sog.AbsolutePosition);
|
return ArchiveConstants.CreateOarObjectPath(sog.Name, sog.UUID, sog.AbsolutePosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Resolve path to a working FileStream
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="path"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static Stream GetStream(string path)
|
||||||
|
{
|
||||||
|
if (File.Exists(path))
|
||||||
|
{
|
||||||
|
return new FileStream(path, FileMode.Open, FileAccess.Read);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Uri uri = new Uri(path);
|
||||||
|
if (uri.Scheme == "file")
|
||||||
|
{
|
||||||
|
return new FileStream(uri.AbsolutePath, FileMode.Open, FileAccess.Read);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (uri.Scheme != "http")
|
||||||
|
throw new Exception(String.Format("Unsupported URI scheme ({0})", path));
|
||||||
|
|
||||||
|
// OK, now we know we have an HTTP URI to work with
|
||||||
|
return URIFetch(uri);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (UriFormatException)
|
||||||
|
{
|
||||||
|
// In many cases the user will put in a plain old filename that cannot be found so assume that
|
||||||
|
// this is the problem rather than confusing the issue with a UriFormatException
|
||||||
|
throw new Exception(String.Format("Cannot find file {0}", path));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Stream URIFetch(Uri uri)
|
||||||
|
{
|
||||||
|
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);
|
||||||
|
|
||||||
|
// request.Credentials = credentials;
|
||||||
|
|
||||||
|
request.ContentLength = 0;
|
||||||
|
request.KeepAlive = false;
|
||||||
|
|
||||||
|
WebResponse response = request.GetResponse();
|
||||||
|
Stream file = response.GetResponseStream();
|
||||||
|
|
||||||
|
// justincc: gonna ignore the content type for now and just try anything
|
||||||
|
//if (response.ContentType != "application/x-oar")
|
||||||
|
// throw new Exception(String.Format("{0} does not identify an OAR file", uri.ToString()));
|
||||||
|
|
||||||
|
if (response.ContentLength == 0)
|
||||||
|
throw new Exception(String.Format("{0} returned an empty file", uri.ToString()));
|
||||||
|
|
||||||
|
// return new BufferedStream(file, (int) response.ContentLength);
|
||||||
|
return new BufferedStream(file, 1000000);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -78,7 +78,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
m_loadStream = new GZipStream(GetStream(loadPath), CompressionMode.Decompress);
|
m_loadStream = new GZipStream(ArchiveHelpers.GetStream(loadPath), CompressionMode.Decompress);
|
||||||
}
|
}
|
||||||
catch (EntryPointNotFoundException e)
|
catch (EntryPointNotFoundException e)
|
||||||
{
|
{
|
||||||
|
@ -472,68 +472,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Resolve path to a working FileStream
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="path"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
private Stream GetStream(string path)
|
|
||||||
{
|
|
||||||
if (File.Exists(path))
|
|
||||||
{
|
|
||||||
return new FileStream(path, FileMode.Open, FileAccess.Read);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Uri uri = new Uri(path);
|
|
||||||
if (uri.Scheme == "file")
|
|
||||||
{
|
|
||||||
return new FileStream(uri.AbsolutePath, FileMode.Open, FileAccess.Read);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (uri.Scheme != "http")
|
|
||||||
throw new Exception(String.Format("Unsupported URI scheme ({0})", path));
|
|
||||||
|
|
||||||
// OK, now we know we have an HTTP URI to work with
|
|
||||||
|
|
||||||
return URIFetch(uri);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (UriFormatException)
|
|
||||||
{
|
|
||||||
// In many cases the user will put in a plain old filename that cannot be found so assume that
|
|
||||||
// this is the problem rather than confusing the issue with a UriFormatException
|
|
||||||
throw new Exception(String.Format("Cannot find file {0}", path));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Stream URIFetch(Uri uri)
|
|
||||||
{
|
|
||||||
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);
|
|
||||||
|
|
||||||
// request.Credentials = credentials;
|
|
||||||
|
|
||||||
request.ContentLength = 0;
|
|
||||||
request.KeepAlive = false;
|
|
||||||
|
|
||||||
WebResponse response = request.GetResponse();
|
|
||||||
Stream file = response.GetResponseStream();
|
|
||||||
|
|
||||||
// justincc: gonna ignore the content type for now and just try anything
|
|
||||||
//if (response.ContentType != "application/x-oar")
|
|
||||||
// throw new Exception(String.Format("{0} does not identify an OAR file", uri.ToString()));
|
|
||||||
|
|
||||||
if (response.ContentLength == 0)
|
|
||||||
throw new Exception(String.Format("{0} returned an empty file", uri.ToString()));
|
|
||||||
|
|
||||||
// return new BufferedStream(file, (int) response.ContentLength);
|
|
||||||
return new BufferedStream(file, 1000000);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Load oar control file
|
/// Load oar control file
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -1014,7 +1014,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||||
|
|
||||||
int lastMapRefresh = 0;
|
int lastMapRefresh = 0;
|
||||||
int twoDays = 172800;
|
int twoDays = 172800;
|
||||||
int RefreshSeconds = twoDays;
|
// int RefreshSeconds = twoDays;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
@ -2149,7 +2149,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Delete every object from the scene
|
/// Delete every object from the scene. This does not include attachments worn by avatars.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void DeleteAllSceneObjects()
|
public void DeleteAllSceneObjects()
|
||||||
{
|
{
|
||||||
|
@ -2160,7 +2160,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
foreach (EntityBase e in entities)
|
foreach (EntityBase e in entities)
|
||||||
{
|
{
|
||||||
if (e is SceneObjectGroup)
|
if (e is SceneObjectGroup)
|
||||||
DeleteSceneObject((SceneObjectGroup)e, false);
|
{
|
||||||
|
SceneObjectGroup sog = (SceneObjectGroup)e;
|
||||||
|
if (!sog.IsAttachment)
|
||||||
|
DeleteSceneObject((SceneObjectGroup)e, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -376,6 +376,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// <param name="mod"></param>
|
/// <param name="mod"></param>
|
||||||
public void RegisterModuleInterface<M>(M mod)
|
public void RegisterModuleInterface<M>(M mod)
|
||||||
{
|
{
|
||||||
|
m_log.DebugFormat("[SCENE BASE]: Registering interface {0}", typeof(M));
|
||||||
|
|
||||||
List<Object> l = null;
|
List<Object> l = null;
|
||||||
if (!ModuleInterfaces.TryGetValue(typeof(M), out l))
|
if (!ModuleInterfaces.TryGetValue(typeof(M), out l))
|
||||||
{
|
{
|
||||||
|
@ -498,7 +500,30 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Call this from a region module to add a command to the OpenSim console.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="mod"></param>
|
||||||
|
/// <param name="command"></param>
|
||||||
|
/// <param name="shorthelp"></param>
|
||||||
|
/// <param name="longhelp"></param>
|
||||||
|
/// <param name="callback"></param>
|
||||||
public void AddCommand(object mod, string command, string shorthelp, string longhelp, CommandDelegate callback)
|
public void AddCommand(object mod, string command, string shorthelp, string longhelp, CommandDelegate callback)
|
||||||
|
{
|
||||||
|
AddCommand(mod, command, shorthelp, longhelp, string.Empty, callback);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Call this from a region module to add a command to the OpenSim console.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="mod"></param>
|
||||||
|
/// <param name="command"></param>
|
||||||
|
/// <param name="shorthelp"></param>
|
||||||
|
/// <param name="longhelp"></param>
|
||||||
|
/// <param name="descriptivehelp"></param>
|
||||||
|
/// <param name="callback"></param>
|
||||||
|
public void AddCommand(
|
||||||
|
object mod, string command, string shorthelp, string longhelp, string descriptivehelp, CommandDelegate callback)
|
||||||
{
|
{
|
||||||
if (MainConsole.Instance == null)
|
if (MainConsole.Instance == null)
|
||||||
return;
|
return;
|
||||||
|
@ -523,7 +548,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
else throw new Exception("AddCommand module parameter must be IRegionModule or IRegionModuleBase");
|
else throw new Exception("AddCommand module parameter must be IRegionModule or IRegionModuleBase");
|
||||||
}
|
}
|
||||||
|
|
||||||
MainConsole.Instance.Commands.AddCommand(modulename, shared, command, shorthelp, longhelp, callback);
|
MainConsole.Instance.Commands.AddCommand(
|
||||||
|
modulename, shared, command, shorthelp, longhelp, descriptivehelp, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual ISceneObject DeserializeObject(string representation)
|
public virtual ISceneObject DeserializeObject(string representation)
|
||||||
|
|
|
@ -1289,10 +1289,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar)
|
m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar)
|
||||||
{
|
{
|
||||||
avatar.SceneViewer.QueuePartForUpdate(this);
|
AddFullUpdateToAvatar(avatar);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Tell the scene presence that it should send updates for this part to its client
|
||||||
|
/// </summary>
|
||||||
public void AddFullUpdateToAvatar(ScenePresence presence)
|
public void AddFullUpdateToAvatar(ScenePresence presence)
|
||||||
{
|
{
|
||||||
presence.SceneViewer.QueuePartForUpdate(this);
|
presence.SceneViewer.QueuePartForUpdate(this);
|
||||||
|
@ -1313,7 +1316,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar)
|
m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar)
|
||||||
{
|
{
|
||||||
avatar.SceneViewer.QueuePartForUpdate(this);
|
AddTerseUpdateToAvatar(avatar);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -820,15 +820,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Add the part to the queue of parts for which we need to send an update to the client
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="part"></param>
|
|
||||||
public void QueuePartForUpdate(SceneObjectPart part)
|
|
||||||
{
|
|
||||||
m_sceneViewer.QueuePartForUpdate(part);
|
|
||||||
}
|
|
||||||
|
|
||||||
public uint GenerateClientFlags(UUID ObjectID)
|
public uint GenerateClientFlags(UUID ObjectID)
|
||||||
{
|
{
|
||||||
return m_scene.Permissions.GenerateClientFlags(m_uuid, ObjectID);
|
return m_scene.Permissions.GenerateClientFlags(m_uuid, ObjectID);
|
||||||
|
|
|
@ -61,7 +61,7 @@ namespace OpenSim.Server
|
||||||
string connList = serverConfig.GetString("ServiceConnectors", String.Empty);
|
string connList = serverConfig.GetString("ServiceConnectors", String.Empty);
|
||||||
string[] conns = connList.Split(new char[] {',', ' '});
|
string[] conns = connList.Split(new char[] {',', ' '});
|
||||||
|
|
||||||
int i = 0;
|
// int i = 0;
|
||||||
foreach (string c in conns)
|
foreach (string c in conns)
|
||||||
{
|
{
|
||||||
if (c == String.Empty)
|
if (c == String.Empty)
|
||||||
|
|
|
@ -54,7 +54,8 @@ namespace OpenSim.Services.PresenceService
|
||||||
public bool LoginAgent(string userID, UUID sessionID,
|
public bool LoginAgent(string userID, UUID sessionID,
|
||||||
UUID secureSessionID)
|
UUID secureSessionID)
|
||||||
{
|
{
|
||||||
PresenceData[] d = m_Database.Get("UserID", userID);
|
//PresenceData[] d = m_Database.Get("UserID", userID);
|
||||||
|
m_Database.Get("UserID", userID);
|
||||||
|
|
||||||
PresenceData data = new PresenceData();
|
PresenceData data = new PresenceData();
|
||||||
|
|
||||||
|
|
|
@ -277,8 +277,9 @@ namespace OpenSim.Services.UserAccountService
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Console commands
|
#region Console commands
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create a new user
|
/// Handle the create user command from the console.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="cmdparams">string array with parameters: firstname, lastname, password, locationX, locationY, email</param>
|
/// <param name="cmdparams">string array with parameters: firstname, lastname, password, locationX, locationY, email</param>
|
||||||
protected void HandleCreateUser(string module, string[] cmdparams)
|
protected void HandleCreateUser(string module, string[] cmdparams)
|
||||||
|
@ -304,61 +305,7 @@ namespace OpenSim.Services.UserAccountService
|
||||||
email = MainConsole.Instance.CmdPrompt("Email", "");
|
email = MainConsole.Instance.CmdPrompt("Email", "");
|
||||||
else email = cmdparams[5];
|
else email = cmdparams[5];
|
||||||
|
|
||||||
UserAccount account = GetUserAccount(UUID.Zero, firstName, lastName);
|
CreateUser(firstName, lastName, password, email);
|
||||||
if (null == account)
|
|
||||||
{
|
|
||||||
account = new UserAccount(UUID.Zero, firstName, lastName, email);
|
|
||||||
if (account.ServiceURLs == null || (account.ServiceURLs != null && account.ServiceURLs.Count == 0))
|
|
||||||
{
|
|
||||||
account.ServiceURLs = new Dictionary<string, object>();
|
|
||||||
account.ServiceURLs["HomeURI"] = string.Empty;
|
|
||||||
account.ServiceURLs["GatekeeperURI"] = string.Empty;
|
|
||||||
account.ServiceURLs["InventoryServerURI"] = string.Empty;
|
|
||||||
account.ServiceURLs["AssetServerURI"] = string.Empty;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (StoreUserAccount(account))
|
|
||||||
{
|
|
||||||
bool success = false;
|
|
||||||
if (m_AuthenticationService != null)
|
|
||||||
success = m_AuthenticationService.SetPassword(account.PrincipalID, password);
|
|
||||||
if (!success)
|
|
||||||
m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to set password for account {0} {1}.",
|
|
||||||
firstName, lastName);
|
|
||||||
|
|
||||||
GridRegion home = null;
|
|
||||||
if (m_GridService != null)
|
|
||||||
{
|
|
||||||
List<GridRegion> defaultRegions = m_GridService.GetDefaultRegions(UUID.Zero);
|
|
||||||
if (defaultRegions != null && defaultRegions.Count >= 1)
|
|
||||||
home = defaultRegions[0];
|
|
||||||
|
|
||||||
if (m_GridUserService != null && home != null)
|
|
||||||
m_GridUserService.SetHome(account.PrincipalID.ToString(), home.RegionID, new Vector3(128, 128, 0), new Vector3(0, 1, 0));
|
|
||||||
else
|
|
||||||
m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to set home for account {0} {1}.",
|
|
||||||
firstName, lastName);
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to retrieve home region for account {0} {1}.",
|
|
||||||
firstName, lastName);
|
|
||||||
|
|
||||||
if (m_InventoryService != null)
|
|
||||||
success = m_InventoryService.CreateUserInventory(account.PrincipalID);
|
|
||||||
if (!success)
|
|
||||||
m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to create inventory for account {0} {1}.",
|
|
||||||
firstName, lastName);
|
|
||||||
|
|
||||||
|
|
||||||
m_log.InfoFormat("[USER ACCOUNT SERVICE]: Account {0} {1} created successfully", firstName, lastName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_log.ErrorFormat("[USER ACCOUNT SERVICE]: A user with the name {0} {1} already exists!", firstName, lastName);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void HandleResetUserPassword(string module, string[] cmdparams)
|
protected void HandleResetUserPassword(string module, string[] cmdparams)
|
||||||
|
@ -395,5 +342,67 @@ namespace OpenSim.Services.UserAccountService
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create a user
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="firstName"></param>
|
||||||
|
/// <param name="lastName"></param>
|
||||||
|
/// <param name="password"></param>
|
||||||
|
/// <param name="email"></param>
|
||||||
|
public void CreateUser(string firstName, string lastName, string password, string email)
|
||||||
|
{
|
||||||
|
UserAccount account = GetUserAccount(UUID.Zero, firstName, lastName);
|
||||||
|
if (null == account)
|
||||||
|
{
|
||||||
|
account = new UserAccount(UUID.Zero, firstName, lastName, email);
|
||||||
|
if (account.ServiceURLs == null || (account.ServiceURLs != null && account.ServiceURLs.Count == 0))
|
||||||
|
{
|
||||||
|
account.ServiceURLs = new Dictionary<string, object>();
|
||||||
|
account.ServiceURLs["HomeURI"] = string.Empty;
|
||||||
|
account.ServiceURLs["GatekeeperURI"] = string.Empty;
|
||||||
|
account.ServiceURLs["InventoryServerURI"] = string.Empty;
|
||||||
|
account.ServiceURLs["AssetServerURI"] = string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (StoreUserAccount(account))
|
||||||
|
{
|
||||||
|
bool success = false;
|
||||||
|
if (m_AuthenticationService != null)
|
||||||
|
success = m_AuthenticationService.SetPassword(account.PrincipalID, password);
|
||||||
|
if (!success)
|
||||||
|
m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to set password for account {0} {1}.",
|
||||||
|
firstName, lastName);
|
||||||
|
|
||||||
|
GridRegion home = null;
|
||||||
|
if (m_GridService != null)
|
||||||
|
{
|
||||||
|
List<GridRegion> defaultRegions = m_GridService.GetDefaultRegions(UUID.Zero);
|
||||||
|
if (defaultRegions != null && defaultRegions.Count >= 1)
|
||||||
|
home = defaultRegions[0];
|
||||||
|
|
||||||
|
if (m_GridUserService != null && home != null)
|
||||||
|
m_GridUserService.SetHome(account.PrincipalID.ToString(), home.RegionID, new Vector3(128, 128, 0), new Vector3(0, 1, 0));
|
||||||
|
else
|
||||||
|
m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to set home for account {0} {1}.",
|
||||||
|
firstName, lastName);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to retrieve home region for account {0} {1}.",
|
||||||
|
firstName, lastName);
|
||||||
|
|
||||||
|
if (m_InventoryService != null)
|
||||||
|
success = m_InventoryService.CreateUserInventory(account.PrincipalID);
|
||||||
|
if (!success)
|
||||||
|
m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to create inventory for account {0} {1}.",
|
||||||
|
firstName, lastName);
|
||||||
|
|
||||||
|
m_log.InfoFormat("[USER ACCOUNT SERVICE]: Account {0} {1} created successfully", firstName, lastName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_log.ErrorFormat("[USER ACCOUNT SERVICE]: A user with the name {0} {1} already exists!", firstName, lastName);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,6 +42,7 @@ using OpenSim.Region.Framework.Scenes;
|
||||||
using OpenSim.Region.CoreModules.Agent.Capabilities;
|
using OpenSim.Region.CoreModules.Agent.Capabilities;
|
||||||
using OpenSim.Region.CoreModules.Avatar.Gods;
|
using OpenSim.Region.CoreModules.Avatar.Gods;
|
||||||
using OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset;
|
using OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset;
|
||||||
|
using OpenSim.Region.CoreModules.ServiceConnectorsOut.Authentication;
|
||||||
using OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory;
|
using OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory;
|
||||||
using OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid;
|
using OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid;
|
||||||
using OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts;
|
using OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts;
|
||||||
|
@ -58,6 +59,7 @@ namespace OpenSim.Tests.Common.Setup
|
||||||
// These static variables in order to allow regions to be linked by shared modules and same
|
// These static variables in order to allow regions to be linked by shared modules and same
|
||||||
// CommunicationsManager.
|
// CommunicationsManager.
|
||||||
private static ISharedRegionModule m_assetService = null;
|
private static ISharedRegionModule m_assetService = null;
|
||||||
|
// private static ISharedRegionModule m_authenticationService = null;
|
||||||
private static ISharedRegionModule m_inventoryService = null;
|
private static ISharedRegionModule m_inventoryService = null;
|
||||||
private static ISharedRegionModule m_gridService = null;
|
private static ISharedRegionModule m_gridService = null;
|
||||||
private static ISharedRegionModule m_userAccountService = null;
|
private static ISharedRegionModule m_userAccountService = null;
|
||||||
|
@ -178,6 +180,9 @@ namespace OpenSim.Tests.Common.Setup
|
||||||
else
|
else
|
||||||
StartAssetService(testScene, false);
|
StartAssetService(testScene, false);
|
||||||
|
|
||||||
|
// For now, always started a 'real' authenication service
|
||||||
|
StartAuthenticationService(testScene, true);
|
||||||
|
|
||||||
if (realServices.Contains("inventory"))
|
if (realServices.Contains("inventory"))
|
||||||
StartInventoryService(testScene, true);
|
StartInventoryService(testScene, true);
|
||||||
else
|
else
|
||||||
|
@ -243,6 +248,27 @@ namespace OpenSim.Tests.Common.Setup
|
||||||
m_assetService = assetService;
|
m_assetService = assetService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void StartAuthenticationService(Scene testScene, bool real)
|
||||||
|
{
|
||||||
|
ISharedRegionModule service = new LocalAuthenticationServicesConnector();
|
||||||
|
IConfigSource config = new IniConfigSource();
|
||||||
|
config.AddConfig("Modules");
|
||||||
|
config.AddConfig("AuthenticationService");
|
||||||
|
config.Configs["Modules"].Set("AuthenticationServices", "LocalAuthenticationServicesConnector");
|
||||||
|
if (real)
|
||||||
|
config.Configs["AuthenticationService"].Set(
|
||||||
|
"LocalServiceModule", "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService");
|
||||||
|
else
|
||||||
|
config.Configs["AuthenticationService"].Set(
|
||||||
|
"LocalServiceModule", "OpenSim.Tests.Common.dll:MockuthenticationService");
|
||||||
|
config.Configs["AuthenticationService"].Set("StorageProvider", "OpenSim.Data.Null.dll");
|
||||||
|
service.Initialise(config);
|
||||||
|
service.AddRegion(testScene);
|
||||||
|
service.RegionLoaded(testScene);
|
||||||
|
testScene.AddRegionModule(service.Name, service);
|
||||||
|
//m_authenticationService = service;
|
||||||
|
}
|
||||||
|
|
||||||
private static void StartInventoryService(Scene testScene, bool real)
|
private static void StartInventoryService(Scene testScene, bool real)
|
||||||
{
|
{
|
||||||
ISharedRegionModule inventoryService = new LocalInventoryServicesConnector();
|
ISharedRegionModule inventoryService = new LocalInventoryServicesConnector();
|
||||||
|
|
|
@ -27,7 +27,8 @@
|
||||||
|
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenSim.Framework.Communications;
|
using OpenSim.Framework.Communications;
|
||||||
|
using OpenSim.Region.Framework.Scenes;
|
||||||
|
using OpenSim.Services.Interfaces;
|
||||||
|
|
||||||
namespace OpenSim.Tests.Common.Setup
|
namespace OpenSim.Tests.Common.Setup
|
||||||
{
|
{
|
||||||
|
@ -36,85 +37,99 @@ namespace OpenSim.Tests.Common.Setup
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static class UserProfileTestUtils
|
public static class UserProfileTestUtils
|
||||||
{
|
{
|
||||||
// REFACTORING PROBLEM
|
// /// <summary>
|
||||||
// This needs to be rewritten
|
// /// Create a test user with a standard inventory
|
||||||
|
// /// </summary>
|
||||||
|
// /// <param name="commsManager"></param>
|
||||||
|
// /// <param name="callback">
|
||||||
|
// /// Callback to invoke when inventory has been loaded. This is required because
|
||||||
|
// /// loading may be asynchronous, even on standalone
|
||||||
|
// /// </param>
|
||||||
|
// /// <returns></returns>
|
||||||
|
// public static CachedUserInfo CreateUserWithInventory(
|
||||||
|
// CommunicationsManager commsManager, OnInventoryReceivedDelegate callback)
|
||||||
|
// {
|
||||||
|
// UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000099");
|
||||||
|
// return CreateUserWithInventory(commsManager, userId, callback);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /// <summary>
|
||||||
|
// /// Create a test user with a standard inventory
|
||||||
|
// /// </summary>
|
||||||
|
// /// <param name="commsManager"></param>
|
||||||
|
// /// <param name="userId">User ID</param>
|
||||||
|
// /// <param name="callback">
|
||||||
|
// /// Callback to invoke when inventory has been loaded. This is required because
|
||||||
|
// /// loading may be asynchronous, even on standalone
|
||||||
|
// /// </param>
|
||||||
|
// /// <returns></returns>
|
||||||
|
// public static CachedUserInfo CreateUserWithInventory(
|
||||||
|
// CommunicationsManager commsManager, UUID userId, OnInventoryReceivedDelegate callback)
|
||||||
|
// {
|
||||||
|
// return CreateUserWithInventory(commsManager, "Bill", "Bailey", userId, callback);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /// <summary>
|
||||||
|
// /// Create a test user with a standard inventory
|
||||||
|
// /// </summary>
|
||||||
|
// /// <param name="commsManager"></param>
|
||||||
|
// /// <param name="firstName">First name of user</param>
|
||||||
|
// /// <param name="lastName">Last name of user</param>
|
||||||
|
// /// <param name="userId">User ID</param>
|
||||||
|
// /// <param name="callback">
|
||||||
|
// /// Callback to invoke when inventory has been loaded. This is required because
|
||||||
|
// /// loading may be asynchronous, even on standalone
|
||||||
|
// /// </param>
|
||||||
|
// /// <returns></returns>
|
||||||
|
// public static CachedUserInfo CreateUserWithInventory(
|
||||||
|
// CommunicationsManager commsManager, string firstName, string lastName,
|
||||||
|
// UUID userId, OnInventoryReceivedDelegate callback)
|
||||||
|
// {
|
||||||
|
// return CreateUserWithInventory(commsManager, firstName, lastName, "troll", userId, callback);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /// <summary>
|
||||||
|
// /// Create a test user with a standard inventory
|
||||||
|
// /// </summary>
|
||||||
|
// /// <param name="commsManager"></param>
|
||||||
|
// /// <param name="firstName">First name of user</param>
|
||||||
|
// /// <param name="lastName">Last name of user</param>
|
||||||
|
// /// <param name="password">Password</param>
|
||||||
|
// /// <param name="userId">User ID</param>
|
||||||
|
// /// <param name="callback">
|
||||||
|
// /// Callback to invoke when inventory has been loaded. This is required because
|
||||||
|
// /// loading may be asynchronous, even on standalone
|
||||||
|
// /// </param>
|
||||||
|
// /// <returns></returns>
|
||||||
|
// public static CachedUserInfo CreateUserWithInventory(
|
||||||
|
// CommunicationsManager commsManager, string firstName, string lastName, string password,
|
||||||
|
// UUID userId, OnInventoryReceivedDelegate callback)
|
||||||
|
// {
|
||||||
|
// LocalUserServices lus = (LocalUserServices)commsManager.UserService;
|
||||||
|
// lus.AddUser(firstName, lastName, password, "bill@bailey.com", 1000, 1000, userId);
|
||||||
|
//
|
||||||
|
// CachedUserInfo userInfo = commsManager.UserProfileCacheService.GetUserDetails(userId);
|
||||||
|
// userInfo.OnInventoryReceived += callback;
|
||||||
|
// userInfo.FetchInventory();
|
||||||
|
//
|
||||||
|
// return userInfo;
|
||||||
|
// }
|
||||||
|
|
||||||
///// <summary>
|
public static UserAccount CreateUserWithInventory(Scene scene)
|
||||||
///// Create a test user with a standard inventory
|
{
|
||||||
///// </summary>
|
return CreateUserWithInventory(
|
||||||
///// <param name="commsManager"></param>
|
scene, "Bill", "Bailey", UUID.Parse("00000000-0000-0000-0000-000000000099"), "troll");
|
||||||
///// <param name="callback">
|
}
|
||||||
///// Callback to invoke when inventory has been loaded. This is required because
|
|
||||||
///// loading may be asynchronous, even on standalone
|
|
||||||
///// </param>
|
|
||||||
///// <returns></returns>
|
|
||||||
//public static CachedUserInfo CreateUserWithInventory(
|
|
||||||
// CommunicationsManager commsManager, OnInventoryReceivedDelegate callback)
|
|
||||||
//{
|
|
||||||
// UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000099");
|
|
||||||
// return CreateUserWithInventory(commsManager, userId, callback);
|
|
||||||
//}
|
|
||||||
|
|
||||||
///// <summary>
|
public static UserAccount CreateUserWithInventory(
|
||||||
///// Create a test user with a standard inventory
|
Scene scene, string firstName, string lastName, UUID userId, string pw)
|
||||||
///// </summary>
|
{
|
||||||
///// <param name="commsManager"></param>
|
UserAccount ua = new UserAccount(userId) { FirstName = firstName, LastName = lastName };
|
||||||
///// <param name="userId">User ID</param>
|
scene.UserAccountService.StoreUserAccount(ua);
|
||||||
///// <param name="callback">
|
scene.InventoryService.CreateUserInventory(ua.PrincipalID);
|
||||||
///// Callback to invoke when inventory has been loaded. This is required because
|
scene.AuthenticationService.SetPassword(ua.PrincipalID, pw);
|
||||||
///// loading may be asynchronous, even on standalone
|
|
||||||
///// </param>
|
|
||||||
///// <returns></returns>
|
|
||||||
//public static CachedUserInfo CreateUserWithInventory(
|
|
||||||
// CommunicationsManager commsManager, UUID userId, OnInventoryReceivedDelegate callback)
|
|
||||||
//{
|
|
||||||
// return CreateUserWithInventory(commsManager, "Bill", "Bailey", userId, callback);
|
|
||||||
//}
|
|
||||||
|
|
||||||
///// <summary>
|
return ua;
|
||||||
///// Create a test user with a standard inventory
|
}
|
||||||
///// </summary>
|
|
||||||
///// <param name="commsManager"></param>
|
|
||||||
///// <param name="firstName">First name of user</param>
|
|
||||||
///// <param name="lastName">Last name of user</param>
|
|
||||||
///// <param name="userId">User ID</param>
|
|
||||||
///// <param name="callback">
|
|
||||||
///// Callback to invoke when inventory has been loaded. This is required because
|
|
||||||
///// loading may be asynchronous, even on standalone
|
|
||||||
///// </param>
|
|
||||||
///// <returns></returns>
|
|
||||||
//public static CachedUserInfo CreateUserWithInventory(
|
|
||||||
// CommunicationsManager commsManager, string firstName, string lastName,
|
|
||||||
// UUID userId, OnInventoryReceivedDelegate callback)
|
|
||||||
//{
|
|
||||||
// return CreateUserWithInventory(commsManager, firstName, lastName, "troll", userId, callback);
|
|
||||||
//}
|
|
||||||
|
|
||||||
///// <summary>
|
|
||||||
///// Create a test user with a standard inventory
|
|
||||||
///// </summary>
|
|
||||||
///// <param name="commsManager"></param>
|
|
||||||
///// <param name="firstName">First name of user</param>
|
|
||||||
///// <param name="lastName">Last name of user</param>
|
|
||||||
///// <param name="password">Password</param>
|
|
||||||
///// <param name="userId">User ID</param>
|
|
||||||
///// <param name="callback">
|
|
||||||
///// Callback to invoke when inventory has been loaded. This is required because
|
|
||||||
///// loading may be asynchronous, even on standalone
|
|
||||||
///// </param>
|
|
||||||
///// <returns></returns>
|
|
||||||
//public static CachedUserInfo CreateUserWithInventory(
|
|
||||||
// CommunicationsManager commsManager, string firstName, string lastName, string password,
|
|
||||||
// UUID userId, OnInventoryReceivedDelegate callback)
|
|
||||||
//{
|
|
||||||
// LocalUserServices lus = (LocalUserServices)commsManager.UserService;
|
|
||||||
// lus.AddUser(firstName, lastName, password, "bill@bailey.com", 1000, 1000, userId);
|
|
||||||
|
|
||||||
// CachedUserInfo userInfo = commsManager.UserProfileCacheService.GetUserDetails(userId);
|
|
||||||
// userInfo.OnInventoryReceived += callback;
|
|
||||||
// userInfo.FetchInventory();
|
|
||||||
|
|
||||||
// return userInfo;
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue