From be357f8feeb438e3292292d163918a307d69c69a Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 30 Aug 2011 01:58:32 +0100 Subject: Fix bug in persisting saved appearances for npcs Assets have to be marked non-local as well as non-temporary to persist. This is now done. Hopefully addresses http://opensimulator.org/mantis/view.php?id=5660 --- OpenSim/Tests/Common/Helpers/SceneHelpers.cs | 35 ++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 5 deletions(-) (limited to 'OpenSim/Tests') diff --git a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs index 086a725..2cf40d7 100644 --- a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs @@ -40,6 +40,7 @@ using OpenSim.Region.Framework; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.CoreModules.Avatar.Gods; +using OpenSim.Region.CoreModules.Asset; using OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset; using OpenSim.Region.CoreModules.ServiceConnectorsOut.Authentication; using OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory; @@ -56,6 +57,11 @@ namespace OpenSim.Tests.Common /// public class SceneHelpers { + public static TestScene SetupScene() + { + return SetupScene(null); + } + /// /// Set up a test scene /// @@ -63,9 +69,14 @@ namespace OpenSim.Tests.Common /// Automatically starts service threads, as would the normal runtime. /// /// - public static TestScene SetupScene() + public static TestScene SetupScene(CoreAssetCache cache) + { + return SetupScene("Unit test region", UUID.Random(), 1000, 1000, cache); + } + + public static TestScene SetupScene(string name, UUID id, uint x, uint y) { - return SetupScene("Unit test region", UUID.Random(), 1000, 1000); + return SetupScene(name, id, x, y, null); } /// @@ -78,7 +89,7 @@ namespace OpenSim.Tests.Common /// Y co-ordinate of the region /// This should be the same if simulating two scenes within a standalone /// - public static TestScene SetupScene(string name, UUID id, uint x, uint y) + public static TestScene SetupScene(string name, UUID id, uint x, uint y, CoreAssetCache cache) { Console.WriteLine("Setting up test scene {0}", name); @@ -103,7 +114,7 @@ namespace OpenSim.Tests.Common godsModule.Initialise(testScene, new IniConfigSource()); testScene.AddModule(godsModule.Name, godsModule); - LocalAssetServicesConnector assetService = StartAssetService(testScene); + LocalAssetServicesConnector assetService = StartAssetService(testScene, cache); StartAuthenticationService(testScene); LocalInventoryServicesConnector inventoryService = StartInventoryService(testScene); StartGridService(testScene); @@ -132,7 +143,7 @@ namespace OpenSim.Tests.Common return testScene; } - private static LocalAssetServicesConnector StartAssetService(Scene testScene) + private static LocalAssetServicesConnector StartAssetService(Scene testScene, CoreAssetCache cache) { LocalAssetServicesConnector assetService = new LocalAssetServicesConnector(); IConfigSource config = new IniConfigSource(); @@ -145,6 +156,20 @@ namespace OpenSim.Tests.Common assetService.Initialise(config); assetService.AddRegion(testScene); + + if (cache != null) + { + IConfigSource cacheConfig = new IniConfigSource(); + cacheConfig.AddConfig("Modules"); + cacheConfig.Configs["Modules"].Set("AssetCaching", "CoreAssetCache"); + cacheConfig.AddConfig("AssetCache"); + + cache.Initialise(cacheConfig); + cache.AddRegion(testScene); + cache.RegionLoaded(testScene); + testScene.AddRegionModule(cache.Name, cache); + } + assetService.RegionLoaded(testScene); testScene.AddRegionModule(assetService.Name, assetService); -- cgit v1.1