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