* 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 time0.6.1-post-fixes
parent
5867f9c11f
commit
7c6c776ff7
|
@ -110,7 +110,6 @@ namespace OpenSim.Framework.Communications
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected IUserServiceAdmin m_userServiceAdmin;
|
protected IUserServiceAdmin m_userServiceAdmin;
|
||||||
|
|
||||||
|
|
||||||
public BaseHttpServer HttpServer
|
public BaseHttpServer HttpServer
|
||||||
{
|
{
|
||||||
get { return m_httpServer; }
|
get { return m_httpServer; }
|
||||||
|
|
|
@ -48,9 +48,18 @@ namespace OpenSim.Framework.Communications
|
||||||
#region Plugin methods
|
#region Plugin methods
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 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.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="provider">The filename to the user server plugin DLL</param>
|
/// <param name="plugin">The plugin that will provide data</param>
|
||||||
|
public void AddPlugin(IInventoryDataPlugin plugin)
|
||||||
|
{
|
||||||
|
m_plugins.Add(plugin);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds a new inventory data plugin - plugins will be requested in the order they were loaded.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="provider">The filename of the inventory server plugin DLL</param>
|
||||||
public void AddPlugin(string provider, string connect)
|
public void AddPlugin(string provider, string connect)
|
||||||
{
|
{
|
||||||
PluginLoader<IInventoryDataPlugin> loader =
|
PluginLoader<IInventoryDataPlugin> loader =
|
||||||
|
@ -61,7 +70,7 @@ namespace OpenSim.Framework.Communications
|
||||||
loader.Add ("/OpenSim/InventoryData", new PluginProviderFilter(provider));
|
loader.Add ("/OpenSim/InventoryData", new PluginProviderFilter(provider));
|
||||||
loader.Load();
|
loader.Load();
|
||||||
|
|
||||||
m_plugins = loader.Plugins;
|
m_plugins.AddRange(loader.Plugins);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
@ -48,12 +48,24 @@ namespace OpenSim.Framework.Communications
|
||||||
private static readonly ILog m_log
|
private static readonly ILog m_log
|
||||||
= LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
= LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
/// <value>
|
||||||
|
/// List of plugins to search for user data
|
||||||
|
/// </value>
|
||||||
private List<IUserDataPlugin> _plugins = new List<IUserDataPlugin>();
|
private List<IUserDataPlugin> _plugins = new List<IUserDataPlugin>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 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.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="provider">The filename to the user server plugin DLL</param>
|
/// <param name="plugin">The plugin that will provide user data</param>
|
||||||
|
public void AddPlugin(IUserDataPlugin plugin)
|
||||||
|
{
|
||||||
|
_plugins.Add(plugin);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Add a new user data plugin - plugins will be requested in the order they were added.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="provider">The filename to the user data plugin DLL</param>
|
||||||
/// <param name="connect"></param>
|
/// <param name="connect"></param>
|
||||||
public void AddPlugin(string provider, string connect)
|
public void AddPlugin(string provider, string connect)
|
||||||
{
|
{
|
||||||
|
@ -65,7 +77,7 @@ namespace OpenSim.Framework.Communications
|
||||||
loader.Add("/OpenSim/UserData", new PluginProviderFilter(provider));
|
loader.Add("/OpenSim/UserData", new PluginProviderFilter(provider));
|
||||||
loader.Load();
|
loader.Load();
|
||||||
|
|
||||||
_plugins = loader.Plugins;
|
_plugins.AddRange(loader.Plugins);
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Get UserProfile
|
#region Get UserProfile
|
||||||
|
@ -637,7 +649,7 @@ namespace OpenSim.Framework.Communications
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Appearance
|
/// <summary>
|
||||||
/// TODO: stubs for now to get us to a compiling state gently
|
/// Get avatar appearance information
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="user"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public AvatarAppearance GetUserAppearance(UUID user)
|
public AvatarAppearance GetUserAppearance(UUID user)
|
||||||
{
|
{
|
||||||
foreach (IUserDataPlugin plugin in _plugins)
|
foreach (IUserDataPlugin plugin in _plugins)
|
||||||
|
@ -714,6 +729,11 @@ namespace OpenSim.Framework.Communications
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Update avatar appearance information
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="user"></param>
|
||||||
|
/// <param name="appearance"></param>
|
||||||
public void UpdateUserAppearance(UUID user, AvatarAppearance appearance)
|
public void UpdateUserAppearance(UUID user, AvatarAppearance appearance)
|
||||||
{
|
{
|
||||||
foreach (IUserDataPlugin plugin in _plugins)
|
foreach (IUserDataPlugin plugin in _plugins)
|
||||||
|
|
|
@ -182,6 +182,7 @@ namespace OpenSim.Framework
|
||||||
T plugin = (T)node.CreateInstance();
|
T plugin = (T)node.CreateInstance();
|
||||||
loadedPlugins.Add(plugin);
|
loadedPlugins.Add(plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
// We do Initialise() in a second loop after CreateInstance
|
// We do Initialise() in a second loop after CreateInstance
|
||||||
// So that modules who need init before others can do it
|
// So that modules who need init before others can do it
|
||||||
// Example: Script Engine Component System needs to load its components before RegionLoader starts
|
// Example: Script Engine Component System needs to load its components before RegionLoader starts
|
||||||
|
@ -204,7 +205,7 @@ namespace OpenSim.Framework
|
||||||
if (AddinManager.IsInitialized == true)
|
if (AddinManager.IsInitialized == true)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
log.Info("[PLUGINS]: Initializing");
|
log.Info("[PLUGINS]: Initializing addin manager");
|
||||||
|
|
||||||
AddinManager.AddinLoadError += on_addinloaderror_;
|
AddinManager.AddinLoadError += on_addinloaderror_;
|
||||||
AddinManager.AddinLoaded += on_addinloaded_;
|
AddinManager.AddinLoaded += on_addinloaded_;
|
||||||
|
|
|
@ -2789,8 +2789,10 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
}
|
}
|
||||||
|
|
||||||
m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent);
|
m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent);
|
||||||
|
|
||||||
// rewrite session_id
|
// rewrite session_id
|
||||||
CachedUserInfo userinfo = CommsManager.UserProfileCacheService.GetUserDetails(agent.AgentID);
|
CachedUserInfo userinfo = CommsManager.UserProfileCacheService.GetUserDetails(agent.AgentID);
|
||||||
|
|
||||||
if (userinfo != null)
|
if (userinfo != null)
|
||||||
{
|
{
|
||||||
userinfo.SessionID = agent.SessionID;
|
userinfo.SessionID = agent.SessionID;
|
||||||
|
|
|
@ -31,6 +31,8 @@ using NUnit.Framework.SyntaxHelpers;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Communications;
|
using OpenSim.Framework.Communications;
|
||||||
|
using OpenSim.Framework.Communications.Cache;
|
||||||
|
using OpenSim.Region.Communications.Local;
|
||||||
using OpenSim.Region.Environment.Scenes;
|
using OpenSim.Region.Environment.Scenes;
|
||||||
|
|
||||||
namespace OpenSim.Region.Environment.Scenes.Tests
|
namespace OpenSim.Region.Environment.Scenes.Tests
|
||||||
|
@ -99,6 +101,11 @@ namespace OpenSim.Region.Environment.Scenes.Tests
|
||||||
|
|
||||||
SceneObjectPart part = SceneTestUtils.AddSceneObject(scene);
|
SceneObjectPart part = SceneTestUtils.AddSceneObject(scene);
|
||||||
|
|
||||||
|
((LocalUserServices)scene.CommsManager.UserService).AddPlugin(new TestUserDataPlugin());
|
||||||
|
// Assert.That(
|
||||||
|
// scene.CommsManager.AddUser("Bob", "Hoskins", "test", "test@test.com", 1000, 1000, agentId),
|
||||||
|
// Is.EqualTo(agentId));
|
||||||
|
|
||||||
IClientAPI client = SceneTestUtils.AddRootAgent(scene, agentId);
|
IClientAPI client = SceneTestUtils.AddRootAgent(scene, agentId);
|
||||||
scene.DeRezObject(client, part.LocalId, UUID.Zero, 9, UUID.Zero);
|
scene.DeRezObject(client, part.LocalId, UUID.Zero, 9, UUID.Zero);
|
||||||
|
|
||||||
|
@ -109,6 +116,9 @@ namespace OpenSim.Region.Environment.Scenes.Tests
|
||||||
SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(part.LocalId);
|
SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(part.LocalId);
|
||||||
Assert.That(retrievedPart2, Is.Null);
|
Assert.That(retrievedPart2, Is.Null);
|
||||||
|
|
||||||
|
// CachedUserInfo userInfo = scene.CommsManager.UserProfileCacheService.GetUserDetails(agentId);
|
||||||
|
// Assert.That(userInfo, Is.Not.Null);
|
||||||
|
|
||||||
// TODO: test that the object actually made it successfully into inventory
|
// TODO: test that the object actually made it successfully into inventory
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,9 @@ namespace OpenSim.Region.Environment.Scenes.Tests
|
||||||
public TestCommunicationsManager()
|
public TestCommunicationsManager()
|
||||||
: base(null, null, null, false, null)
|
: base(null, null, null, false, null)
|
||||||
{
|
{
|
||||||
m_userService = new LocalUserServices(null, 991, 992, null);
|
LocalUserServices lus = new LocalUserServices(null, 991, 992, null);
|
||||||
|
m_userService = lus;
|
||||||
|
m_userServiceAdmin = lus;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue