From 5270e5426867877e84e4c148759dad8c20de76ea Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 1 Jun 2010 14:19:26 +0100 Subject: Comment and remove JScript support. Mono 2.7Dev and 2.8 no longer include the needed libraries --- .../ScriptEngine/Shared/CodeTools/Compiler.cs | 38 +++++++++++----------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs index f719683..cd8c67e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs @@ -32,7 +32,7 @@ using System.Globalization; using System.Reflection; using System.IO; using Microsoft.CSharp; -using Microsoft.JScript; +//using Microsoft.JScript; using Microsoft.VisualBasic; using log4net; using OpenSim.Region.Framework.Interfaces; @@ -82,7 +82,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools private static CSharpCodeProvider CScodeProvider = new CSharpCodeProvider(); private static VBCodeProvider VBcodeProvider = new VBCodeProvider(); - private static JScriptCodeProvider JScodeProvider = new JScriptCodeProvider(); +// private static JScriptCodeProvider JScodeProvider = new JScriptCodeProvider(); private static CSharpCodeProvider YPcodeProvider = new CSharpCodeProvider(); // YP is translated into CSharp private static YP2CSConverter YP_Converter = new YP2CSConverter(); @@ -398,9 +398,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools case enumCompileType.vb: compileScript = CreateVBCompilerScript(compileScript); break; - case enumCompileType.js: - compileScript = CreateJSCompilerScript(compileScript); - break; +// case enumCompileType.js: +// compileScript = CreateJSCompilerScript(compileScript); +// break; case enumCompileType.yp: compileScript = CreateYPCompilerScript(compileScript); break; @@ -423,16 +423,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools } } - private static string CreateJSCompilerScript(string compileScript) - { - compileScript = String.Empty + - "import OpenSim.Region.ScriptEngine.Shared; import System.Collections.Generic;\r\n" + - "package SecondLife {\r\n" + - "class Script extends OpenSim.Region.ScriptEngine.Shared.ScriptBase.ScriptBaseClass { \r\n" + - compileScript + - "} }\r\n"; - return compileScript; - } +// private static string CreateJSCompilerScript(string compileScript) +// { +// compileScript = String.Empty + +// "import OpenSim.Region.ScriptEngine.Shared; import System.Collections.Generic;\r\n" + +// "package SecondLife {\r\n" + +// "class Script extends OpenSim.Region.ScriptEngine.Shared.ScriptBase.ScriptBaseClass { \r\n" + +// compileScript + +// "} }\r\n"; +// return compileScript; +// } private static string CreateCSCompilerScript(string compileScript) { @@ -583,10 +583,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools } } while (!complete); break; - case enumCompileType.js: - results = JScodeProvider.CompileAssemblyFromSource( - parameters, Script); - break; +// case enumCompileType.js: +// results = JScodeProvider.CompileAssemblyFromSource( +// parameters, Script); +// break; case enumCompileType.yp: results = YPcodeProvider.CompileAssemblyFromSource( parameters, Script); -- cgit v1.1 From 9c3c020697cf5710781bb6e491a88bea72652c87 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 1 Jun 2010 15:08:45 +0100 Subject: Lock the object queue when dequeueing --- OpenSim/Region/Framework/Scenes/SceneViewer.cs | 159 +++++++++++++------------ 1 file changed, 81 insertions(+), 78 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/SceneViewer.cs b/OpenSim/Region/Framework/Scenes/SceneViewer.cs index 15bc33d..5cbd8d9 100644 --- a/OpenSim/Region/Framework/Scenes/SceneViewer.cs +++ b/OpenSim/Region/Framework/Scenes/SceneViewer.cs @@ -67,105 +67,108 @@ namespace OpenSim.Region.Framework.Scenes public void SendPrimUpdates() { - if (m_pendingObjects == null) + lock(m_pendingObjects) { - if (!m_presence.IsChildAgent || (m_presence.Scene.m_seeIntoRegionFromNeighbor)) + if (m_pendingObjects == null) { - m_pendingObjects = new Queue(); - - foreach (EntityBase e in m_presence.Scene.Entities) + if (!m_presence.IsChildAgent || (m_presence.Scene.m_seeIntoRegionFromNeighbor)) { - if (e is SceneObjectGroup) - m_pendingObjects.Enqueue((SceneObjectGroup)e); + m_pendingObjects = new Queue(); + + foreach (EntityBase e in m_presence.Scene.Entities) + { + if (e != null && e is SceneObjectGroup) + m_pendingObjects.Enqueue((SceneObjectGroup)e); + } } } - } - - while (m_pendingObjects != null && m_pendingObjects.Count > 0) - { - SceneObjectGroup g = m_pendingObjects.Dequeue(); - // Yes, this can really happen - if (g == null) - continue; - - // This is where we should check for draw distance - // do culling and stuff. Problem with that is that until - // we recheck in movement, that won't work right. - // So it's not implemented now. - // - - // Don't even queue if we have sent this one - // - if (!m_updateTimes.ContainsKey(g.UUID)) - g.ScheduleFullUpdateToAvatar(m_presence); - } - while (m_partsUpdateQueue.Count > 0) - { - SceneObjectPart part = m_partsUpdateQueue.Dequeue(); - - if (part.ParentGroup == null || part.ParentGroup.IsDeleted) - continue; - - if (m_updateTimes.ContainsKey(part.UUID)) + while (m_pendingObjects != null && m_pendingObjects.Count > 0) { - ScenePartUpdate update = m_updateTimes[part.UUID]; + SceneObjectGroup g = m_pendingObjects.Dequeue(); + // Yes, this can really happen + if (g == null) + continue; - // We deal with the possibility that two updates occur at - // the same unix time at the update point itself. + // This is where we should check for draw distance + // do culling and stuff. Problem with that is that until + // we recheck in movement, that won't work right. + // So it's not implemented now. + // + + // Don't even queue if we have sent this one + // + if (!m_updateTimes.ContainsKey(g.UUID)) + g.ScheduleFullUpdateToAvatar(m_presence); + } - if ((update.LastFullUpdateTime < part.TimeStampFull) || - part.IsAttachment) + while (m_partsUpdateQueue.Count > 0) + { + SceneObjectPart part = m_partsUpdateQueue.Dequeue(); + + if (part.ParentGroup == null || part.ParentGroup.IsDeleted) + continue; + + if (m_updateTimes.ContainsKey(part.UUID)) { -// m_log.DebugFormat( -// "[SCENE PRESENCE]: Fully updating prim {0}, {1} - part timestamp {2}", -// part.Name, part.UUID, part.TimeStampFull); + ScenePartUpdate update = m_updateTimes[part.UUID]; - part.SendFullUpdate(m_presence.ControllingClient, - m_presence.GenerateClientFlags(part.UUID)); + // We deal with the possibility that two updates occur at + // the same unix time at the update point itself. - // We'll update to the part's timestamp rather than - // the current time to avoid the race condition - // whereby the next tick occurs while we are doing - // this update. If this happened, then subsequent - // updates which occurred on the same tick or the - // next tick of the last update would be ignored. + if ((update.LastFullUpdateTime < part.TimeStampFull) || + part.IsAttachment) + { + // m_log.DebugFormat( + // "[SCENE PRESENCE]: Fully updating prim {0}, {1} - part timestamp {2}", + // part.Name, part.UUID, part.TimeStampFull); - update.LastFullUpdateTime = part.TimeStampFull; + part.SendFullUpdate(m_presence.ControllingClient, + m_presence.GenerateClientFlags(part.UUID)); - } - else if (update.LastTerseUpdateTime <= part.TimeStampTerse) - { -// m_log.DebugFormat( -// "[SCENE PRESENCE]: Tersely updating prim {0}, {1} - part timestamp {2}", -// part.Name, part.UUID, part.TimeStampTerse); + // We'll update to the part's timestamp rather than + // the current time to avoid the race condition + // whereby the next tick occurs while we are doing + // this update. If this happened, then subsequent + // updates which occurred on the same tick or the + // next tick of the last update would be ignored. - part.SendTerseUpdateToClient(m_presence.ControllingClient); + update.LastFullUpdateTime = part.TimeStampFull; - update.LastTerseUpdateTime = part.TimeStampTerse; - } - } - else - { - //never been sent to client before so do full update - ScenePartUpdate update = new ScenePartUpdate(); - update.FullID = part.UUID; - update.LastFullUpdateTime = part.TimeStampFull; - m_updateTimes.Add(part.UUID, update); + } + else if (update.LastTerseUpdateTime <= part.TimeStampTerse) + { + // m_log.DebugFormat( + // "[SCENE PRESENCE]: Tersely updating prim {0}, {1} - part timestamp {2}", + // part.Name, part.UUID, part.TimeStampTerse); - // Attachment handling - // - if (part.ParentGroup.RootPart.Shape.PCode == 9 && part.ParentGroup.RootPart.Shape.State != 0) + part.SendTerseUpdateToClient(m_presence.ControllingClient); + + update.LastTerseUpdateTime = part.TimeStampTerse; + } + } + else { - if (part != part.ParentGroup.RootPart) + //never been sent to client before so do full update + ScenePartUpdate update = new ScenePartUpdate(); + update.FullID = part.UUID; + update.LastFullUpdateTime = part.TimeStampFull; + m_updateTimes.Add(part.UUID, update); + + // Attachment handling + // + if (part.ParentGroup.RootPart.Shape.PCode == 9 && part.ParentGroup.RootPart.Shape.State != 0) + { + if (part != part.ParentGroup.RootPart) + continue; + + part.ParentGroup.SendFullUpdateToClient(m_presence.ControllingClient); continue; + } - part.ParentGroup.SendFullUpdateToClient(m_presence.ControllingClient); - continue; + part.SendFullUpdate(m_presence.ControllingClient, + m_presence.GenerateClientFlags(part.UUID)); } - - part.SendFullUpdate(m_presence.ControllingClient, - m_presence.GenerateClientFlags(part.UUID)); } } } -- cgit v1.1 From a863eb9da3eba3644933b7622239dde641e7050c Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Tue, 1 Jun 2010 19:01:21 +0200 Subject: One should not lock null objects. --- OpenSim/Region/Framework/Scenes/SceneViewer.cs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/SceneViewer.cs b/OpenSim/Region/Framework/Scenes/SceneViewer.cs index 5cbd8d9..f478a4a 100644 --- a/OpenSim/Region/Framework/Scenes/SceneViewer.cs +++ b/OpenSim/Region/Framework/Scenes/SceneViewer.cs @@ -67,14 +67,14 @@ namespace OpenSim.Region.Framework.Scenes public void SendPrimUpdates() { - lock(m_pendingObjects) + if (m_pendingObjects == null) { - if (m_pendingObjects == null) + if (!m_presence.IsChildAgent || (m_presence.Scene.m_seeIntoRegionFromNeighbor)) { - if (!m_presence.IsChildAgent || (m_presence.Scene.m_seeIntoRegionFromNeighbor)) - { - m_pendingObjects = new Queue(); + m_pendingObjects = new Queue(); + lock(m_pendingObjects) + { foreach (EntityBase e in m_presence.Scene.Entities) { if (e != null && e is SceneObjectGroup) @@ -82,7 +82,10 @@ namespace OpenSim.Region.Framework.Scenes } } } + } + lock(m_pendingObjects) + { while (m_pendingObjects != null && m_pendingObjects.Count > 0) { SceneObjectGroup g = m_pendingObjects.Dequeue(); -- cgit v1.1 From d740035ef4414cc3543251d43c74ebb68fe08baf Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Tue, 1 Jun 2010 13:32:14 -0700 Subject: Applying patch from coyled to fix IAR support with the SimianGrid connectors --- .../Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs index b19135e..de3ee4e 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs @@ -116,7 +116,7 @@ namespace OpenSim.Services.Connectors.SimianGrid { string credential = identity["Credential"].AsString(); - if (password == credential || "$1$" + Utils.MD5String(password) == credential || Utils.MD5String(password) == credential) + if (password == credential || "$1$" + password == credential || "$1$" + Utils.MD5String(password) == credential || Utils.MD5String(password) == credential) return Authorize(principalID); md5hashFound = true; -- cgit v1.1 From 53e96dccef005237a4d5afe477e19ab1837a5c7c Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Wed, 2 Jun 2010 01:01:56 +0200 Subject: Add two new osFunctions: list osGetPrimititveParams(key prim, list rules); osSetPrimitiveParams(key prim, list rules); --- .../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 18 ++++++++++++++++++ .../ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 16 ++++++++++++++++ .../ScriptEngine/Shared/Api/Interface/ILSL_Api.cs | 3 +++ .../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 4 ++++ .../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 9 +++++++++ 5 files changed, 50 insertions(+) (limited to 'OpenSim') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 6e9a823..a8a3595 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -9788,6 +9788,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api ScriptSleep(100); return tid.ToString(); } + + public void SetPrimitiveParamsEx(LSL_Key prim, LSL_List rules) + { + SceneObjectPart obj = World.GetSceneObjectPart(new UUID(prim)); + if (obj == null) + return; + + SetPrimParams(obj, rules); + } + + public LSL_List GetLinkPrimitiveParamsEx(LSL_Key prim, LSL_List rules) + { + SceneObjectPart obj = World.GetSceneObjectPart(new UUID(prim)); + if (obj == null) + return new LSL_List(); + + return GetLinkPrimitiveParams(obj, rules); + } } public class NotecardCache diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 7ada738..dde664e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2186,5 +2186,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } } + + public LSL_List osGetPrimitiveParams(LSL_Key prim, LSL_List rules) + { + CheckThreatLevel(ThreatLevel.High, "osGetPrimitiveParams"); + m_host.AddScriptLPS(1); + + return m_LSL_Api.GetLinkPrimitiveParamsEx(prim, rules); + } + + public void osSetPrimitiveParams(LSL_Key prim, LSL_List rules) + { + CheckThreatLevel(ThreatLevel.High, "osGetPrimitiveParams"); + m_host.AddScriptLPS(1); + + m_LSL_Api.SetPrimitiveParamsEx(prim, rules); + } } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs index 7ab04a3..cba46a3 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs @@ -395,5 +395,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces LSL_Vector llWind(LSL_Vector offset); LSL_String llXorBase64Strings(string str1, string str2); LSL_String llXorBase64StringsCorrect(string str1, string str2); + + void SetPrimitiveParamsEx(LSL_Key prim, LSL_List rules); + LSL_List GetLinkPrimitiveParamsEx(LSL_Key prim, LSL_List rules); } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 7a8f469..9785b24 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -35,6 +35,7 @@ using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list; using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger; using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat; +using LSL_Key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces { @@ -173,5 +174,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces void osSetSpeed(string UUID, float SpeedModifier); void osCauseHealing(string avatar, double healing); void osCauseDamage(string avatar, double damage); + LSL_List osGetPrimitiveParams(LSL_Key prim, LSL_List rules); + void osSetPrimitiveParams(LSL_Key prim, LSL_List rules); + } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index fd9309a..7af5d43 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -41,6 +41,7 @@ using rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion; using key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list; using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; +using LSL_Key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat; using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger; @@ -678,5 +679,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase { m_OSSL_Functions.osCauseHealing(avatar, healing); } + public LSL_List osGetPrimitiveParams(LSL_Key prim, LSL_List rules) + { + return m_OSSL_Functions.osGetPrimitiveParams(prim, rules); + } + public void osSetPrimitiveParams(LSL_Key prim, LSL_List rules) + { + m_OSSL_Functions.osSetPrimitiveParams(prim, rules); + } } } -- cgit v1.1 From aa5a346a68415971a294af73c20d57a1fcd32c05 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Wed, 2 Jun 2010 01:04:17 +0200 Subject: Add a forgotten security check. Make the new functions only work on prims owned by the host prim owner. --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'OpenSim') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index a8a3595..5400a4f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -9795,6 +9795,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (obj == null) return; + if (obj.OwnerID != m_host.OwnerID) + return; + SetPrimParams(obj, rules); } @@ -9804,6 +9807,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (obj == null) return new LSL_List(); + if (obj.OwnerID != m_host.OwnerID) + return new LSL_List(); + return GetLinkPrimitiveParams(obj, rules); } } -- cgit v1.1 From 55040a84a5e4b84e5dc3d979945a91c35c5820e0 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 4 Jun 2010 17:14:12 +0100 Subject: Fix bug where prim items were not loaded in the new sqlite database handler This addresses mantis http://opensimulator.org/mantis/view.php?id=4739 --- OpenSim/Data/SQLite/SQLiteRegionData.cs | 66 +++++++++++++++++++-------------- 1 file changed, 39 insertions(+), 27 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Data/SQLite/SQLiteRegionData.cs b/OpenSim/Data/SQLite/SQLiteRegionData.cs index 85703dc..81d0ac4 100644 --- a/OpenSim/Data/SQLite/SQLiteRegionData.cs +++ b/OpenSim/Data/SQLite/SQLiteRegionData.cs @@ -93,7 +93,7 @@ namespace OpenSim.Data.SQLite ds = new DataSet("Region"); - m_log.Info("[REGION DB]: Sqlite - connecting: " + connectionString); + m_log.Info("[SQLITE REGION DB]: Sqlite - connecting: " + connectionString); m_conn = new SqliteConnection(m_connectionString); m_conn.Open(); @@ -156,7 +156,7 @@ namespace OpenSim.Data.SQLite } catch (Exception) { - m_log.Info("[REGION DB]: Caught fill error on prims table"); + m_log.Info("[SQLITE REGION DB]: Caught fill error on prims table"); } try @@ -165,16 +165,25 @@ namespace OpenSim.Data.SQLite } catch (Exception) { - m_log.Info("[REGION DB]: Caught fill error on primshapes table"); + m_log.Info("[SQLITE REGION DB]: Caught fill error on primshapes table"); } try { + itemsDa.Fill(ds.Tables["primitems"]); + } + catch (Exception) + { + m_log.Info("[SQLITE REGION DB]: Caught fill error on primitems table"); + } + + try + { terrainDa.Fill(ds.Tables["terrain"]); } catch (Exception) { - m_log.Info("[REGION DB]: Caught fill error on terrain table"); + m_log.Info("[SQLITE REGION DB]: Caught fill error on terrain table"); } try @@ -183,7 +192,7 @@ namespace OpenSim.Data.SQLite } catch (Exception) { - m_log.Info("[REGION DB]: Caught fill error on land table"); + m_log.Info("[SQLITE REGION DB]: Caught fill error on land table"); } try @@ -192,7 +201,7 @@ namespace OpenSim.Data.SQLite } catch (Exception) { - m_log.Info("[REGION DB]: Caught fill error on landaccesslist table"); + m_log.Info("[SQLITE REGION DB]: Caught fill error on landaccesslist table"); } try @@ -201,7 +210,7 @@ namespace OpenSim.Data.SQLite } catch (Exception) { - m_log.Info("[REGION DB]: Caught fill error on regionsettings table"); + m_log.Info("[SQLITE REGION DB]: Caught fill error on regionsettings table"); } // We have to create a data set mapping for every table, otherwise the IDataAdaptor.Update() will not populate rows with values! @@ -434,7 +443,7 @@ namespace OpenSim.Data.SQLite lock (ds) { DataRow[] primsForRegion = prims.Select(byRegion); - m_log.Info("[REGION DB]: Loaded " + primsForRegion.Length + " prims for region: " + regionUUID); +// m_log.Info("[SQLITE REGION DB]: Loaded " + primsForRegion.Length + " prims for region: " + regionUUID); // First, create all groups foreach (DataRow primRow in primsForRegion) @@ -456,8 +465,8 @@ namespace OpenSim.Data.SQLite } else { - m_log.Info( - "[REGION DB]: No shape found for prim in storage, so setting default box shape"); + m_log.Warn( + "[SQLITE REGION DB]: No shape found for prim in storage, so setting default box shape"); prim.Shape = PrimitiveBaseShape.Default; } @@ -469,11 +478,11 @@ namespace OpenSim.Data.SQLite } catch (Exception e) { - m_log.Error("[REGION DB]: Failed create prim object in new group, exception and data follows"); - m_log.Info("[REGION DB]: " + e.ToString()); + m_log.Error("[SQLITE REGION DB]: Failed create prim object in new group, exception and data follows"); + m_log.Error("[SQLITE REGION DB]: ", e); foreach (DataColumn col in prims.Columns) { - m_log.Info("[REGION DB]: Col: " + col.ColumnName + " => " + primRow[col]); + m_log.Error("[SQLITE REGION DB]: Col: " + col.ColumnName + " => " + primRow[col]); } } } @@ -498,7 +507,7 @@ namespace OpenSim.Data.SQLite else { m_log.Warn( - "[REGION DB]: No shape found for prim in storage, so setting default box shape"); + "[SQLITE REGION DB]: No shape found for prim in storage, so setting default box shape"); prim.Shape = PrimitiveBaseShape.Default; } @@ -508,11 +517,11 @@ namespace OpenSim.Data.SQLite } catch (Exception e) { - m_log.Error("[REGION DB]: Failed create prim object in group, exception and data follows"); - m_log.Info("[REGION DB]: " + e.ToString()); + m_log.Error("[SQLITE REGION DB]: Failed create prim object in group, exception and data follows"); + m_log.Error("[SQLITE REGION DB]: ", e); foreach (DataColumn col in prims.Columns) { - m_log.Info("[REGION DB]: Col: " + col.ColumnName + " => " + primRow[col]); + m_log.Error("[SQLITE REGION DB]: Col: " + col.ColumnName + " => " + primRow[col]); } } } @@ -525,20 +534,23 @@ namespace OpenSim.Data.SQLite /// /// the prim private void LoadItems(SceneObjectPart prim) - { - //m_log.DebugFormat("[DATASTORE]: Loading inventory for {0}, {1}", prim.Name, prim.UUID); - + { +// m_log.DebugFormat("[SQLITE REGION DB]: Loading inventory for {0} {1}", prim.Name, prim.UUID); + DataTable dbItems = ds.Tables["primitems"]; - String sql = String.Format("primID = '{0}'", prim.UUID.ToString()); + String sql = String.Format("primID = '{0}'", prim.UUID.ToString()); DataRow[] dbItemRows = dbItems.Select(sql); IList inventory = new List(); +// m_log.DebugFormat( +// "[SQLITE REGION DB]: Found {0} items for {1} {2}", dbItemRows.Length, prim.Name, prim.UUID); + foreach (DataRow row in dbItemRows) { TaskInventoryItem item = buildItem(row); inventory.Add(item); - //m_log.DebugFormat("[DATASTORE]: Restored item {0}, {1}", item.Name, item.ItemID); +// m_log.DebugFormat("[SQLITE REGION DB]: Restored item {0} {1}", item.Name, item.ItemID); } prim.Inventory.RestoreInventoryItems(inventory); @@ -574,7 +586,7 @@ namespace OpenSim.Data.SQLite // the following is an work around for .NET. The perf // issues associated with it aren't as bad as you think. - m_log.Info("[REGION DB]: Storing terrain revision r" + revision.ToString()); + m_log.Debug("[SQLITE REGION DB]: Storing terrain revision r" + revision.ToString()); String sql = "insert into terrain(RegionUUID, Revision, Heightfield)" + " values(:RegionUUID, :Revision, :Heightfield)"; @@ -630,11 +642,11 @@ namespace OpenSim.Data.SQLite } else { - m_log.Info("[REGION DB]: No terrain found for region"); + m_log.Warn("[SQLITE REGION DB]: No terrain found for region"); return null; } - m_log.Info("[REGION DB]: Loaded terrain revision r" + rev.ToString()); + m_log.Debug("[SQLITE REGION DB]: Loaded terrain revision r" + rev.ToString()); } } return terret; @@ -1417,7 +1429,7 @@ namespace OpenSim.Data.SQLite } catch (InvalidCastException) { - m_log.ErrorFormat("[PARCEL]: unable to get parcel telehub settings for {1}", newData.Name); + m_log.ErrorFormat("[SQLITE REGION DB]: unable to get parcel telehub settings for {1}", newData.Name); newData.UserLocation = Vector3.Zero; newData.UserLookAt = Vector3.Zero; } @@ -1926,7 +1938,7 @@ namespace OpenSim.Data.SQLite /// public void StorePrimInventory(UUID primID, ICollection items) { - //m_log.InfoFormat("[REGION DB]: Entered StorePrimInventory with prim ID {0}", primID); +// m_log.DebugFormat("[SQLITE REGION DB]: Entered StorePrimInventory with prim ID {0}", primID); DataTable dbItems = ds.Tables["primitems"]; -- cgit v1.1 From 041f253e2b8ba1d470198849a09979c12b325719 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 4 Jun 2010 18:08:40 +0100 Subject: minor: comment out region interface registration log msg I accidentally left in last week also changes one log message to print out full exception stack trace on both mono/.net instead of just .net --- OpenSim/Region/Framework/Scenes/SceneBase.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs index ee17fbf..f8591ba 100644 --- a/OpenSim/Region/Framework/Scenes/SceneBase.cs +++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs @@ -267,7 +267,7 @@ namespace OpenSim.Region.Framework.Scenes } catch (Exception e) { - m_log.Error("[SCENE]: SceneBase.cs: Close() - Failed with exception " + e.ToString()); + m_log.Error(string.Format("[SCENE]: SceneBase.cs: Close() - Failed with exception ", e)); } } @@ -376,7 +376,7 @@ namespace OpenSim.Region.Framework.Scenes /// public void RegisterModuleInterface(M mod) { - m_log.DebugFormat("[SCENE BASE]: Registering interface {0}", typeof(M)); +// m_log.DebugFormat("[SCENE BASE]: Registering interface {0}", typeof(M)); List l = null; if (!ModuleInterfaces.TryGetValue(typeof(M), out l)) -- cgit v1.1 From 5c322335e58312be6070085cf26fc0db191c48da Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 4 Jun 2010 18:27:16 +0100 Subject: add sqlite database back to database tests this appears to be okay even though we reuse it between runs without deleting it first. size of the database appears not to be changing though that could be deceptive --- OpenSim/Data/SQLite/Resources/RegionStore.migrations | 2 +- OpenSim/Data/Tests/Resources/TestDataConnections.ini | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Data/SQLite/Resources/RegionStore.migrations b/OpenSim/Data/SQLite/Resources/RegionStore.migrations index c47a85d..c2de1af 100644 --- a/OpenSim/Data/SQLite/Resources/RegionStore.migrations +++ b/OpenSim/Data/SQLite/Resources/RegionStore.migrations @@ -1,4 +1,4 @@ -:VERSION 1 +:VERSION 1 BEGIN TRANSACTION; diff --git a/OpenSim/Data/Tests/Resources/TestDataConnections.ini b/OpenSim/Data/Tests/Resources/TestDataConnections.ini index 5e68ab0..7b55467 100644 --- a/OpenSim/Data/Tests/Resources/TestDataConnections.ini +++ b/OpenSim/Data/Tests/Resources/TestDataConnections.ini @@ -21,4 +21,4 @@ [TestConnections] MySqlConnection="Server=localhost;Port=3306;Database=opensim-nunit;User ID=opensim-nunit;Password=opensim-nunit;" SqlConnection="Server=.\SQL2008;Database=opensim-nunit;Trusted_Connection=True;" -SqliteConnection="" \ No newline at end of file +SqliteConnection="URI=file:opensim-nunit.db,version=3" \ No newline at end of file -- cgit v1.1 From 86f2339b6e236e291bac743face1f0f1c574fc05 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 4 Jun 2010 18:45:12 +0100 Subject: remove estate stuff in sqlite region migrations since this also exists in estate migrations, change Sandbox to sandbox in sqlite region migrations re-enabling the sqlite data tests revealed these errors! --- .../Data/SQLite/Resources/RegionStore.migrations | 55 +--------------------- 1 file changed, 1 insertion(+), 54 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Data/SQLite/Resources/RegionStore.migrations b/OpenSim/Data/SQLite/Resources/RegionStore.migrations index c2de1af..c461bf0 100644 --- a/OpenSim/Data/SQLite/Resources/RegionStore.migrations +++ b/OpenSim/Data/SQLite/Resources/RegionStore.migrations @@ -219,59 +219,6 @@ COMMIT; BEGIN TRANSACTION; -CREATE TABLE estate_groups ( - EstateID int(10) NOT NULL, - uuid char(36) NOT NULL -); - -CREATE TABLE estate_managers ( - EstateID int(10) NOT NULL, - uuid char(36) NOT NULL -); - -CREATE TABLE estate_map ( - RegionID char(36) NOT NULL default '00000000-0000-0000-0000-000000000000', - EstateID int(11) NOT NULL -); - -CREATE TABLE estate_settings ( - EstateID INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, - EstateName varchar(64) default NULL, - AbuseEmailToEstateOwner tinyint(4) NOT NULL, - DenyAnonymous tinyint(4) NOT NULL, - ResetHomeOnTeleport tinyint(4) NOT NULL, - FixedSun tinyint(4) NOT NULL, - DenyTransacted tinyint(4) NOT NULL, - BlockDwell tinyint(4) NOT NULL, - DenyIdentified tinyint(4) NOT NULL, - AllowVoice tinyint(4) NOT NULL, - UseGlobalTime tinyint(4) NOT NULL, - PricePerMeter int(11) NOT NULL, - TaxFree tinyint(4) NOT NULL, - AllowDirectTeleport tinyint(4) NOT NULL, - RedirectGridX int(11) NOT NULL, - RedirectGridY int(11) NOT NULL, - ParentEstateID int(10) NOT NULL, - SunPosition double NOT NULL, - EstateSkipScripts tinyint(4) NOT NULL, - BillableFactor float NOT NULL, - PublicAccess tinyint(4) NOT NULL -); -insert into estate_settings (EstateID,EstateName,AbuseEmailToEstateOwner,DenyAnonymous,ResetHomeOnTeleport,FixedSun,DenyTransacted,BlockDwell,DenyIdentified,AllowVoice,UseGlobalTime,PricePerMeter,TaxFree,AllowDirectTeleport,RedirectGridX,RedirectGridY,ParentEstateID,SunPosition,PublicAccess,EstateSkipScripts,BillableFactor) values ( 99, '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''); -delete from estate_settings; -CREATE TABLE estate_users ( - EstateID int(10) NOT NULL, - uuid char(36) NOT NULL -); - -CREATE TABLE estateban ( - EstateID int(10) NOT NULL, - bannedUUID varchar(36) NOT NULL, - bannedIp varchar(16) NOT NULL, - bannedIpHostMask varchar(16) NOT NULL, - bannedNameMask varchar(64) default NULL -); - drop table regionsettings; CREATE TABLE regionsettings ( regionUUID char(36) NOT NULL, @@ -307,7 +254,7 @@ CREATE TABLE regionsettings ( fixed_sun int(11) NOT NULL, sun_position float NOT NULL, covenant char(36) default NULL, - Sandbox tinyint(4) NOT NULL, + sandbox tinyint(4) NOT NULL, PRIMARY KEY (regionUUID) ); -- cgit v1.1 From 952029380a6a038e382dd3b2c312b3e16ff08625 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 4 Jun 2010 10:59:59 -0700 Subject: Fixed a couple of buglets in Friendship offers / acceptance / decline when avies are in different sims. --- .../CoreModules/Avatar/Friends/FriendsModule.cs | 56 +++++++++++++--------- .../Avatar/Friends/FriendsRequestHandler.cs | 13 +++-- .../UserAccounts/UserAccountCache.cs | 4 +- .../Handlers/Inventory/XInventoryInConnector.cs | 2 +- OpenSim/Server/Handlers/Login/LLLoginHandlers.cs | 2 +- .../Connectors/Friends/FriendsServiceConnector.cs | 2 +- .../Connectors/Friends/FriendsSimConnector.cs | 9 +++- OpenSim/Services/LLLoginService/LLLoginService.cs | 2 + .../Services/PresenceService/PresenceService.cs | 2 +- 9 files changed, 58 insertions(+), 34 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index 0c81f44..0050653 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs @@ -111,10 +111,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends protected IGridService GridService { - get - { - return m_Scenes[0].GridService; - } + get { return m_Scenes[0].GridService; } + } + + public IUserAccountService UserAccountService + { + get { return m_Scenes[0].UserAccountService; } } public IScene Scene @@ -220,33 +222,37 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends client.OnLogout += OnLogout; - if (m_Friends.ContainsKey(client.AgentId)) + lock (m_Friends) { - m_Friends[client.AgentId].Refcount++; - return; - } + if (m_Friends.ContainsKey(client.AgentId)) + { + m_Friends[client.AgentId].Refcount++; + return; + } - UserFriendData newFriends = new UserFriendData(); + UserFriendData newFriends = new UserFriendData(); - newFriends.PrincipalID = client.AgentId; - newFriends.Friends = m_FriendsService.GetFriends(client.AgentId); - newFriends.Refcount = 1; - newFriends.RegionID = UUID.Zero; + newFriends.PrincipalID = client.AgentId; + newFriends.Friends = m_FriendsService.GetFriends(client.AgentId); + newFriends.Refcount = 1; + newFriends.RegionID = UUID.Zero; - m_Friends.Add(client.AgentId, newFriends); + m_Friends.Add(client.AgentId, newFriends); + } //StatusChange(client.AgentId, true); } private void OnClientClosed(UUID agentID, Scene scene) { - if (m_Friends.ContainsKey(agentID)) - { - if (m_Friends[agentID].Refcount == 1) - m_Friends.Remove(agentID); - else - m_Friends[agentID].Refcount--; - } + lock (m_Friends) + if (m_Friends.ContainsKey(agentID)) + { + if (m_Friends[agentID].Refcount == 1) + m_Friends.Remove(agentID); + else + m_Friends[agentID].Refcount--; + } } private void OnLogout(IClientAPI client) @@ -518,12 +524,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends private void OnApproveFriendRequest(IClientAPI client, UUID agentID, UUID friendID, List callingCardFolders) { + m_log.DebugFormat("[FRIENDS]: {0} accepted friendship from {1}", agentID, friendID); + FriendsService.StoreFriend(agentID, friendID.ToString(), 1); FriendsService.StoreFriend(friendID, agentID.ToString(), 1); // update the local cache m_Friends[agentID].Friends = FriendsService.GetFriends(agentID); - m_log.DebugFormat("[FRIENDS]: {0} accepted friendship from {1}", agentID, friendID); // // Notify the friend @@ -572,7 +579,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends if (friendSession != null) { GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); - m_FriendsSimConnector.FriendshipDenied(region, agentID, client.Name, friendID); + if (region != null) + m_FriendsSimConnector.FriendshipDenied(region, agentID, client.Name, friendID); + else + m_log.WarnFormat("[FRIENDS]: Could not find region {0} in locating {1}", friendSession.RegionID, friendID); } } } diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsRequestHandler.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsRequestHandler.cs index 0883c5b..496f2ab 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsRequestHandler.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsRequestHandler.cs @@ -35,6 +35,7 @@ using OpenSim.Framework; using OpenSim.Server.Base; using OpenSim.Framework.Servers.HttpServer; using FriendInfo = OpenSim.Services.Interfaces.FriendInfo; +using OpenSim.Services.Interfaces; using OpenMetaverse; using log4net; @@ -61,7 +62,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends sr.Close(); body = body.Trim(); - m_log.DebugFormat("[XXX]: query String: {0}", body); + //m_log.DebugFormat("[XXX]: query String: {0}", body); try { @@ -115,9 +116,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends if (!UUID.TryParse(request["ToID"].ToString(), out toID)) return FailureResult(); - GridInstantMessage im = new GridInstantMessage(m_FriendsModule.Scene, fromID, "", toID, + UserAccount account = m_FriendsModule.UserAccountService.GetUserAccount(m_FriendsModule.Scene.RegionInfo.ScopeID, fromID); + string name = (account == null) ? "Unknown" : account.FirstName + " " + account.LastName; + + GridInstantMessage im = new GridInstantMessage(m_FriendsModule.Scene, fromID, name, toID, (byte)InstantMessageDialog.FriendshipOffered, message, false, Vector3.Zero); - + + // !! HACK + im.imSessionID = im.fromAgentID; + if (m_FriendsModule.LocalFriendshipOffered(toID, im)) return SuccessResult(); diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs index a355661..e1bc243 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs @@ -44,10 +44,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts public UserAccountCache() { - // Warning: the size values are a bit fuzzy. What matters - // most for this cache is the count value (128 entries). m_UUIDCache = new ExpiringCache(); - m_NameCache = new ExpiringCache(); // this one is unbound + m_NameCache = new ExpiringCache(); } public void Cache(UUID userID, UserAccount account) diff --git a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs index b0fee6d..6e580f1 100644 --- a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs +++ b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs @@ -149,7 +149,7 @@ namespace OpenSim.Server.Handlers.Asset } catch (Exception e) { - m_log.Debug("[XINVENTORY HANDLER]: Exception {0}" + e); + m_log.Debug("[XINVENTORY HANDLER]: Exception {0}", e); } return FailureResult(); diff --git a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs index c9bf996..5bb529c 100644 --- a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs +++ b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs @@ -83,7 +83,7 @@ namespace OpenSim.Server.Handlers.Login clientVersion = requestData["version"].ToString(); // We should do something interesting with the client version... - m_log.InfoFormat("[LOGIN]: XMLRPC Login Requested for {0} {1}, starting in {2}, using {3}", first, last, startLocation, clientVersion); + //m_log.InfoFormat("[LOGIN]: XMLRPC Login Requested for {0} {1}, starting in {2}, using {3}", first, last, startLocation, clientVersion); LoginResponse reply = null; reply = m_LocalService.Login(first, last, passwd, startLocation, scopeID, clientVersion, remoteClient); diff --git a/OpenSim/Services/Connectors/Friends/FriendsServiceConnector.cs b/OpenSim/Services/Connectors/Friends/FriendsServiceConnector.cs index baefebd..d7a5731 100644 --- a/OpenSim/Services/Connectors/Friends/FriendsServiceConnector.cs +++ b/OpenSim/Services/Connectors/Friends/FriendsServiceConnector.cs @@ -196,7 +196,7 @@ namespace OpenSim.Services.Connectors { Dictionary sendData = new Dictionary(); sendData["PRINCIPALID"] = PrincipalID.ToString(); - sendData["FRIENDS"] = Friend; + sendData["FRIEND"] = Friend; sendData["METHOD"] = "deletefriend"; string reqString = ServerUtils.BuildQueryString(sendData); diff --git a/OpenSim/Services/Connectors/Friends/FriendsSimConnector.cs b/OpenSim/Services/Connectors/Friends/FriendsSimConnector.cs index d7cb015..0a7b277 100644 --- a/OpenSim/Services/Connectors/Friends/FriendsSimConnector.cs +++ b/OpenSim/Services/Connectors/Friends/FriendsSimConnector.cs @@ -74,6 +74,9 @@ namespace OpenSim.Services.Connectors.Friends public bool FriendshipDenied(GridRegion region, UUID userID, string userName, UUID friendID) { + if (region == null) + return false; + Dictionary sendData = new Dictionary(); //sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString(); //sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString(); @@ -131,7 +134,11 @@ namespace OpenSim.Services.Connectors.Friends private bool Call(GridRegion region, Dictionary sendData) { string reqString = ServerUtils.BuildQueryString(sendData); - // m_log.DebugFormat("[FRIENDS CONNECTOR]: queryString = {0}", reqString); + //m_log.DebugFormat("[FRIENDS CONNECTOR]: queryString = {0}", reqString); + if (region == null) + return false; + + m_log.DebugFormat("[FRIENDS CONNECTOR]: region: {0}", region.ExternalHostName + ":" + region.HttpPort); try { string url = "http://" + region.ExternalHostName + ":" + region.HttpPort; diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs index 6319cc4..00fffff 100644 --- a/OpenSim/Services/LLLoginService/LLLoginService.cs +++ b/OpenSim/Services/LLLoginService/LLLoginService.cs @@ -209,6 +209,8 @@ namespace OpenSim.Services.LLLoginService bool success = false; UUID session = UUID.Random(); + m_log.InfoFormat("[LLOGIN SERVICE]: Login request for {0} {1} from {2} with user agent {3} starting in {4}", + firstName, lastName, clientIP.Address.ToString(), clientVersion, startLocation); try { // diff --git a/OpenSim/Services/PresenceService/PresenceService.cs b/OpenSim/Services/PresenceService/PresenceService.cs index 601a69f..976153f 100644 --- a/OpenSim/Services/PresenceService/PresenceService.cs +++ b/OpenSim/Services/PresenceService/PresenceService.cs @@ -55,7 +55,7 @@ namespace OpenSim.Services.PresenceService UUID secureSessionID) { //PresenceData[] d = m_Database.Get("UserID", userID); - m_Database.Get("UserID", userID); + //m_Database.Get("UserID", userID); PresenceData data = new PresenceData(); -- cgit v1.1 From 75878c8f43251477b3b10942b689d69c1e803056 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 4 Jun 2010 20:43:05 +0100 Subject: get TestSaveIarV0_1() working again by setting up an OpenSim.Data.Null.UserAuthenticationData plugin additional tweaks to get this working properly --- OpenSim/Data/Null/NullAuthenticationData.cs | 3 +-- OpenSim/Data/Null/NullUserAccountData.cs | 2 +- .../Avatar/Inventory/Archiver/InventoryArchiverModule.cs | 4 +++- .../Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs | 4 ++-- .../Services/AuthenticationService/AuthenticationServiceBase.cs | 2 +- .../AuthenticationService/PasswordAuthenticationService.cs | 2 +- OpenSim/Services/UserAccountService/UserAccountService.cs | 8 ++++++++ OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs | 2 +- OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs | 5 ++++- 9 files changed, 22 insertions(+), 10 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Data/Null/NullAuthenticationData.cs b/OpenSim/Data/Null/NullAuthenticationData.cs index 3fb3105..620deb9 100644 --- a/OpenSim/Data/Null/NullAuthenticationData.cs +++ b/OpenSim/Data/Null/NullAuthenticationData.cs @@ -76,6 +76,5 @@ namespace OpenSim.Data.Null return false; } - } -} +} \ No newline at end of file diff --git a/OpenSim/Data/Null/NullUserAccountData.cs b/OpenSim/Data/Null/NullUserAccountData.cs index 9eb94e6..ede23fb 100644 --- a/OpenSim/Data/Null/NullUserAccountData.cs +++ b/OpenSim/Data/Null/NullUserAccountData.cs @@ -88,7 +88,7 @@ namespace OpenSim.Data.Null m_DataByUUID[data.PrincipalID] = data; m_DataByName[data.FirstName + " " + data.LastName] = data; - if (data.Data.ContainsKey("Email") && data.Data["Email"] != string.Empty) + if (data.Data.ContainsKey("Email") && data.Data["Email"] != null && data.Data["Email"] != string.Empty) m_DataByEmail[data.Data["Email"]] = data; return true; diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs index 307db97..ab5f485 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs @@ -390,7 +390,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver /// protected UserAccount GetUserInfo(string firstName, string lastName, string pass) { - UserAccount account = m_aScene.UserAccountService.GetUserAccount(m_aScene.RegionInfo.ScopeID, firstName, lastName); + UserAccount account + = m_aScene.UserAccountService.GetUserAccount(m_aScene.RegionInfo.ScopeID, firstName, lastName); + if (null == account) { m_log.ErrorFormat( diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index c81f295..a3b3e2d 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs @@ -76,7 +76,7 @@ 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] + [Test] public void TestSaveIarV0_1() { TestHelper.InMethod(); @@ -84,7 +84,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); - Scene scene = SceneSetupHelpers.SetupScene("Inventory"); + Scene scene = SceneSetupHelpers.SetupScene("Inventory, useraccounts"); SceneSetupHelpers.SetupSceneModules(scene, archiverModule); // Create user diff --git a/OpenSim/Services/AuthenticationService/AuthenticationServiceBase.cs b/OpenSim/Services/AuthenticationService/AuthenticationServiceBase.cs index 9af61a9..edc1097 100644 --- a/OpenSim/Services/AuthenticationService/AuthenticationServiceBase.cs +++ b/OpenSim/Services/AuthenticationService/AuthenticationServiceBase.cs @@ -88,7 +88,7 @@ namespace OpenSim.Services.AuthenticationService m_Database = LoadPlugin(dllName, new Object[] {connString, realm}); if (m_Database == null) - throw new Exception("Could not find a storage interface in the given module"); + throw new Exception(string.Format("Could not find a storage interface in module {0}", dllName)); } public bool Verify(UUID principalID, string token, int lifetime) diff --git a/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs b/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs index 2fc9248..17619ff 100644 --- a/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs +++ b/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs @@ -71,7 +71,7 @@ namespace OpenSim.Services.AuthenticationService string hashed = Util.Md5Hash(password + ":" + data.Data["passwordSalt"].ToString()); - //m_log.DebugFormat("[PASS AUTH]: got {0}; hashed = {1}; stored = {2}", password, hashed, data.Data["passwordHash"].ToString()); + m_log.DebugFormat("[PASS AUTH]: got {0}; hashed = {1}; stored = {2}", password, hashed, data.Data["passwordHash"].ToString()); if (data.Data["passwordHash"].ToString() == hashed) { diff --git a/OpenSim/Services/UserAccountService/UserAccountService.cs b/OpenSim/Services/UserAccountService/UserAccountService.cs index eb588f0..063251a 100644 --- a/OpenSim/Services/UserAccountService/UserAccountService.cs +++ b/OpenSim/Services/UserAccountService/UserAccountService.cs @@ -97,6 +97,10 @@ namespace OpenSim.Services.UserAccountService public UserAccount GetUserAccount(UUID scopeID, string firstName, string lastName) { +// m_log.DebugFormat( +// "[USER ACCOUNT SERVICE]: Retrieving account by username for {0} {1}, scope {2}", +// firstName, lastName, scopeID); + UserAccountData[] d; if (scopeID != UUID.Zero) @@ -231,6 +235,10 @@ namespace OpenSim.Services.UserAccountService public bool StoreUserAccount(UserAccount data) { +// m_log.DebugFormat( +// "[USER ACCOUNT SERVICE]: Storing user account for {0} {1} {2}, scope {3}", +// data.FirstName, data.LastName, data.PrincipalID, data.ScopeID); + UserAccountData d = new UserAccountData(); d.FirstName = data.FirstName; diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs index 2756324..27d1a69 100644 --- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs +++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs @@ -260,7 +260,7 @@ namespace OpenSim.Tests.Common.Setup "LocalServiceModule", "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService"); else config.Configs["AuthenticationService"].Set( - "LocalServiceModule", "OpenSim.Tests.Common.dll:MockuthenticationService"); + "LocalServiceModule", "OpenSim.Tests.Common.dll:MockAuthenticationService"); config.Configs["AuthenticationService"].Set("StorageProvider", "OpenSim.Data.Null.dll"); service.Initialise(config); service.AddRegion(testScene); diff --git a/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs b/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs index e6a7818..380f258 100644 --- a/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs +++ b/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs @@ -25,6 +25,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +using System.Collections.Generic; using OpenMetaverse; using OpenSim.Framework.Communications; using OpenSim.Region.Framework.Scenes; @@ -124,7 +125,9 @@ namespace OpenSim.Tests.Common.Setup public static UserAccount CreateUserWithInventory( Scene scene, string firstName, string lastName, UUID userId, string pw) { - UserAccount ua = new UserAccount(userId) { FirstName = firstName, LastName = lastName }; + UserAccount ua + = new UserAccount(userId) + { FirstName = firstName, LastName = lastName, ServiceURLs = new Dictionary() }; scene.UserAccountService.StoreUserAccount(ua); scene.InventoryService.CreateUserInventory(ua.PrincipalID); scene.AuthenticationService.SetPassword(ua.PrincipalID, pw); -- cgit v1.1 From df2bcf7b6b0f558078cab12e48904b8b61766c58 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 4 Jun 2010 20:56:24 +0100 Subject: remove pointless mock user account service since the real one can now be easily configured for test purposes --- .../Archiver/Tests/InventoryArchiverTests.cs | 2 +- .../World/Archiver/Tests/ArchiverTests.cs | 2 +- .../Tests/Common/Mock/MockUserAccountService.cs | 46 ---------------------- OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs | 19 +++------ 4 files changed, 8 insertions(+), 61 deletions(-) delete mode 100644 OpenSim/Tests/Common/Mock/MockUserAccountService.cs (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index a3b3e2d..5b91e0d 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs @@ -84,7 +84,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); - Scene scene = SceneSetupHelpers.SetupScene("Inventory, useraccounts"); + Scene scene = SceneSetupHelpers.SetupScene("Inventory"); SceneSetupHelpers.SetupSceneModules(scene, archiverModule); // Create user diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs index 4d04af1..58698ee 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs @@ -69,7 +69,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests SerialiserModule serialiserModule = new SerialiserModule(); TerrainModule terrainModule = new TerrainModule(); - m_scene = SceneSetupHelpers.SetupScene("useraccounts"); + m_scene = SceneSetupHelpers.SetupScene(); SceneSetupHelpers.SetupSceneModules(m_scene, m_archiverModule, serialiserModule, terrainModule); } diff --git a/OpenSim/Tests/Common/Mock/MockUserAccountService.cs b/OpenSim/Tests/Common/Mock/MockUserAccountService.cs deleted file mode 100644 index 0769c7a..0000000 --- a/OpenSim/Tests/Common/Mock/MockUserAccountService.cs +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System.Collections.Generic; -using Nini.Config; -using OpenMetaverse; -using OpenSim.Services.Interfaces; - -namespace OpenSim.Tests.Common.Mock -{ - public class MockUserAccountService : IUserAccountService - { - - public MockUserAccountService(IConfigSource config) {} - - public UserAccount GetUserAccount(UUID scopeID, UUID userID) { return new UserAccount(); } - public UserAccount GetUserAccount(UUID scopeID, string FirstName, string LastName) { return new UserAccount(); } - public UserAccount GetUserAccount(UUID scopeID, string Email) { return new UserAccount(); } - public List GetUserAccounts(UUID scopeID, string query) { return new List(); } - public bool StoreUserAccount(UserAccount data) { return true; } - } -} \ No newline at end of file diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs index 27d1a69..4a356e2 100644 --- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs +++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs @@ -191,7 +191,7 @@ namespace OpenSim.Tests.Common.Setup if (realServices.Contains("grid")) StartGridService(testScene, true); - StartUserAccountService(testScene, realServices.Contains("useraccounts")); + StartUserAccountService(testScene); } // If not, make sure the shared module gets references to this new scene else @@ -311,24 +311,18 @@ namespace OpenSim.Tests.Common.Setup } /// - /// Start a user account service, whether real or mock + /// Start a user account service /// /// - /// Starts a real service if true, a mock service if not - private static void StartUserAccountService(Scene testScene, bool real) + private static void StartUserAccountService(Scene testScene) { IConfigSource config = new IniConfigSource(); config.AddConfig("Modules"); config.AddConfig("UserAccountService"); config.Configs["Modules"].Set("UserAccountServices", "LocalUserAccountServicesConnector"); config.Configs["UserAccountService"].Set("StorageProvider", "OpenSim.Data.Null.dll"); - - if (real) - config.Configs["UserAccountService"].Set( - "LocalServiceModule", "OpenSim.Services.UserAccountService.dll:UserAccountService"); - else - config.Configs["UserAccountService"].Set( - "LocalServiceModule", "OpenSim.Tests.Common.dll:MockUserAccountService"); + config.Configs["UserAccountService"].Set( + "LocalServiceModule", "OpenSim.Services.UserAccountService.dll:UserAccountService"); if (m_userAccountService == null) { @@ -336,8 +330,7 @@ namespace OpenSim.Tests.Common.Setup userAccountService.Initialise(config); m_userAccountService = userAccountService; } - //else - // config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Tests.Common.dll:TestGridService"); + m_userAccountService.AddRegion(testScene); m_userAccountService.RegionLoaded(testScene); testScene.AddRegionModule(m_userAccountService.Name, m_userAccountService); -- cgit v1.1 From f523c2033d9591c1e96ad9ebb463236242d3c067 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 4 Jun 2010 21:11:13 +0100 Subject: bring test TestLoadIarV0_1ExistingUsers() back online --- .../Archiver/Tests/InventoryArchiverTests.cs | 157 ++++++++++----------- 1 file changed, 76 insertions(+), 81 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index 5b91e0d..d5fc666 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs @@ -80,7 +80,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests public void TestSaveIarV0_1() { TestHelper.InMethod(); - log4net.Config.XmlConfigurator.Configure(); +// log4net.Config.XmlConfigurator.Configure(); InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); @@ -195,99 +195,94 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests /// /// /// This test also does some deeper probing of loading into nested inventory structures - /// REFACTORING PROBLEM. This needs to be rewritten. -// [Test] -// public void TestLoadIarV0_1ExistingUsers() -// { -// TestHelper.InMethod(); + [Test] + public void TestLoadIarV0_1ExistingUsers() + { + TestHelper.InMethod(); -// //log4net.Config.XmlConfigurator.Configure(); + //log4net.Config.XmlConfigurator.Configure(); -// string userFirstName = "Mr"; -// string userLastName = "Tiddles"; -// UUID userUuid = UUID.Parse("00000000-0000-0000-0000-000000000555"); -// string userItemCreatorFirstName = "Lord"; -// string userItemCreatorLastName = "Lucan"; -// UUID userItemCreatorUuid = UUID.Parse("00000000-0000-0000-0000-000000000666"); + string userFirstName = "Mr"; + string userLastName = "Tiddles"; + UUID userUuid = UUID.Parse("00000000-0000-0000-0000-000000000555"); + string userItemCreatorFirstName = "Lord"; + string userItemCreatorLastName = "Lucan"; + UUID userItemCreatorUuid = UUID.Parse("00000000-0000-0000-0000-000000000666"); -// string item1Name = "b.lsl"; -// string archiveItemName = InventoryArchiveWriteRequest.CreateArchiveItemName(item1Name, UUID.Random()); - -// MemoryStream archiveWriteStream = new MemoryStream(); -// TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream); + string item1Name = "b.lsl"; + string archiveItemName = InventoryArchiveWriteRequest.CreateArchiveItemName(item1Name, UUID.Random()); -// InventoryItemBase item1 = new InventoryItemBase(); -// item1.Name = item1Name; -// item1.AssetID = UUID.Random(); -// item1.GroupID = UUID.Random(); -// item1.CreatorId = OspResolver.MakeOspa(userItemCreatorFirstName, userItemCreatorLastName); -// //item1.CreatorId = userUuid.ToString(); -// //item1.CreatorId = "00000000-0000-0000-0000-000000000444"; -// item1.Owner = UUID.Zero; - -// string item1FileName -// = string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName); -// tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1)); -// tar.Close(); + MemoryStream archiveWriteStream = new MemoryStream(); + TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream); -// MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray()); -// SerialiserModule serialiserModule = new SerialiserModule(); -// InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); + InventoryItemBase item1 = new InventoryItemBase(); + item1.Name = item1Name; + item1.AssetID = UUID.Random(); + item1.GroupID = UUID.Random(); + item1.CreatorId = OspResolver.MakeOspa(userItemCreatorFirstName, userItemCreatorLastName); + //item1.CreatorId = userUuid.ToString(); + //item1.CreatorId = "00000000-0000-0000-0000-000000000444"; + item1.Owner = UUID.Zero; + + string item1FileName + = string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName); + tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1)); + tar.Close(); + + MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray()); + SerialiserModule serialiserModule = new SerialiserModule(); + InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); -// // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene -// Scene scene = SceneSetupHelpers.SetupScene("inventory"); -// IUserAdminService userAdminService = scene.CommsManager.UserAdminService; + // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene + Scene scene = SceneSetupHelpers.SetupScene("inventory"); -// SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); -// userAdminService.AddUser( -// userFirstName, userLastName, "meowfood", String.Empty, 1000, 1000, userUuid); -// userAdminService.AddUser( -// userItemCreatorFirstName, userItemCreatorLastName, "hampshire", -// String.Empty, 1000, 1000, userItemCreatorUuid); + SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); + + UserProfileTestUtils.CreateUserWithInventory( + scene, userFirstName, userLastName, userUuid, "meowfood"); + UserProfileTestUtils.CreateUserWithInventory( + scene, userItemCreatorFirstName, userItemCreatorLastName, userItemCreatorUuid, "hampshire"); -// archiverModule.DearchiveInventory(userFirstName, userLastName, "/", "meowfood", archiveReadStream); - -// CachedUserInfo userInfo -// = scene.CommsManager.UserProfileCacheService.GetUserDetails(userFirstName, userLastName); + archiverModule.DearchiveInventory(userFirstName, userLastName, "/", "meowfood", archiveReadStream); -// InventoryItemBase foundItem1 -// = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userInfo.UserProfile.ID, item1Name); + InventoryItemBase foundItem1 + = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userUuid, item1Name); -// Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1"); + Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1"); -//// We have to disable this check since loaded items that did find users via OSPA resolution are now only storing the -//// UUID, not the OSPA itself. -//// Assert.That( -//// foundItem1.CreatorId, Is.EqualTo(item1.CreatorId), -//// "Loaded item non-uuid creator doesn't match original"); +// We have to disable this check since loaded items that did find users via OSPA resolution are now only storing the +// UUID, not the OSPA itself. // Assert.That( -// foundItem1.CreatorId, Is.EqualTo(userItemCreatorUuid.ToString()), +// foundItem1.CreatorId, Is.EqualTo(item1.CreatorId), // "Loaded item non-uuid creator doesn't match original"); - -// Assert.That( -// foundItem1.CreatorIdAsUuid, Is.EqualTo(userItemCreatorUuid), -// "Loaded item uuid creator doesn't match original"); -// Assert.That(foundItem1.Owner, Is.EqualTo(userUuid), -// "Loaded item owner doesn't match inventory reciever"); - -// // Now try loading to a root child folder -// UserInventoryTestUtils.CreateInventoryFolder(scene.InventoryService, userInfo.UserProfile.ID, "xA"); -// archiveReadStream = new MemoryStream(archiveReadStream.ToArray()); -// archiverModule.DearchiveInventory(userFirstName, userLastName, "xA", "meowfood", archiveReadStream); - -// InventoryItemBase foundItem2 -// = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userInfo.UserProfile.ID, "xA/" + item1Name); -// Assert.That(foundItem2, Is.Not.Null, "Didn't find loaded item 2"); - -// // Now try loading to a more deeply nested folder -// UserInventoryTestUtils.CreateInventoryFolder(scene.InventoryService, userInfo.UserProfile.ID, "xB/xC"); -// archiveReadStream = new MemoryStream(archiveReadStream.ToArray()); -// archiverModule.DearchiveInventory(userFirstName, userLastName, "xB/xC", "meowfood", archiveReadStream); - -// InventoryItemBase foundItem3 -// = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userInfo.UserProfile.ID, "xB/xC/" + item1Name); -// Assert.That(foundItem3, Is.Not.Null, "Didn't find loaded item 3"); - //} + Assert.That( + foundItem1.CreatorId, Is.EqualTo(userItemCreatorUuid.ToString()), + "Loaded item non-uuid creator doesn't match original"); + + Assert.That( + foundItem1.CreatorIdAsUuid, Is.EqualTo(userItemCreatorUuid), + "Loaded item uuid creator doesn't match original"); + Assert.That(foundItem1.Owner, Is.EqualTo(userUuid), + "Loaded item owner doesn't match inventory reciever"); + + // Now try loading to a root child folder + UserInventoryTestUtils.CreateInventoryFolder(scene.InventoryService, userUuid, "xA"); + archiveReadStream = new MemoryStream(archiveReadStream.ToArray()); + archiverModule.DearchiveInventory(userFirstName, userLastName, "xA", "meowfood", archiveReadStream); + + InventoryItemBase foundItem2 + = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userUuid, "xA/" + item1Name); + Assert.That(foundItem2, Is.Not.Null, "Didn't find loaded item 2"); + + // Now try loading to a more deeply nested folder + UserInventoryTestUtils.CreateInventoryFolder(scene.InventoryService, userUuid, "xB/xC"); + archiveReadStream = new MemoryStream(archiveReadStream.ToArray()); + archiverModule.DearchiveInventory(userFirstName, userLastName, "xB/xC", "meowfood", archiveReadStream); + + InventoryItemBase foundItem3 + = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userUuid, "xB/xC/" + item1Name); + Assert.That(foundItem3, Is.Not.Null, "Didn't find loaded item 3"); + } // REFACTORING PROBLEM. Needs rewrite. // [Test] -- cgit v1.1 From a08ace300ba1f81a524b209fe8fc5b3f4acfd28c Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 4 Jun 2010 21:15:25 +0100 Subject: bring TestIarV0_1WithEscapedChars() back online --- .../Archiver/Tests/InventoryArchiverTests.cs | 161 +++++++++------------ 1 file changed, 72 insertions(+), 89 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index d5fc666..3c4bc7b 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs @@ -55,14 +55,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests { protected ManualResetEvent mre = new ManualResetEvent(false); - private void InventoryReceived(UUID userId) - { - lock (this) - { - Monitor.PulseAll(this); - } - } - private void SaveCompleted( Guid id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream, Exception reportedException) @@ -198,8 +190,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests [Test] public void TestLoadIarV0_1ExistingUsers() { - TestHelper.InMethod(); - + TestHelper.InMethod(); //log4net.Config.XmlConfigurator.Configure(); string userFirstName = "Mr"; @@ -284,95 +275,87 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests Assert.That(foundItem3, Is.Not.Null, "Didn't find loaded item 3"); } - // REFACTORING PROBLEM. Needs rewrite. -// [Test] -// public void TestIarV0_1WithEscapedChars() -// { -// TestHelper.InMethod(); -//// log4net.Config.XmlConfigurator.Configure(); + [Test] + public void TestIarV0_1WithEscapedChars() + { + TestHelper.InMethod(); +// log4net.Config.XmlConfigurator.Configure(); -// string itemName = "You & you are a mean/man/"; -// string humanEscapedItemName = @"You & you are a mean\/man\/"; -// string userPassword = "meowfood"; + string itemName = "You & you are a mean/man/"; + string humanEscapedItemName = @"You & you are a mean\/man\/"; + string userPassword = "meowfood"; -// InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); + InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); -// Scene scene = SceneSetupHelpers.SetupScene("Inventory"); -// SceneSetupHelpers.SetupSceneModules(scene, archiverModule); -// CommunicationsManager cm = scene.CommsManager; - -// // Create user -// string userFirstName = "Jock"; -// string userLastName = "Stirrup"; -// UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020"); - -// lock (this) -// { -// UserProfileTestUtils.CreateUserWithInventory( -// cm, userFirstName, userLastName, userPassword, userId, InventoryReceived); -// Monitor.Wait(this, 60000); -// } - -// // Create asset -// SceneObjectGroup object1; -// SceneObjectPart part1; -// { -// string partName = "part name"; -// 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 -// = new SceneObjectPart( -// ownerId, shape, groupPosition, rotationOffset, offsetPosition); -// part1.Name = partName; - -// object1 = new SceneObjectGroup(part1); -// scene.AddNewSceneObject(object1, false); -// } - -// UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060"); -// AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1); -// scene.AssetService.Store(asset1); - -// // Create item -// UUID item1Id = UUID.Parse("00000000-0000-0000-0000-000000000080"); -// InventoryItemBase item1 = new InventoryItemBase(); -// item1.Name = itemName; -// item1.AssetID = asset1.FullID; -// item1.ID = item1Id; -// InventoryFolderBase objsFolder -// = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects"); -// item1.Folder = objsFolder.ID; -// scene.AddInventoryItem(userId, item1); + Scene scene = SceneSetupHelpers.SetupScene("Inventory"); + SceneSetupHelpers.SetupSceneModules(scene, archiverModule); -// MemoryStream archiveWriteStream = new MemoryStream(); -// archiverModule.OnInventoryArchiveSaved += SaveCompleted; + // Create user + string userFirstName = "Jock"; + string userLastName = "Stirrup"; + UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020"); + UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userId, "meowfood"); + + // Create asset + SceneObjectGroup object1; + SceneObjectPart part1; + { + string partName = "part name"; + 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); -// mre.Reset(); -// archiverModule.ArchiveInventory( -// Guid.NewGuid(), userFirstName, userLastName, "Objects", userPassword, archiveWriteStream); -// mre.WaitOne(60000, false); + part1 + = new SceneObjectPart( + ownerId, shape, groupPosition, rotationOffset, offsetPosition); + part1.Name = partName; -// // LOAD ITEM -// MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray()); + object1 = new SceneObjectGroup(part1); + scene.AddNewSceneObject(object1, false); + } + + UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060"); + AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1); + scene.AssetService.Store(asset1); + + // Create item + UUID item1Id = UUID.Parse("00000000-0000-0000-0000-000000000080"); + InventoryItemBase item1 = new InventoryItemBase(); + item1.Name = itemName; + 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(); + archiverModule.OnInventoryArchiveSaved += SaveCompleted; + + mre.Reset(); + archiverModule.ArchiveInventory( + Guid.NewGuid(), userFirstName, userLastName, "Objects", userPassword, archiveWriteStream); + mre.WaitOne(60000, false); + + // LOAD ITEM + MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray()); -// archiverModule.DearchiveInventory(userFirstName, userLastName, "Scripts", userPassword, archiveReadStream); + archiverModule.DearchiveInventory(userFirstName, userLastName, "Scripts", userPassword, archiveReadStream); -// InventoryItemBase foundItem1 -// = InventoryArchiveUtils.FindItemByPath( -// scene.InventoryService, userId, "Scripts/Objects/" + humanEscapedItemName); + InventoryItemBase foundItem1 + = InventoryArchiveUtils.FindItemByPath( + scene.InventoryService, userId, "Scripts/Objects/" + humanEscapedItemName); -// Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1"); -//// Assert.That( -//// foundItem1.CreatorId, Is.EqualTo(userUuid), -//// "Loaded item non-uuid creator doesn't match that of the loading user"); + Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1"); // Assert.That( -// foundItem1.Name, Is.EqualTo(itemName), -// "Loaded item name doesn't match saved name"); -// } +// foundItem1.CreatorId, Is.EqualTo(userUuid), +// "Loaded item non-uuid creator doesn't match that of the loading user"); + Assert.That( + foundItem1.Name, Is.EqualTo(itemName), + "Loaded item name doesn't match saved name"); + } /// /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where -- cgit v1.1 From 0526d3a535519c244baa865b26f48953552d3e53 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 4 Jun 2010 21:19:37 +0100 Subject: bring TestLoadIarV0_1AbsentUsers() back online --- .../Archiver/Tests/InventoryArchiverTests.cs | 119 ++++++++++----------- 1 file changed, 56 insertions(+), 63 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index 3c4bc7b..507662f 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs @@ -364,76 +364,69 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests /// /// This may possibly one day get overtaken by the as yet incomplete temporary profiles feature /// (as tested in the a later commented out test) - /// REFACTORING PROBLEM. Needs rewrite. -// [Test] -// public void TestLoadIarV0_1AbsentUsers() -// { -// TestHelper.InMethod(); - -// //log4net.Config.XmlConfigurator.Configure(); - -// string userFirstName = "Charlie"; -// string userLastName = "Chan"; -// UUID userUuid = UUID.Parse("00000000-0000-0000-0000-000000000999"); -// string userItemCreatorFirstName = "Bat"; -// string userItemCreatorLastName = "Man"; -// //UUID userItemCreatorUuid = UUID.Parse("00000000-0000-0000-0000-000000008888"); - -// string itemName = "b.lsl"; -// string archiveItemName = InventoryArchiveWriteRequest.CreateArchiveItemName(itemName, UUID.Random()); - -// MemoryStream archiveWriteStream = new MemoryStream(); -// TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream); - -// InventoryItemBase item1 = new InventoryItemBase(); -// item1.Name = itemName; -// item1.AssetID = UUID.Random(); -// item1.GroupID = UUID.Random(); -// item1.CreatorId = OspResolver.MakeOspa(userItemCreatorFirstName, userItemCreatorLastName); -// //item1.CreatorId = userUuid.ToString(); -// //item1.CreatorId = "00000000-0000-0000-0000-000000000444"; -// item1.Owner = UUID.Zero; - -// string item1FileName -// = string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName); -// tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1)); -// tar.Close(); - -// MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray()); -// SerialiserModule serialiserModule = new SerialiserModule(); -// InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); - -// // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene -// Scene scene = SceneSetupHelpers.SetupScene("inventory"); -// IUserAdminService userAdminService = scene.CommsManager.UserAdminService; - -// SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); -// userAdminService.AddUser( -// userFirstName, userLastName, "meowfood", String.Empty, 1000, 1000, userUuid); - -// archiverModule.DearchiveInventory(userFirstName, userLastName, "/", "meowfood", archiveReadStream); - -// CachedUserInfo userInfo -// = scene.CommsManager.UserProfileCacheService.GetUserDetails(userFirstName, userLastName); - -// InventoryItemBase foundItem1 -// = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userInfo.UserProfile.ID, itemName); - -// Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1"); -//// Assert.That( -//// foundItem1.CreatorId, Is.EqualTo(userUuid), -//// "Loaded item non-uuid creator doesn't match that of the loading user"); + /// This test is currently disabled + [Test] + public void TestLoadIarV0_1AbsentUsers() + { + TestHelper.InMethod(); + //log4net.Config.XmlConfigurator.Configure(); + + string userFirstName = "Charlie"; + string userLastName = "Chan"; + UUID userUuid = UUID.Parse("00000000-0000-0000-0000-000000000999"); + string userItemCreatorFirstName = "Bat"; + string userItemCreatorLastName = "Man"; + //UUID userItemCreatorUuid = UUID.Parse("00000000-0000-0000-0000-000000008888"); + + string itemName = "b.lsl"; + string archiveItemName = InventoryArchiveWriteRequest.CreateArchiveItemName(itemName, UUID.Random()); + + MemoryStream archiveWriteStream = new MemoryStream(); + TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream); + + InventoryItemBase item1 = new InventoryItemBase(); + item1.Name = itemName; + item1.AssetID = UUID.Random(); + item1.GroupID = UUID.Random(); + item1.CreatorId = OspResolver.MakeOspa(userItemCreatorFirstName, userItemCreatorLastName); + //item1.CreatorId = userUuid.ToString(); + //item1.CreatorId = "00000000-0000-0000-0000-000000000444"; + item1.Owner = UUID.Zero; + + string item1FileName + = string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName); + tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1)); + tar.Close(); + + MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray()); + SerialiserModule serialiserModule = new SerialiserModule(); + InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); + + // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene + Scene scene = SceneSetupHelpers.SetupScene("inventory"); + + SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); + UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userUuid, "meowfood"); + + archiverModule.DearchiveInventory(userFirstName, userLastName, "/", "meowfood", archiveReadStream); + + InventoryItemBase foundItem1 + = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userUuid, itemName); + + Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1"); // Assert.That( -// foundItem1.CreatorIdAsUuid, Is.EqualTo(userUuid), -// "Loaded item uuid creator doesn't match that of the loading user"); -// } +// foundItem1.CreatorId, Is.EqualTo(userUuid), +// "Loaded item non-uuid creator doesn't match that of the loading user"); + Assert.That( + foundItem1.CreatorIdAsUuid, Is.EqualTo(userUuid), + "Loaded item uuid creator doesn't match that of the loading user"); + } /// /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where /// no account exists with the creator name /// /// Disabled since temporary profiles have not yet been implemented. - /// REFACTORING PROBLEM. Needs rewrite. /// //[Test] //public void TestLoadIarV0_1TempProfiles() -- cgit v1.1