From 7c6c776ff783b30dfc26a065e63c267e46edc53b Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Thu, 27 Nov 2008 19:28:04 +0000 Subject: * test: Add the ability to add a plugin directory to the user and inventory services in order to extend unit tests for user and inventory information * I can't spend any longer in trying to get Mono.Addins to work with the unit tests, so this is not a proper plugin at this time --- .../Communications/CommunicationsManager.cs | 1 - .../Communications/InventoryServiceBase.cs | 19 +++++++++---- .../Framework/Communications/UserManagerBase.cs | 32 ++++++++++++++++++---- 3 files changed, 40 insertions(+), 12 deletions(-) (limited to 'OpenSim/Framework/Communications') diff --git a/OpenSim/Framework/Communications/CommunicationsManager.cs b/OpenSim/Framework/Communications/CommunicationsManager.cs index 3f46776..bcf9bed 100644 --- a/OpenSim/Framework/Communications/CommunicationsManager.cs +++ b/OpenSim/Framework/Communications/CommunicationsManager.cs @@ -110,7 +110,6 @@ namespace OpenSim.Framework.Communications /// protected IUserServiceAdmin m_userServiceAdmin; - public BaseHttpServer HttpServer { get { return m_httpServer; } diff --git a/OpenSim/Framework/Communications/InventoryServiceBase.cs b/OpenSim/Framework/Communications/InventoryServiceBase.cs index 5841151..777e15b 100644 --- a/OpenSim/Framework/Communications/InventoryServiceBase.cs +++ b/OpenSim/Framework/Communications/InventoryServiceBase.cs @@ -48,20 +48,29 @@ namespace OpenSim.Framework.Communications #region Plugin methods /// - /// Adds a new user server plugin - plugins will be requested in the order they were loaded. + /// Add a new inventory data plugin - plugins will be requested in the order they were added. /// - /// The filename to the user server plugin DLL + /// The plugin that will provide data + public void AddPlugin(IInventoryDataPlugin plugin) + { + m_plugins.Add(plugin); + } + + /// + /// Adds a new inventory data plugin - plugins will be requested in the order they were loaded. + /// + /// The filename of the inventory server plugin DLL public void AddPlugin(string provider, string connect) { PluginLoader loader = - new PluginLoader (new InventoryDataInitialiser (connect)); + new PluginLoader (new InventoryDataInitialiser(connect)); // loader will try to load all providers (MySQL, MSSQL, etc) // unless it is constrainted to the correct "Provider" entry in the addin.xml - loader.Add ("/OpenSim/InventoryData", new PluginProviderFilter (provider)); + loader.Add ("/OpenSim/InventoryData", new PluginProviderFilter(provider)); loader.Load(); - m_plugins = loader.Plugins; + m_plugins.AddRange(loader.Plugins); } #endregion diff --git a/OpenSim/Framework/Communications/UserManagerBase.cs b/OpenSim/Framework/Communications/UserManagerBase.cs index 2a66260..a929317 100644 --- a/OpenSim/Framework/Communications/UserManagerBase.cs +++ b/OpenSim/Framework/Communications/UserManagerBase.cs @@ -48,12 +48,24 @@ namespace OpenSim.Framework.Communications private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + /// + /// List of plugins to search for user data + /// private List _plugins = new List(); + + /// + /// Add a new user data plugin - plugins will be requested in the order they were added. + /// + /// The plugin that will provide user data + public void AddPlugin(IUserDataPlugin plugin) + { + _plugins.Add(plugin); + } /// - /// Adds a new user server plugin - user servers will be requested in the order they were loaded. + /// Add a new user data plugin - plugins will be requested in the order they were added. /// - /// The filename to the user server plugin DLL + /// The filename to the user data plugin DLL /// public void AddPlugin(string provider, string connect) { @@ -65,7 +77,7 @@ namespace OpenSim.Framework.Communications loader.Add("/OpenSim/UserData", new PluginProviderFilter(provider)); loader.Load(); - _plugins = loader.Plugins; + _plugins.AddRange(loader.Plugins); } #region Get UserProfile @@ -637,7 +649,7 @@ namespace OpenSim.Framework.Communications } catch (Exception e) { - m_log.Info("[USERSTORAGE]: Unable to add user via " + plugin.Name + "(" + e.ToString() + ")"); + m_log.Error("[USERSTORAGE]: Unable to add user via " + plugin.Name + "(" + e.ToString() + ")"); } } @@ -696,8 +708,11 @@ namespace OpenSim.Framework.Communications return false; } - /// Appearance - /// TODO: stubs for now to get us to a compiling state gently + /// + /// Get avatar appearance information + /// + /// + /// public AvatarAppearance GetUserAppearance(UUID user) { foreach (IUserDataPlugin plugin in _plugins) @@ -714,6 +729,11 @@ namespace OpenSim.Framework.Communications return null; } + /// + /// Update avatar appearance information + /// + /// + /// public void UpdateUserAppearance(UUID user, AvatarAppearance appearance) { foreach (IUserDataPlugin plugin in _plugins) -- cgit v1.1