From 40c2e2e84f50e9a75f26b326a798a280d36687e9 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Wed, 29 Apr 2009 19:31:48 +0000 Subject: * Add test to check temp profile creation on iar load --- OpenSim/Framework/Communications/OspResolver.cs | 12 ++++++++---- .../Framework/Communications/TemporaryUserProfilePlugin.cs | 8 ++++++++ .../Inventory/Archiver/Tests/InventoryArchiverTests.cs | 7 +++---- .../Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs | 5 +---- 4 files changed, 20 insertions(+), 12 deletions(-) diff --git a/OpenSim/Framework/Communications/OspResolver.cs b/OpenSim/Framework/Communications/OspResolver.cs index f246692..4627e30 100644 --- a/OpenSim/Framework/Communications/OspResolver.cs +++ b/OpenSim/Framework/Communications/OspResolver.cs @@ -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 /// 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(); diff --git a/OpenSim/Framework/Communications/TemporaryUserProfilePlugin.cs b/OpenSim/Framework/Communications/TemporaryUserProfilePlugin.cs index 3b78c99..7478cdd 100644 --- a/OpenSim/Framework/Communications/TemporaryUserProfilePlugin.cs +++ b/OpenSim/Framework/Communications/TemporaryUserProfilePlugin.cs @@ -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 /// public class TemporaryUserProfilePlugin : IUserDataPlugin { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + protected Dictionary m_profiles = new Dictionary(); 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; diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index 9bec7ed..d059632 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs @@ -257,8 +257,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests Console.WriteLine("Successfully completed {0}", MethodBase.GetCurrentMethod()); } - - /* + /// /// 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()); } - */ /// /// Test replication of an archive path to the user's inventory. diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs index f7001ef..e04b1ba 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs @@ -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; -- cgit v1.1