Merge branch 'master' into careminster-presence-refactor

avinationmerge
Melanie 2010-05-28 21:56:42 +01:00
commit 542e6b8af4
22 changed files with 1127 additions and 1058 deletions

View File

@ -127,15 +127,10 @@
</exec>
<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">
<arg value="./bin/OpenSim.Data.SQLite.Tests.dll" />
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.data.tests">
<arg value="./bin/OpenSim.Data.Tests.dll" />
</exec>
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.data.sqlite.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}" />
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.data.tests)==0}" />
<delete dir="%temp%"/>
@ -297,14 +292,9 @@
<arg value="-xml=test-results/OpenSim.Region.Framework.Tests.dll-Results.xml" />
</exec>
<exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.data.sqlite.tests">
<arg value="./bin/OpenSim.Data.SQLite.Tests.dll" />
<arg value="-xml=test-results/OpenSim.Data.SQLite.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 program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.data.tests">
<arg value="./bin/OpenSim.Data.Tests.dll" />
<arg value="-xml=test-results/OpenSim.Data.Tests.dll-Results.xml" />
</exec>
<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.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.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.tests)==0}" />
</target>
<!-- <exec program="nunit-console.exe" failonerror="false" resultproperty="testresult.acceptancetestassembly"> -->

View File

@ -39,8 +39,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
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;
@ -64,6 +63,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
{
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);
Rest.Log.InfoFormat("{0} Domain is now <{1}>", MsgId, qPrefix);
}
@ -294,31 +294,31 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
/// </summary>
/// <param name=rdata>HTTP service request work area</param>
private void DoGet(AppearanceRequestData rdata)
{
AvatarData adata = Rest.AvatarServices.GetAvatar(rdata.userProfile.ID);
if (adata == null)
{
rdata.Fail(Rest.HttpStatusCodeNoContent,
String.Format("appearance data not found for user {0} {1}",
rdata.userProfile.FirstName, rdata.userProfile.SurName));
}
rdata.userAppearance = adata.ToAvatarAppearance(rdata.userProfile.ID);
rdata.initXmlWriter();
FormatUserAppearance(rdata);
// Indicate a successful request
rdata.Complete();
// Send the response to the user. The body will be implicitly
// constructed from the result of the XML writer.
rdata.Respond(String.Format("Appearance {0} Normal completion", rdata.method));
}
// private void DoGet(AppearanceRequestData rdata)
// {
// AvatarData adata = Rest.AvatarServices.GetAvatar(rdata.userProfile.ID);
//
// if (adata == null)
// {
// rdata.Fail(Rest.HttpStatusCodeNoContent,
// String.Format("appearance data not found for user {0} {1}",
// rdata.userProfile.FirstName, rdata.userProfile.SurName));
// }
// rdata.userAppearance = adata.ToAvatarAppearance(rdata.userProfile.ID);
//
// rdata.initXmlWriter();
//
// FormatUserAppearance(rdata);
//
// // Indicate a successful request
//
// rdata.Complete();
//
// // Send the response to the user. The body will be implicitly
// // constructed from the result of the XML writer.
//
// rdata.Respond(String.Format("Appearance {0} Normal completion", rdata.method));
// }
/// <summary>
/// POST adds NEW information to the user profile database.
@ -326,112 +326,112 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
/// characteristics supplied in the request.
/// </summary>
private void DoExtend(AppearanceRequestData rdata)
{
bool created = false;
bool modified = false;
string newnode = String.Empty;
Rest.Log.DebugFormat("{0} POST ENTRY", MsgId);
//AvatarAppearance old = Rest.AvatarServices.GetUserAppearance(rdata.userProfile.ID);
rdata.userAppearance = new AvatarAppearance();
// Although the following behavior is admitted by HTTP I am becoming
// 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
// attempt should fail, rather than update the existing record.
AvatarData adata = null;
if (GetUserAppearance(rdata))
{
modified = rdata.userAppearance != null;
created = !modified;
adata = new AvatarData(rdata.userAppearance);
Rest.AvatarServices.SetAvatar(rdata.userProfile.ID, adata);
// Rest.UserServices.UpdateUserProfile(rdata.userProfile);
}
else
{
created = true;
adata = new AvatarData(rdata.userAppearance);
Rest.AvatarServices.SetAvatar(rdata.userProfile.ID, adata);
// Rest.UserServices.UpdateUserProfile(rdata.userProfile);
}
if (created)
{
newnode = String.Format("{0} {1}", rdata.userProfile.FirstName,
rdata.userProfile.SurName);
// 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.hostname,rdata.port,rdata.path,Rest.UrlPathSeparator, newnode));
rdata.Complete(Rest.HttpStatusCodeCreated);
}
else
{
if (modified)
{
rdata.Complete(Rest.HttpStatusCodeOK);
}
else
{
rdata.Complete(Rest.HttpStatusCodeNoContent);
}
}
rdata.Respond(String.Format("Appearance {0} : Normal completion", rdata.method));
}
// private void DoExtend(AppearanceRequestData rdata)
// {
//
// bool created = false;
// bool modified = false;
// string newnode = String.Empty;
//
// Rest.Log.DebugFormat("{0} POST ENTRY", MsgId);
//
// //AvatarAppearance old = Rest.AvatarServices.GetUserAppearance(rdata.userProfile.ID);
//
// rdata.userAppearance = new AvatarAppearance();
//
// // Although the following behavior is admitted by HTTP I am becoming
// // 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
// // attempt should fail, rather than update the existing record.
// AvatarData adata = null;
// if (GetUserAppearance(rdata))
// {
// modified = rdata.userAppearance != null;
// created = !modified;
// adata = new AvatarData(rdata.userAppearance);
// Rest.AvatarServices.SetAvatar(rdata.userProfile.ID, adata);
// // Rest.UserServices.UpdateUserProfile(rdata.userProfile);
// }
// else
// {
// created = true;
// adata = new AvatarData(rdata.userAppearance);
// Rest.AvatarServices.SetAvatar(rdata.userProfile.ID, adata);
// // Rest.UserServices.UpdateUserProfile(rdata.userProfile);
// }
//
// if (created)
// {
// newnode = String.Format("{0} {1}", rdata.userProfile.FirstName,
// rdata.userProfile.SurName);
// // 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.hostname,rdata.port,rdata.path,Rest.UrlPathSeparator, newnode));
// rdata.Complete(Rest.HttpStatusCodeCreated);
//
// }
// else
// {
// if (modified)
// {
// rdata.Complete(Rest.HttpStatusCodeOK);
// }
// else
// {
// rdata.Complete(Rest.HttpStatusCodeNoContent);
// }
// }
//
// rdata.Respond(String.Format("Appearance {0} : Normal completion", rdata.method));
//
// }
/// <summary>
/// This updates the user's appearance. not all aspects need to be provided,
/// only those supplied will be changed.
/// </summary>
private void DoUpdate(AppearanceRequestData rdata)
{
// REFACTORING PROBLEM This was commented out. It doesn't work for 0.7
//bool created = false;
//bool modified = false;
//rdata.userAppearance = Rest.AvatarServices.GetUserAppearance(rdata.userProfile.ID);
//// If the user exists then this is considered a modification regardless
//// of what may, or may not be, specified in the payload.
//if (rdata.userAppearance != null)
//{
// modified = true;
// Rest.AvatarServices.UpdateUserAppearance(rdata.userProfile.ID, rdata.userAppearance);
// Rest.UserServices.UpdateUserProfile(rdata.userProfile);
//}
//if (created)
//{
// rdata.Complete(Rest.HttpStatusCodeCreated);
//}
//else
//{
// if (modified)
// {
// rdata.Complete(Rest.HttpStatusCodeOK);
// }
// else
// {
// rdata.Complete(Rest.HttpStatusCodeNoContent);
// }
//}
rdata.Respond(String.Format("Appearance {0} : Normal completion", rdata.method));
}
// private void DoUpdate(AppearanceRequestData rdata)
// {
//
// // REFACTORING PROBLEM This was commented out. It doesn't work for 0.7
//
// //bool created = false;
// //bool modified = false;
//
//
// //rdata.userAppearance = Rest.AvatarServices.GetUserAppearance(rdata.userProfile.ID);
//
// //// If the user exists then this is considered a modification regardless
// //// of what may, or may not be, specified in the payload.
//
// //if (rdata.userAppearance != null)
// //{
// // modified = true;
// // Rest.AvatarServices.UpdateUserAppearance(rdata.userProfile.ID, rdata.userAppearance);
// // Rest.UserServices.UpdateUserProfile(rdata.userProfile);
// //}
//
// //if (created)
// //{
// // rdata.Complete(Rest.HttpStatusCodeCreated);
// //}
// //else
// //{
// // if (modified)
// // {
// // rdata.Complete(Rest.HttpStatusCodeOK);
// // }
// // else
// // {
// // rdata.Complete(Rest.HttpStatusCodeNoContent);
// // }
// //}
//
// rdata.Respond(String.Format("Appearance {0} : Normal completion", rdata.method));
//
// }
/// <summary>
/// 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
/// be recovered.
/// </summary>
private void DoDelete(AppearanceRequestData rdata)
{
AvatarData adata = Rest.AvatarServices.GetAvatar(rdata.userProfile.ID);
if (adata != null)
{
AvatarAppearance old = adata.ToAvatarAppearance(rdata.userProfile.ID);
rdata.userAppearance = new AvatarAppearance();
rdata.userAppearance.Owner = old.Owner;
adata = new AvatarData(rdata.userAppearance);
Rest.AvatarServices.SetAvatar(rdata.userProfile.ID, adata);
rdata.Complete();
}
else
{
rdata.Complete(Rest.HttpStatusCodeNoContent);
}
rdata.Respond(String.Format("Appearance {0} : Normal completion", rdata.method));
}
// private void DoDelete(AppearanceRequestData rdata)
// {
// AvatarData adata = Rest.AvatarServices.GetAvatar(rdata.userProfile.ID);
//
// if (adata != null)
// {
// AvatarAppearance old = adata.ToAvatarAppearance(rdata.userProfile.ID);
// rdata.userAppearance = new AvatarAppearance();
// rdata.userAppearance.Owner = old.Owner;
// adata = new AvatarData(rdata.userAppearance);
//
// Rest.AvatarServices.SetAvatar(rdata.userProfile.ID, adata);
//
// rdata.Complete();
// }
// else
// {
//
// rdata.Complete(Rest.HttpStatusCodeNoContent);
// }
//
// rdata.Respond(String.Format("Appearance {0} : Normal completion", rdata.method));
// }
#endregion method-specific processing

