From 156604e28e51d0a7e0c8018ce10eb517a9123ce4 Mon Sep 17 00:00:00 2001 From: diva Date: Thu, 11 Jun 2009 03:00:25 +0000 Subject: InterServiceInventoryService references *almost* completely removed from the simulator. Only a couple left, not important. Also updated the login tests -- Justin, this time I was able to fix this by myself :) --- .../Communications/Services/HGLoginAuthService.cs | 2 +- .../Communications/Services/LoginService.cs | 27 ++++- .../Communications/Tests/LoginServiceTests.cs | 125 ++++++++++++++++++++- 3 files changed, 146 insertions(+), 8 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Communications/Services/HGLoginAuthService.cs b/OpenSim/Framework/Communications/Services/HGLoginAuthService.cs index 0637a1e..8e0205c 100644 --- a/OpenSim/Framework/Communications/Services/HGLoginAuthService.cs +++ b/OpenSim/Framework/Communications/Services/HGLoginAuthService.cs @@ -78,7 +78,7 @@ namespace OpenSim.Framework.Communications.Services m_interServiceInventoryService = interServiceInventoryService; m_regionsConnector = regionsConnector; - m_inventoryService = interServiceInventoryService; + m_interInventoryService = interServiceInventoryService; } public void SetServersInfo(NetworkServersInfo sinfo) diff --git a/OpenSim/Framework/Communications/Services/LoginService.cs b/OpenSim/Framework/Communications/Services/LoginService.cs index 900a3d9..7eb98d7 100644 --- a/OpenSim/Framework/Communications/Services/LoginService.cs +++ b/OpenSim/Framework/Communications/Services/LoginService.cs @@ -41,6 +41,7 @@ using OpenMetaverse.StructuredData; using OpenSim.Framework; using OpenSim.Framework.Communications.Cache; using OpenSim.Framework.Statistics; +using OpenSim.Services.Interfaces; namespace OpenSim.Framework.Communications.Services { @@ -66,7 +67,9 @@ namespace OpenSim.Framework.Communications.Services /// /// Used by the login service to make requests to the inventory service. /// - protected IInterServiceInventoryServices m_inventoryService; + protected IInterServiceInventoryServices m_interInventoryService; + // Hack + protected IInventoryService m_InventoryService; /// /// Constructor @@ -1047,7 +1050,10 @@ namespace OpenSim.Framework.Communications.Services List gestures = null; try { - gestures = m_inventoryService.GetActiveGestures(theUser.ID); + if (m_InventoryService != null) + gestures = m_InventoryService.GetActiveGestures(theUser.ID); + else + gestures = m_interInventoryService.GetActiveGestures(theUser.ID); } catch (Exception e) { @@ -1076,7 +1082,15 @@ namespace OpenSim.Framework.Communications.Services /// This will be thrown if there is a problem with the inventory service protected InventoryData GetInventorySkeleton(UUID userID) { - List folders = m_inventoryService.GetInventorySkeleton(userID); + List folders = null; + if (m_InventoryService != null) + { + folders = m_InventoryService.GetInventorySkeleton(userID); + } + else + { + folders = m_interInventoryService.GetInventorySkeleton(userID); + } // If we have user auth but no inventory folders for some reason, create a new set of folders. if (folders == null || folders.Count == 0) @@ -1088,7 +1102,7 @@ namespace OpenSim.Framework.Communications.Services // tools are creating the user profile directly in the database without creating the inventory. At // this time we'll accomodate them by lazily creating the user inventory now if it doesn't already // exist. - if (!m_inventoryService.CreateNewUserInventory(userID)) + if ((m_interInventoryService != null) && !m_interInventoryService.CreateNewUserInventory(userID)) { throw new Exception( String.Format( @@ -1099,7 +1113,10 @@ namespace OpenSim.Framework.Communications.Services m_log.InfoFormat("[LOGIN]: A new inventory skeleton was successfully created for user {0}", userID); - folders = m_inventoryService.GetInventorySkeleton(userID); + if (m_InventoryService != null) + folders = m_InventoryService.GetInventorySkeleton(userID); + else + folders = m_interInventoryService.GetInventorySkeleton(userID); if (folders == null || folders.Count == 0) { diff --git a/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs b/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs index 7a622ad..d637ef0 100644 --- a/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs +++ b/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs @@ -39,6 +39,8 @@ using OpenSim.Region.Communications.Local; using OpenSim.Tests.Common.Mock; using OpenSim.Client.Linden; using OpenSim.Tests.Common; +using OpenSim.Services.Interfaces; +using OpenMetaverse; namespace OpenSim.Framework.Communications.Tests { @@ -73,7 +75,7 @@ namespace OpenSim.Framework.Communications.Tests m_localUserServices = (LocalUserServices) m_commsManager.UserService; m_localUserServices.AddUser(m_firstName,m_lastName,"boingboing","abc@ftw.com",42,43); - m_loginService = new LLStandaloneLoginService((UserManagerBase) m_localUserServices, "Hello folks", m_commsManager.InterServiceInventoryService, + m_loginService = new LLStandaloneLoginService((UserManagerBase) m_localUserServices, "Hello folks", new TestInventoryService(), m_commsManager.NetworkServersInfo, true, new LibraryRootFolder(String.Empty), m_regionConnector); m_userProfileData = m_localUserServices.GetUserProfile(m_firstName, m_lastName); @@ -88,7 +90,7 @@ namespace OpenSim.Framework.Communications.Tests TestHelper.InMethod(); // We want to use our own LoginService for this test, one that // doesn't require authentication. - LoginService loginService = new LLStandaloneLoginService((UserManagerBase)m_commsManager.UserService, "Hello folks", m_commsManager.InterServiceInventoryService, + LoginService loginService = new LLStandaloneLoginService((UserManagerBase)m_commsManager.UserService, "Hello folks", new TestInventoryService(), m_commsManager.NetworkServersInfo, false, new LibraryRootFolder(String.Empty), m_regionConnector); Hashtable loginParams = new Hashtable(); @@ -440,4 +442,123 @@ namespace OpenSim.Framework.Communications.Tests #endregion } } + + class TestInventoryService : IInventoryService + { + public TestInventoryService() + { + } + + /// + /// + /// + /// + /// + public bool CreateUserInventory(UUID userId) + { + return false; + } + + /// + /// + /// + /// + /// + public List GetInventorySkeleton(UUID userId) + { + List folders = new List(); + InventoryFolderBase folder = new InventoryFolderBase(); + folder.ID = UUID.Random(); + folder.Owner = userId; + folders.Add(folder); + return folders; + } + + /// + /// Returns a list of all the active gestures in a user's inventory. + /// + /// + /// The of the user + /// + /// + /// A flat list of the gesture items. + /// + public List GetActiveGestures(UUID userId) + { + return null; + } + + public InventoryCollection GetUserInventory(UUID userID) + { + return null; + } + + public void GetUserInventory(UUID userID, OpenSim.Services.Interfaces.InventoryReceiptCallback callback) + { + } + + public List GetFolderItems(UUID folderID) + { + return null; + } + + public bool AddFolder(InventoryFolderBase folder) + { + return false; + } + + public bool UpdateFolder(InventoryFolderBase folder) + { + return false; + } + + public bool MoveFolder(InventoryFolderBase folder) + { + return false; + } + + public bool PurgeFolder(InventoryFolderBase folder) + { + return false; + } + + public bool AddItem(InventoryItemBase item) + { + return false; + } + + public bool UpdateItem(InventoryItemBase item) + { + return false; + } + + public bool DeleteItem(InventoryItemBase item) + { + return false; + } + + public InventoryItemBase QueryItem(InventoryItemBase item) + { + return null; + } + + public InventoryFolderBase QueryFolder(InventoryFolderBase folder) + { + return null; + } + + public bool HasInventoryForUser(UUID userID) + { + return false; + } + + public InventoryFolderBase RequestRootFolder(UUID userID) + { + InventoryFolderBase root = new InventoryFolderBase(); + root.ID = UUID.Random(); + root.Owner = userID; + root.ParentID = UUID.Zero; + return root; + } + } } -- cgit v1.1