* Add test to check temp profile creation on iar load

0.6.5-rc1
Justin Clarke Casey 2009-04-29 19:31:48 +00:00
parent 1bf0bc8bb3
commit 40c2e2e84f
4 changed files with 20 additions and 12 deletions

View File

@ -42,7 +42,7 @@ namespace OpenSim.Framework.Communications
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public const string OSPA_PREFIX = "ospi:";
public const string OSPA_PREFIX = "ospa:";
public const string OSPA_NAME_KEY = "n";
public const string OSPA_NAME_VALUE_SEPARATOR = " ";
public const string OSPA_TUPLE_SEPARATOR = "|";
@ -76,6 +76,8 @@ namespace OpenSim.Framework.Communications
/// </returns>
public static string Resolve(string ospa, CommunicationsManager commsManager)
{
m_log.DebugFormat("[OSP RESOLVER]: Resolving {0}", ospa);
if (!ospa.StartsWith(OSPA_PREFIX))
return ospa;
@ -88,7 +90,7 @@ namespace OpenSim.Framework.Communications
if (tupleSeparatorIndex < 0)
{
m_log.WarnFormat("[OSPA RESOLVER]: Ignoring non-tuple component {0} in OSPA {1}", tuple, ospa);
m_log.WarnFormat("[OSP RESOLVER]: Ignoring non-tuple component {0} in OSPA {1}", tuple, ospa);
continue;
}
@ -117,7 +119,7 @@ namespace OpenSim.Framework.Communications
if (nameSeparatorIndex < 0)
{
m_log.WarnFormat("[OSPA RESOLVER]: Ignoring unseparated name {0}", name);
m_log.WarnFormat("[OSP RESOLVER]: Ignoring unseparated name {0}", name);
return null;
}
@ -127,12 +129,14 @@ namespace OpenSim.Framework.Communications
CachedUserInfo userInfo = commsManager.UserProfileCacheService.GetUserDetails(firstName, lastName);
if (userInfo != null)
return userInfo.UserProfile.ID.ToString();
UserProfileData tempUserProfile = new UserProfileData();
tempUserProfile.FirstName = firstName;
tempUserProfile.SurName = lastName;
tempUserProfile.ID = new UUID(Utils.MD5(Encoding.Unicode.GetBytes(tempUserProfile.Name)), 0);
m_log.DebugFormat(
"[OSP RESOLVER]: Adding temporary user profile for {0} {1}", tempUserProfile.Name, tempUserProfile.ID);
commsManager.UserService.AddTemporaryUserProfile(tempUserProfile);
return tempUserProfile.ID.ToString();

View File

@ -27,6 +27,8 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using log4net;
using OpenMetaverse;
using OpenSim.Data;
@ -37,6 +39,8 @@ namespace OpenSim.Framework.Communications
/// </summary>
public class TemporaryUserProfilePlugin : IUserDataPlugin
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
protected Dictionary<UUID, UserProfileData> m_profiles = new Dictionary<UUID, UserProfileData>();
public string Name { get { return "TemporaryUserProfilePlugin"; } }
@ -47,6 +51,8 @@ namespace OpenSim.Framework.Communications
public UserProfileData GetUserByUUID(UUID user)
{
m_log.DebugFormat("[TEMP USER PROFILE]: Received request for {0}", user);
lock (m_profiles)
{
if (m_profiles.ContainsKey(user))
@ -66,6 +72,8 @@ namespace OpenSim.Framework.Communications
public virtual void AddTemporaryUserProfile(UserProfileData userProfile)
{
m_log.DebugFormat("[TEMP USER PROFILE]: Adding {0} {1}", userProfile.Name, userProfile.ID);
lock (m_profiles)
{
m_profiles[userProfile.ID] = userProfile;

View File

@ -257,8 +257,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
Console.WriteLine("Successfully completed {0}", MethodBase.GetCurrentMethod());
}
/*
/// <summary>
/// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where
/// no account exists with the creator name
@ -311,7 +310,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
// Check that a suitable temporary user profile has been created.
UserProfileData user2Profile
= scene.CommsManager.UserService.GetUserProfile(user2FirstName, user2LastName);
= scene.CommsManager.UserService.GetUserProfile(
new UUID(Utils.MD5(Encoding.Unicode.GetBytes(user2FirstName + " " + user2LastName)), 0));
Assert.That(user2Profile, Is.Not.Null);
Assert.That(user2Profile.FirstName == user2FirstName);
Assert.That(user2Profile.SurName == user2LastName);
@ -325,7 +325,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
Console.WriteLine("### Successfully completed {0} ###", MethodBase.GetCurrentMethod());
}
*/
/// <summary>
/// Test replication of an archive path to the user's inventory.

View File

@ -54,10 +54,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
{
public class FreeSwitchVoiceModule : IRegionModule
{
// Infrastructure
private static readonly ILog m_log =
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private bool UseProxy = false;