View File

@ -141,7 +141,17 @@ namespace OpenSim.Framework.Console
CommandInfo commandInfo = (CommandInfo)dict[String.Empty];
help.Add(commandInfo.help_text);
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);
if (descriptiveHelp != string.Empty)
help.Add(string.Empty);
}
else
{
@ -182,8 +192,7 @@ namespace OpenSim.Framework.Console
public void AddCommand(string module, bool shared, string command,
string help, string longhelp, CommandDelegate fn)
{
AddCommand(module, shared, command, help, longhelp,
String.Empty, fn);
AddCommand(module, shared, command, help, longhelp, String.Empty, fn);
}
/// <summary>

View File

@ -286,7 +286,11 @@ namespace OpenSim.Framework.Servers
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();

View File

@ -251,14 +251,20 @@ namespace OpenSim
"Save named prim to XML2", SavePrimsXml2);
m_console.Commands.AddCommand("region", false, "load oar",
"load oar [--merge] [--skip-assets] <oar name>",
"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 oar [--merge] [--skip-assets] [<OAR path>]",
"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);
m_console.Commands.AddCommand("region", false, "save oar",
"save oar <oar name>",
"Save a region's data to an OAR archive",
"More information on forthcoming options here soon", SaveOar);
"save oar [<OAR path>]",
"Save a region's data to an OAR archive.",
"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",
"edit scale <name> <x> <y> <z>",

View File

@ -37,7 +37,6 @@ using log4net;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Framework.Communications;
using OpenSim.Framework.Communications.Osp;
using OpenSim.Framework.Serialization;
using OpenSim.Framework.Serialization.External;
@ -72,7 +71,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
scene,
userInfo,
invPath,
new GZipStream(new FileStream(loadPath, FileMode.Open), CompressionMode.Decompress))
new GZipStream(ArchiveHelpers.GetStream(loadPath), CompressionMode.Decompress))
{
}

View File

@ -37,7 +37,6 @@ using OpenSim.Framework;
using OpenSim.Framework.Serialization;
using OpenSim.Framework.Serialization.External;
using OpenSim.Framework.Communications;
using OpenSim.Framework.Communications.Osp;
using OpenSim.Region.CoreModules.World.Archiver;
using OpenSim.Region.Framework.Scenes;

View File

@ -91,13 +91,26 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
scene.AddCommand(
this, "load iar",
"load iar <first> <last> <inventory path> <password> [<archive path>]",
"Load user inventory archive.", HandleLoadInvConsoleCommand);
"load iar <first> <last> <inventory path> <password> [<IAR path>]",
"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(
this, "save iar",
"save iar <first> <last> <inventory path> <password> [<archive path>]",
"Save user inventory archive.", HandleSaveInvConsoleCommand);
"save iar <first> <last> <inventory path> <password> [<IAR path>]",
"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;
}

View File

@ -38,7 +38,6 @@ using OpenSim.Framework;
using OpenSim.Framework.Serialization;
using OpenSim.Framework.Serialization.External;
using OpenSim.Framework.Communications;
using OpenSim.Framework.Communications.Osp;
using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver;
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
// GetFolderForType
// REFACTORING PROBLEM. This needs to be rewritten.
//[Test]
public void TestSaveIarV0_1()
{
TestHelper.InMethod();
log4net.Config.XmlConfigurator.Configure();
// [Test]
// public void TestSaveIarV0_1()
// {
// TestHelper.InMethod();
// //log4net.Config.XmlConfigurator.Configure();
InventoryArchiverModule archiverModule = new InventoryArchiverModule(true);
// InventoryArchiverModule archiverModule = new InventoryArchiverModule(true);
Scene scene = SceneSetupHelpers.SetupScene("Inventory");
SceneSetupHelpers.SetupSceneModules(scene, archiverModule);
// Scene scene = SceneSetupHelpers.SetupScene("Inventory");
// SceneSetupHelpers.SetupSceneModules(scene, archiverModule);
// CommunicationsManager cm = scene.CommsManager;
// Create user
string userFirstName = "Jock";
string userLastName = "Stirrup";
string userPassword = "troll";
UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020");
UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userId, userPassword);
// // Create user
// string userFirstName = "Jock";
// string userLastName = "Stirrup";
// UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020");
// Create asset
SceneObjectGroup object1;
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);
// lock (this)
// {
// UserProfileTestUtils.CreateUserWithInventory(
// cm, userFirstName, userLastName, userId, InventoryReceived);
// Monitor.Wait(this, 60000);
// }
part1
= new SceneObjectPart(
ownerId, shape, groupPosition, rotationOffset, offsetPosition);
part1.Name = partName;
// // Create asset
// SceneObjectGroup object1;
// 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);
object1 = new SceneObjectGroup(part1);
scene.AddNewSceneObject(object1, false);
}
// part1
// = new SceneObjectPart(
// ownerId, shape, groupPosition, rotationOffset, offsetPosition);
// part1.Name = partName;
UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060");
AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1);
scene.AssetService.Store(asset1);
// object1 = new SceneObjectGroup(part1);
// scene.AddNewSceneObject(object1, false);
// }
// Create item
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");
// AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1);
// scene.AssetService.Store(asset1);
MemoryStream archiveWriteStream = new MemoryStream();
archiverModule.OnInventoryArchiveSaved += SaveCompleted;
// // Create item
// 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);
mre.Reset();
archiverModule.ArchiveInventory(
Guid.NewGuid(), userFirstName, userLastName, "Objects", userPassword, archiveWriteStream);
mre.WaitOne(60000, false);
// MemoryStream archiveWriteStream = new MemoryStream();
// archiverModule.OnInventoryArchiveSaved += SaveCompleted;
byte[] archive = archiveWriteStream.ToArray();
MemoryStream archiveReadStream = new MemoryStream(archive);
TarArchiveReader tar = new TarArchiveReader(archiveReadStream);
// mre.Reset();
// archiverModule.ArchiveInventory(
// Guid.NewGuid(), userFirstName, userLastName, "Objects", "troll", archiveWriteStream);
// mre.WaitOne(60000, false);
//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);
// byte[] archive = archiveWriteStream.ToArray();
// MemoryStream archiveReadStream = new MemoryStream(archive);
// 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;
string filePath;
TarArchiveReader.TarEntryType tarEntryType;
// 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);
// if (ArchiveConstants.CONTROL_FILE_PATH == filePath)
// {
// Console.WriteLine("Got {0}", filePath);
// gotControlFile = true;
// }
//// if (ArchiveConstants.CONTROL_FILE_PATH == filePath)
//// {
//// gotControlFile = true;
//// }
// if (filePath.StartsWith(ArchiveConstants.INVENTORY_PATH) && filePath.EndsWith(".xml"))
if (filePath.StartsWith(ArchiveConstants.INVENTORY_PATH) && filePath.EndsWith(".xml"))
{
// string fileName = filePath.Remove(0, "Objects/".Length);
//
// if (fileName.StartsWith(part1.Name))
// {
//// 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;
//// }
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");
// Assert.That(gotObject1File, Is.True, "No item1 file in archive");
//// Assert.That(gotObject2File, Is.True, "No object2 file in archive");
// 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.
// }
// TODO: Test presence of more files and contents of files.
}
/// <summary>
/// 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>
/// Test replication of an archive path to the user's inventory.
/// </summary>
//[Test]
//public void TestReplicateArchivePathToUserInventory()
//{
// TestHelper.InMethod();
[Test]
public void TestReplicateArchivePathToUserInventory()
{
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");
// CommunicationsManager commsManager = scene.CommsManager;
// CachedUserInfo userInfo;
Dictionary <string, InventoryFolderBase> foldersCreated = new Dictionary<string, InventoryFolderBase>();
List<InventoryNodeBase> nodesLoaded = new List<InventoryNodeBase>();
// lock (this)
// {
// // !!! REFACTORING PROBLEM. This needs to be rewritten
// userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager, InventoryReceived);
// Monitor.Wait(this, 60000);
// }
string folder1Name = "a";
string folder2Name = "b";
string itemName = "c.lsl";
// //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>();
// List<InventoryNodeBase> nodesLoaded = new List<InventoryNodeBase>();
string itemArchivePath
= string.Format(
"{0}{1}{2}{3}",
ArchiveConstants.INVENTORY_PATH, folder1ArchiveName, folder2ArchiveName, itemArchiveName);
// string folder1Name = "a";
// string folder2Name = "b";
// string itemName = "c.lsl";
new InventoryArchiveReadRequest(scene, ua1, null, (Stream)null)
.ReplicateArchivePathToUserInventory(
itemArchivePath, false, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
foldersCreated, nodesLoaded);
// string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1Name, UUID.Random());
// string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random());
// string itemArchiveName = InventoryArchiveWriteRequest.CreateArchiveItemName(itemName, UUID.Random());
// string itemArchivePath
// = 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");
//}
InventoryFolderBase folder1
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, ua1.PrincipalID, "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");
}
}
}

