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 --- OpenSim/Region/Environment/Scenes/Scene.cs | 2 ++ .../Region/Environment/Scenes/Tests/SceneObjectTests.cs | 14 ++++++++++++-- .../Region/Environment/Scenes/Tests/ScenePresenceTests.cs | 4 ++-- .../Environment/Scenes/Tests/TestCommunicationsManager.cs | 4 +++- 4 files changed, 19 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 71ef524..3e34ffb 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -2789,8 +2789,10 @@ namespace OpenSim.Region.Environment.Scenes } m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent); + // rewrite session_id CachedUserInfo userinfo = CommsManager.UserProfileCacheService.GetUserDetails(agent.AgentID); + if (userinfo != null) { userinfo.SessionID = agent.SessionID; diff --git a/OpenSim/Region/Environment/Scenes/Tests/SceneObjectTests.cs b/OpenSim/Region/Environment/Scenes/Tests/SceneObjectTests.cs index a24161e..216dce5 100644 --- a/OpenSim/Region/Environment/Scenes/Tests/SceneObjectTests.cs +++ b/OpenSim/Region/Environment/Scenes/Tests/SceneObjectTests.cs @@ -31,6 +31,8 @@ using NUnit.Framework.SyntaxHelpers; using OpenMetaverse; using OpenSim.Framework; using OpenSim.Framework.Communications; +using OpenSim.Framework.Communications.Cache; +using OpenSim.Region.Communications.Local; using OpenSim.Region.Environment.Scenes; namespace OpenSim.Region.Environment.Scenes.Tests @@ -57,7 +59,7 @@ namespace OpenSim.Region.Environment.Scenes.Tests /// /// Test adding an object to a scene. /// - [Test] + [Test] public void TestAddSceneObject() { Scene scene = SceneTestUtils.SetupScene(); @@ -99,6 +101,11 @@ namespace OpenSim.Region.Environment.Scenes.Tests 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); scene.DeRezObject(client, part.LocalId, UUID.Zero, 9, UUID.Zero); @@ -107,7 +114,10 @@ namespace OpenSim.Region.Environment.Scenes.Tests sogd.InventoryDeQueueAndDelete(); 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 } diff --git a/OpenSim/Region/Environment/Scenes/Tests/ScenePresenceTests.cs b/OpenSim/Region/Environment/Scenes/Tests/ScenePresenceTests.cs index fcc6c41..587d288 100644 --- a/OpenSim/Region/Environment/Scenes/Tests/ScenePresenceTests.cs +++ b/OpenSim/Region/Environment/Scenes/Tests/ScenePresenceTests.cs @@ -85,8 +85,8 @@ namespace OpenSim.Region.Environment.Scenes.Tests /// /// Test removing an uncrossed root agent from a scene. - /// - [Test] + /// + [Test] public void TestRemoveRootAgent() { Scene scene = SceneTestUtils.SetupScene(); diff --git a/OpenSim/Region/Environment/Scenes/Tests/TestCommunicationsManager.cs b/OpenSim/Region/Environment/Scenes/Tests/TestCommunicationsManager.cs index 2225edd..9b2046b 100644 --- a/OpenSim/Region/Environment/Scenes/Tests/TestCommunicationsManager.cs +++ b/OpenSim/Region/Environment/Scenes/Tests/TestCommunicationsManager.cs @@ -38,7 +38,9 @@ namespace OpenSim.Region.Environment.Scenes.Tests public TestCommunicationsManager() : 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; } } } -- cgit v1.1