get TestSaveIarV0_1() working again by setting up an OpenSim.Data.Null.UserAuthenticationData plugin

additional tweaks to get this working properly
soprefactor
Justin Clark-Casey (justincc) 2010-06-04 20:43:05 +01:00
parent 86f2339b6e
commit 75878c8f43
9 changed files with 22 additions and 10 deletions

View File

@ -76,6 +76,5 @@ namespace OpenSim.Data.Null
return false; return false;
} }
} }
} }

View File

@ -88,7 +88,7 @@ namespace OpenSim.Data.Null
m_DataByUUID[data.PrincipalID] = data; m_DataByUUID[data.PrincipalID] = data;
m_DataByName[data.FirstName + " " + data.LastName] = 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; m_DataByEmail[data.Data["Email"]] = data;
return true; return true;

View File

@ -390,7 +390,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
/// <returns></returns> /// <returns></returns>
protected UserAccount GetUserInfo(string firstName, string lastName, string pass) 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) if (null == account)
{ {
m_log.ErrorFormat( m_log.ErrorFormat(

View File

@ -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 // Commenting for now! The mock inventory service needs more beef, at least for
// GetFolderForType // GetFolderForType
// REFACTORING PROBLEM. This needs to be rewritten. // REFACTORING PROBLEM. This needs to be rewritten.
//[Test] [Test]
public void TestSaveIarV0_1() public void TestSaveIarV0_1()
{ {
TestHelper.InMethod(); TestHelper.InMethod();
@ -84,7 +84,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); InventoryArchiverModule archiverModule = new InventoryArchiverModule(true);
Scene scene = SceneSetupHelpers.SetupScene("Inventory"); Scene scene = SceneSetupHelpers.SetupScene("Inventory, useraccounts");
SceneSetupHelpers.SetupSceneModules(scene, archiverModule); SceneSetupHelpers.SetupSceneModules(scene, archiverModule);
// Create user // Create user

View File

@ -88,7 +88,7 @@ namespace OpenSim.Services.AuthenticationService
m_Database = LoadPlugin<IAuthenticationData>(dllName, m_Database = LoadPlugin<IAuthenticationData>(dllName,
new Object[] {connString, realm}); new Object[] {connString, realm});
if (m_Database == null) 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) public bool Verify(UUID principalID, string token, int lifetime)

View File

@ -71,7 +71,7 @@ namespace OpenSim.Services.AuthenticationService
string hashed = Util.Md5Hash(password + ":" + string hashed = Util.Md5Hash(password + ":" +
data.Data["passwordSalt"].ToString()); 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) if (data.Data["passwordHash"].ToString() == hashed)
{ {

View File

@ -97,6 +97,10 @@ namespace OpenSim.Services.UserAccountService
public UserAccount GetUserAccount(UUID scopeID, string firstName, public UserAccount GetUserAccount(UUID scopeID, string firstName,
string lastName) string lastName)
{ {
// m_log.DebugFormat(
// "[USER ACCOUNT SERVICE]: Retrieving account by username for {0} {1}, scope {2}",
// firstName, lastName, scopeID);
UserAccountData[] d; UserAccountData[] d;
if (scopeID != UUID.Zero) if (scopeID != UUID.Zero)
@ -231,6 +235,10 @@ namespace OpenSim.Services.UserAccountService
public bool StoreUserAccount(UserAccount data) 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(); UserAccountData d = new UserAccountData();
d.FirstName = data.FirstName; d.FirstName = data.FirstName;

View File

@ -260,7 +260,7 @@ namespace OpenSim.Tests.Common.Setup
"LocalServiceModule", "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService"); "LocalServiceModule", "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService");
else else
config.Configs["AuthenticationService"].Set( 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"); config.Configs["AuthenticationService"].Set("StorageProvider", "OpenSim.Data.Null.dll");
service.Initialise(config); service.Initialise(config);
service.AddRegion(testScene); service.AddRegion(testScene);

View File

@ -25,6 +25,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
using System.Collections.Generic;
using OpenMetaverse; using OpenMetaverse;
using OpenSim.Framework.Communications; using OpenSim.Framework.Communications;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
@ -124,7 +125,9 @@ namespace OpenSim.Tests.Common.Setup
public static UserAccount CreateUserWithInventory( public static UserAccount CreateUserWithInventory(
Scene scene, string firstName, string lastName, UUID userId, string pw) 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<string, object>() };
scene.UserAccountService.StoreUserAccount(ua); scene.UserAccountService.StoreUserAccount(ua);
scene.InventoryService.CreateUserInventory(ua.PrincipalID); scene.InventoryService.CreateUserInventory(ua.PrincipalID);
scene.AuthenticationService.SetPassword(ua.PrincipalID, pw); scene.AuthenticationService.SetPassword(ua.PrincipalID, pw);