View File

@ -25,6 +25,9 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.IO;
using System.Net;
using OpenMetaverse;
using OpenSim.Framework.Serialization;
using OpenSim.Region.Framework.Scenes;
@ -60,5 +63,66 @@ namespace OpenSim.Region.CoreModules.World.Archiver
{
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);
}
}
}

View File

@ -78,7 +78,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
try
{
m_loadStream = new GZipStream(GetStream(loadPath), CompressionMode.Decompress);
m_loadStream = new GZipStream(ArchiveHelpers.GetStream(loadPath), CompressionMode.Decompress);
}
catch (EntryPointNotFoundException e)
{
@ -472,68 +472,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver
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>
/// Load oar control file
/// </summary>

View File

@ -1014,7 +1014,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
int lastMapRefresh = 0;
int twoDays = 172800;
int RefreshSeconds = twoDays;
// int RefreshSeconds = twoDays;
try
{

View File

@ -2149,7 +2149,7 @@ namespace OpenSim.Region.Framework.Scenes
}
/// <summary>
/// Delete every object from the scene
/// Delete every object from the scene. This does not include attachments worn by avatars.
/// </summary>
public void DeleteAllSceneObjects()
{
@ -2160,10 +2160,14 @@ namespace OpenSim.Region.Framework.Scenes
foreach (EntityBase e in entities)
{
if (e is SceneObjectGroup)
{
SceneObjectGroup sog = (SceneObjectGroup)e;
if (!sog.IsAttachment)
DeleteSceneObject((SceneObjectGroup)e, false);
}
}
}
}
/// <summary>
/// Synchronously delete the given object from the scene.

