From 18aa2ea0c5ebd8d5131902ed9856e68f46e76e11 Mon Sep 17 00:00:00 2001 From: Arthur Valadares Date: Tue, 11 Aug 2009 12:07:54 -0300 Subject: * Improves SceneSetupHelper to allow the tester to choose a real or mock, inventory and asset, service modules. The boolean startServices was replaced with realServices string. If the string contains the word asset, it will start a real asset module, if it contains inventory, it starts a real inventory. Otherwise, it use mock (NullPlugin-like) objects, for tests that don't really need functionality. * SetupScene is now actually sharing the asset and inventory modules if the tester wishes to have multiple regions connected. To link regions, just start SetupScene with the same CommunicationManager for all scenes. SceneSetupHelper will hold a static reference to the modules and won't initialize them again, just run the scenes through the modules AddRegion, RegionLoaded and PostInitialize. * With the recent changes, both asset and inventory (and in the future, user) services should always be asked from the scene, not instantiated alone. The tests should reflect this new behavior and always start a scene. --- OpenSim/Tests/Common/Mock/TestAssetService.cs | 9 +- OpenSim/Tests/Common/Mock/TestInventoryService.cs | 133 ++++++++++++++++++++++ 2 files changed, 140 insertions(+), 2 deletions(-) create mode 100644 OpenSim/Tests/Common/Mock/TestInventoryService.cs (limited to 'OpenSim/Tests/Common/Mock') diff --git a/OpenSim/Tests/Common/Mock/TestAssetService.cs b/OpenSim/Tests/Common/Mock/TestAssetService.cs index d35e3ed..5f1184b 100644 --- a/OpenSim/Tests/Common/Mock/TestAssetService.cs +++ b/OpenSim/Tests/Common/Mock/TestAssetService.cs @@ -31,13 +31,18 @@ using OpenMetaverse; using OpenSim.Framework; using OpenSim.Data; using OpenSim.Services.Interfaces; +using Nini.Config; namespace OpenSim.Tests.Common.Mock { public class TestAssetService : IAssetService { - private readonly Dictionary Assets = new Dictionary(); - + private readonly Dictionary Assets = new Dictionary(); + + public TestAssetService(IConfigSource config) + { + } + public AssetBase Get(string id) { return Assets[ id ]; diff --git a/OpenSim/Tests/Common/Mock/TestInventoryService.cs b/OpenSim/Tests/Common/Mock/TestInventoryService.cs new file mode 100644 index 0000000..cf1a3a9 --- /dev/null +++ b/OpenSim/Tests/Common/Mock/TestInventoryService.cs @@ -0,0 +1,133 @@ +using System; +using System.Collections.Generic; +using System.Text; +using OpenSim.Framework; +using OpenMetaverse; +using OpenSim.Services.Interfaces; +using Nini.Config; + +namespace OpenSim.Tests.Common.Mock +{ + public class TestInventoryService : IInventoryService + { + public TestInventoryService() + { + } + + public TestInventoryService(IConfigSource config) + { + } + + /// + /// + /// + /// + /// + 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 userID, 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