From e39fc95659a405a8500c9014d2ac31c5d85741d7 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 5 Mar 2010 00:54:46 +0000 Subject: [PATCH] Fix LocalPresenceServiceConnector test now that the hardcoded test data has been removed from Data.Null.NullPresenceData Unfortunately, this meant publicly exposing the underlying service for the connector. The other solution would be to create alternative initializers for services and connectors where objects could be given directly rather than loaded indirectly through config. Unfortunately, this would require a lot of work in this case but might be the better way forward. --- OpenSim/Data/Null/NullPresenceData.cs | 9 --------- OpenSim/Framework/SLUtil.cs | 12 +++++++++++- OpenSim/Region/Application/ConfigurationLoader.cs | 14 ++------------ .../Presence/LocalPresenceServiceConnector.cs | 6 +++++- .../Presence/Tests/PresenceConnectorsTests.cs | 13 +++++++++++++ .../Shared/Api/Implementation/LSL_Api.cs | 1 - 6 files changed, 31 insertions(+), 24 deletions(-) diff --git a/OpenSim/Data/Null/NullPresenceData.cs b/OpenSim/Data/Null/NullPresenceData.cs index 2ceb0c66a4..9fc45958eb 100644 --- a/OpenSim/Data/Null/NullPresenceData.cs +++ b/OpenSim/Data/Null/NullPresenceData.cs @@ -51,15 +51,6 @@ namespace OpenSim.Data.Null Instance = this; //Console.WriteLine("[XXX] NullRegionData constructor"); - // Let's stick in a test presence - /* - PresenceData p = new PresenceData(); - p.SessionID = UUID.Zero; - p.UserID = UUID.Zero.ToString(); - p.Data = new Dictionary(); - p.Data["Online"] = true.ToString(); - m_presenceData.Add(UUID.Zero, p); - */ } } diff --git a/OpenSim/Framework/SLUtil.cs b/OpenSim/Framework/SLUtil.cs index ff5f8b9556..81d82bee5e 100644 --- a/OpenSim/Framework/SLUtil.cs +++ b/OpenSim/Framework/SLUtil.cs @@ -1,11 +1,15 @@ using System; using System.Collections.Generic; +using System.Reflection; +using log4net; using OpenMetaverse; namespace OpenSim.Framework { public static class SLUtil { +// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + #region SL / file extension / content-type conversions public static string SLAssetTypeToContentType(int assetType) @@ -190,7 +194,12 @@ namespace OpenSim.Framework /// public static string ParseNotecardToString(string rawInput) { - return string.Join("\n", ParseNotecardToList(rawInput).ToArray()); + string[] output = ParseNotecardToList(rawInput).ToArray(); + +// foreach (string line in output) +// m_log.DebugFormat("[PARSE NOTECARD]: ParseNotecardToString got line {0}", line); + + return string.Join("\n", output); } /// @@ -254,6 +263,7 @@ namespace OpenSim.Framework if (ln.Length > need) ln = ln.Substring(0, need); +// m_log.DebugFormat("[PARSE NOTECARD]: Adding line {0}", ln); output.Add(ln); count += ln.Length + 1; idx++; diff --git a/OpenSim/Region/Application/ConfigurationLoader.cs b/OpenSim/Region/Application/ConfigurationLoader.cs index 8f19417018..4ca6595501 100644 --- a/OpenSim/Region/Application/ConfigurationLoader.cs +++ b/OpenSim/Region/Application/ConfigurationLoader.cs @@ -42,6 +42,8 @@ namespace OpenSim /// public class ConfigurationLoader { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + /// /// Various Config settings the region needs to start /// Physics Engine, Mesh Engine, GridMode, PhysicsPrim allowed, Neighbor, @@ -60,17 +62,6 @@ namespace OpenSim /// protected NetworkServersInfo m_networkServersInfo; - /// - /// Console logger - /// - private static readonly ILog m_log = - LogManager.GetLogger( - MethodBase.GetCurrentMethod().DeclaringType); - - public ConfigurationLoader() - { - } - /// /// Loads the region configuration /// @@ -188,7 +179,6 @@ namespace OpenSim } // Make sure command line options take precedence - // m_config.Source.Merge(argvSource); ReadConfigSettings(); diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/LocalPresenceServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/LocalPresenceServiceConnector.cs index d78daf9be4..c402a3face 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/LocalPresenceServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/LocalPresenceServiceConnector.cs @@ -47,7 +47,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence private bool m_Enabled = false; private PresenceDetector m_PresenceDetector; - private IPresenceService m_PresenceService; + + /// + /// Underlying presence service. Do not use directly. + /// + public IPresenceService m_PresenceService; public LocalPresenceServicesConnector() { diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/Tests/PresenceConnectorsTests.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/Tests/PresenceConnectorsTests.cs index ca424615a0..292ff8ea87 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/Tests/PresenceConnectorsTests.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/Tests/PresenceConnectorsTests.cs @@ -59,6 +59,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence.Tests config.Configs["PresenceService"].Set("StorageProvider", "OpenSim.Data.Null.dll"); m_LocalConnector = new LocalPresenceServicesConnector(config); + + // Let's stick in a test presence + m_LocalConnector.m_PresenceService.LoginAgent(UUID.Zero.ToString(), UUID.Zero, UUID.Zero); } /// @@ -68,6 +71,16 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence.Tests public void TestPresenceV0_1() { SetUp(); + + // Let's stick in a test presence + /* + PresenceData p = new PresenceData(); + p.SessionID = UUID.Zero; + p.UserID = UUID.Zero.ToString(); + p.Data = new Dictionary(); + p.Data["Online"] = true.ToString(); + m_presenceData.Add(UUID.Zero, p); + */ string user1 = UUID.Zero.ToString(); UUID session1 = UUID.Zero; diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 974f91b9a1..0134b03180 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -52,7 +52,6 @@ using OpenSim.Region.ScriptEngine.Shared.ScriptBase; using OpenSim.Region.ScriptEngine.Interfaces; using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces; using OpenSim.Services.Interfaces; -using OpenSim.Services.Interfaces; using GridRegion = OpenSim.Services.Interfaces.GridRegion; using PresenceInfo = OpenSim.Services.Interfaces.PresenceInfo; using PrimType = OpenSim.Region.Framework.Scenes.PrimType;