View File

@ -376,6 +376,8 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="mod"></param>
public void RegisterModuleInterface<M>(M mod)
{
m_log.DebugFormat("[SCENE BASE]: Registering interface {0}", typeof(M));
List<Object> l = null;
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)
{
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)
return;
@ -523,7 +548,8 @@ namespace OpenSim.Region.Framework.Scenes
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)

View File

@ -1289,10 +1289,13 @@ namespace OpenSim.Region.Framework.Scenes
{
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)
{
presence.SceneViewer.QueuePartForUpdate(this);
@ -1313,7 +1316,7 @@ namespace OpenSim.Region.Framework.Scenes
{
m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar)
{
avatar.SceneViewer.QueuePartForUpdate(this);
AddTerseUpdateToAvatar(avatar);
});
}

View File

@ -820,15 +820,6 @@ namespace OpenSim.Region.Framework.Scenes
#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)
{
return m_scene.Permissions.GenerateClientFlags(m_uuid, ObjectID);

View File

@ -61,7 +61,7 @@ namespace OpenSim.Server
string connList = serverConfig.GetString("ServiceConnectors", String.Empty);
string[] conns = connList.Split(new char[] {',', ' '});
int i = 0;
// int i = 0;
foreach (string c in conns)
{
if (c == String.Empty)

View File

@ -54,7 +54,8 @@ namespace OpenSim.Services.PresenceService
public bool LoginAgent(string userID, UUID sessionID,
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();

View File

@ -277,8 +277,9 @@ namespace OpenSim.Services.UserAccountService
#endregion
#region Console commands
/// <summary>
/// Create a new user
/// Handle the create user command from the console.
/// </summary>
/// <param name="cmdparams">string array with parameters: firstname, lastname, password, locationX, locationY, email</param>
protected void HandleCreateUser(string module, string[] cmdparams)
@ -304,61 +305,7 @@ namespace OpenSim.Services.UserAccountService
email = MainConsole.Instance.CmdPrompt("Email", "");
else email = cmdparams[5];
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);
}
CreateUser(firstName, lastName, password, email);
}
protected void HandleResetUserPassword(string module, string[] cmdparams)
@ -395,5 +342,67 @@ namespace OpenSim.Services.UserAccountService
#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);
}
}
}
}

View File

@ -42,6 +42,7 @@ using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.CoreModules.Agent.Capabilities;
using OpenSim.Region.CoreModules.Avatar.Gods;
using OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset;
using OpenSim.Region.CoreModules.ServiceConnectorsOut.Authentication;
using OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory;
using OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid;
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
// CommunicationsManager.
private static ISharedRegionModule m_assetService = null;
// private static ISharedRegionModule m_authenticationService = null;
private static ISharedRegionModule m_inventoryService = null;
private static ISharedRegionModule m_gridService = null;
private static ISharedRegionModule m_userAccountService = null;
@ -178,6 +180,9 @@ namespace OpenSim.Tests.Common.Setup
else
StartAssetService(testScene, false);
// For now, always started a 'real' authenication service
StartAuthenticationService(testScene, true);
if (realServices.Contains("inventory"))
StartInventoryService(testScene, true);
else
@ -243,6 +248,27 @@ namespace OpenSim.Tests.Common.Setup
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)
{
ISharedRegionModule inventoryService = new LocalInventoryServicesConnector();

View File

@ -27,7 +27,8 @@
using OpenMetaverse;
using OpenSim.Framework.Communications;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Services.Interfaces;
namespace OpenSim.Tests.Common.Setup
{
@ -36,85 +37,99 @@ namespace OpenSim.Tests.Common.Setup
/// </summary>
public static class UserProfileTestUtils
{
// REFACTORING PROBLEM
// This needs to be rewritten
// /// <summary>
// /// 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>
///// 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);
//}
public static UserAccount CreateUserWithInventory(Scene scene)
{
return CreateUserWithInventory(
scene, "Bill", "Bailey", UUID.Parse("00000000-0000-0000-0000-000000000099"), "troll");
}
///// <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);
//}
public static UserAccount CreateUserWithInventory(
Scene scene, string firstName, string lastName, UUID userId, string pw)
{
UserAccount ua = new UserAccount(userId) { FirstName = firstName, LastName = lastName };
scene.UserAccountService.StoreUserAccount(ua);
scene.InventoryService.CreateUserInventory(ua.PrincipalID);
scene.AuthenticationService.SetPassword(ua.PrincipalID, pw);
///// <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;
//}
return ua;
}
}
}