diff options
author | Justin Clark-Casey (justincc) | 2011-08-30 01:58:32 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-08-30 01:58:32 +0100 |
commit | be357f8feeb438e3292292d163918a307d69c69a (patch) | |
tree | f1f45b0a5bb58262885065b7a3fa37dde0d3d03e | |
parent | Move GetMeshKey from buried inside Meshmerizer to a public method on Primitiv... (diff) | |
download | opensim-SC_OLD-be357f8feeb438e3292292d163918a307d69c69a.zip opensim-SC_OLD-be357f8feeb438e3292292d163918a307d69c69a.tar.gz opensim-SC_OLD-be357f8feeb438e3292292d163918a307d69c69a.tar.bz2 opensim-SC_OLD-be357f8feeb438e3292292d163918a307d69c69a.tar.xz |
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
Diffstat (limited to '')
8 files changed, 168 insertions, 24 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index ff889ea..d1ce5df 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | |||
@@ -136,7 +136,6 @@ namespace OpenSim.Region.ClientStack.Linden | |||
136 | TaskScriptUpdatedCall = m_Scene.CapsUpdateTaskInventoryScriptAsset; | 136 | TaskScriptUpdatedCall = m_Scene.CapsUpdateTaskInventoryScriptAsset; |
137 | CAPSFetchInventoryDescendents = m_Scene.HandleFetchInventoryDescendentsCAPS; | 137 | CAPSFetchInventoryDescendents = m_Scene.HandleFetchInventoryDescendentsCAPS; |
138 | GetClient = m_Scene.SceneContents.GetControllingClient; | 138 | GetClient = m_Scene.SceneContents.GetControllingClient; |
139 | |||
140 | } | 139 | } |
141 | 140 | ||
142 | /// <summary> | 141 | /// <summary> |
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index 4627701..f34b6d2 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs | |||
@@ -257,20 +257,27 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
257 | return true; | 257 | return true; |
258 | } | 258 | } |
259 | 259 | ||
260 | public bool SaveBakedTextures(UUID agentId) | 260 | public Dictionary<BakeType, Primitive.TextureEntryFace> GetBakedTextureFaces(UUID agentId) |
261 | { | 261 | { |
262 | ScenePresence sp = m_scene.GetScenePresence(agentId); | 262 | ScenePresence sp = m_scene.GetScenePresence(agentId); |
263 | 263 | ||
264 | if (sp == null || sp.IsChildAgent) | 264 | if (sp == null) |
265 | return false; | 265 | return new Dictionary<BakeType, Primitive.TextureEntryFace>(); |
266 | |||
267 | return GetBakedTextureFaces(sp); | ||
268 | } | ||
269 | |||
270 | private Dictionary<BakeType, Primitive.TextureEntryFace> GetBakedTextureFaces(ScenePresence sp) | ||
271 | { | ||
272 | if (sp.IsChildAgent) | ||
273 | return new Dictionary<BakeType, Primitive.TextureEntryFace>(); | ||
274 | |||
275 | Dictionary<BakeType, Primitive.TextureEntryFace> bakedTextures | ||
276 | = new Dictionary<BakeType, Primitive.TextureEntryFace>(); | ||
266 | 277 | ||
267 | AvatarAppearance appearance = sp.Appearance; | 278 | AvatarAppearance appearance = sp.Appearance; |
268 | Primitive.TextureEntryFace[] faceTextures = appearance.Texture.FaceTextures; | 279 | Primitive.TextureEntryFace[] faceTextures = appearance.Texture.FaceTextures; |
269 | 280 | ||
270 | m_log.DebugFormat( | ||
271 | "[AV FACTORY]: Permanently saving baked textures for {0} in {1}", | ||
272 | sp.Name, m_scene.RegionInfo.RegionName); | ||
273 | |||
274 | foreach (int i in Enum.GetValues(typeof(BakeType))) | 281 | foreach (int i in Enum.GetValues(typeof(BakeType))) |
275 | { | 282 | { |
276 | BakeType bakeType = (BakeType)i; | 283 | BakeType bakeType = (BakeType)i; |
@@ -283,7 +290,31 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
283 | // acd.AgentID, i, acd.Appearance.Texture.FaceTextures[i]); | 290 | // acd.AgentID, i, acd.Appearance.Texture.FaceTextures[i]); |
284 | 291 | ||
285 | int ftIndex = (int)AppearanceManager.BakeTypeToAgentTextureIndex(bakeType); | 292 | int ftIndex = (int)AppearanceManager.BakeTypeToAgentTextureIndex(bakeType); |
286 | Primitive.TextureEntryFace bakedTextureFace = faceTextures[ftIndex]; | 293 | bakedTextures[bakeType] = faceTextures[ftIndex]; |
294 | } | ||
295 | |||
296 | return bakedTextures; | ||
297 | } | ||
298 | |||
299 | public bool SaveBakedTextures(UUID agentId) | ||
300 | { | ||
301 | ScenePresence sp = m_scene.GetScenePresence(agentId); | ||
302 | |||
303 | if (sp == null) | ||
304 | return false; | ||
305 | |||
306 | m_log.DebugFormat( | ||
307 | "[AV FACTORY]: Permanently saving baked textures for {0} in {1}", | ||
308 | sp.Name, m_scene.RegionInfo.RegionName); | ||
309 | |||
310 | Dictionary<BakeType, Primitive.TextureEntryFace> bakedTextures = GetBakedTextureFaces(sp); | ||
311 | |||
312 | if (bakedTextures.Count == 0) | ||
313 | return false; | ||
314 | |||
315 | foreach (BakeType bakeType in bakedTextures.Keys) | ||
316 | { | ||
317 | Primitive.TextureEntryFace bakedTextureFace = bakedTextures[bakeType]; | ||
287 | 318 | ||
288 | if (bakedTextureFace == null) | 319 | if (bakedTextureFace == null) |
289 | { | 320 | { |
@@ -299,6 +330,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
299 | if (asset != null) | 330 | if (asset != null) |
300 | { | 331 | { |
301 | asset.Temporary = false; | 332 | asset.Temporary = false; |
333 | asset.Local = false; | ||
302 | m_scene.AssetService.Store(asset); | 334 | m_scene.AssetService.Store(asset); |
303 | } | 335 | } |
304 | else | 336 | else |
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs index b831b31..7b2f14e 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs | |||
@@ -26,9 +26,12 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | ||
30 | using Nini.Config; | ||
29 | using NUnit.Framework; | 31 | using NUnit.Framework; |
30 | using OpenMetaverse; | 32 | using OpenMetaverse; |
31 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | using OpenSim.Region.CoreModules.Asset; | ||
32 | using OpenSim.Region.Framework.Scenes; | 35 | using OpenSim.Region.Framework.Scenes; |
33 | using OpenSim.Tests.Common; | 36 | using OpenSim.Tests.Common; |
34 | using OpenSim.Tests.Common.Mock; | 37 | using OpenSim.Tests.Common.Mock; |
@@ -65,5 +68,53 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
65 | // TODO: Check baked texture | 68 | // TODO: Check baked texture |
66 | Assert.AreEqual(visualParams, sp.Appearance.VisualParams); | 69 | Assert.AreEqual(visualParams, sp.Appearance.VisualParams); |
67 | } | 70 | } |
71 | |||
72 | [Test] | ||
73 | public void TestSaveBakedTextures() | ||
74 | { | ||
75 | TestHelpers.InMethod(); | ||
76 | // log4net.Config.XmlConfigurator.Configure(); | ||
77 | |||
78 | UUID userId = TestHelpers.ParseTail(0x1); | ||
79 | UUID eyesTextureId = TestHelpers.ParseTail(0x2); | ||
80 | |||
81 | // We need an asset cache because otherwise the LocalAssetServiceConnector will short-circuit directly | ||
82 | // to the AssetService, which will then store temporary and local assets permanently | ||
83 | CoreAssetCache assetCache = new CoreAssetCache(); | ||
84 | |||
85 | AvatarFactoryModule afm = new AvatarFactoryModule(); | ||
86 | TestScene scene = SceneHelpers.SetupScene(assetCache); | ||
87 | SceneHelpers.SetupSceneModules(scene, afm); | ||
88 | IClientAPI tc = SceneHelpers.AddScenePresence(scene, userId).ControllingClient; | ||
89 | |||
90 | // TODO: Use the actual BunchOfCaps functionality once we slot in the CapabilitiesModules | ||
91 | AssetBase uploadedAsset; | ||
92 | uploadedAsset = new AssetBase(eyesTextureId, "Baked Texture", (sbyte)AssetType.Texture, userId.ToString()); | ||
93 | uploadedAsset.Data = new byte[] { 2 }; | ||
94 | uploadedAsset.Temporary = true; | ||
95 | uploadedAsset.Local = true; // Local assets aren't persisted, non-local are | ||
96 | scene.AssetService.Store(uploadedAsset); | ||
97 | |||
98 | byte[] visualParams = new byte[AvatarAppearance.VISUALPARAM_COUNT]; | ||
99 | for (byte i = 0; i < visualParams.Length; i++) | ||
100 | visualParams[i] = i; | ||
101 | |||
102 | Primitive.TextureEntry bakedTextureEntry = new Primitive.TextureEntry(TestHelpers.ParseTail(0x10)); | ||
103 | uint eyesFaceIndex = (uint)AppearanceManager.BakeTypeToAgentTextureIndex(BakeType.Eyes); | ||
104 | Primitive.TextureEntryFace eyesFace = bakedTextureEntry.CreateFace(eyesFaceIndex); | ||
105 | eyesFace.TextureID = eyesTextureId; | ||
106 | |||
107 | afm.SetAppearanceFromClient(tc, bakedTextureEntry, visualParams); | ||
108 | afm.SaveBakedTextures(userId); | ||
109 | // Dictionary<BakeType, Primitive.TextureEntryFace> bakedTextures = afm.GetBakedTextureFaces(userId); | ||
110 | |||
111 | // We should also inpsect the asset data store layer directly, but this is difficult to get at right now. | ||
112 | assetCache.Clear(); | ||
113 | |||
114 | AssetBase eyesBake = scene.AssetService.Get(eyesTextureId.ToString()); | ||
115 | Assert.That(eyesBake, Is.Not.Null); | ||
116 | Assert.That(eyesBake.Temporary, Is.False); | ||
117 | Assert.That(eyesBake.Local, Is.False); | ||
118 | } | ||
68 | } | 119 | } |
69 | } \ No newline at end of file | 120 | } \ No newline at end of file |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs index 51d1d59..cc5d061 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs | |||
@@ -129,15 +129,18 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset | |||
129 | m_Cache = null; | 129 | m_Cache = null; |
130 | } | 130 | } |
131 | 131 | ||
132 | m_log.InfoFormat("[LOCAL ASSET SERVICES CONNECTOR]: Enabled local assets for region {0}", scene.RegionInfo.RegionName); | 132 | m_log.DebugFormat( |
133 | "[LOCAL ASSET SERVICES CONNECTOR]: Enabled connector for region {0}", scene.RegionInfo.RegionName); | ||
133 | 134 | ||
134 | if (m_Cache != null) | 135 | if (m_Cache != null) |
135 | { | 136 | { |
136 | m_log.InfoFormat("[LOCAL ASSET SERVICES CONNECTOR]: Enabled asset caching for region {0}", scene.RegionInfo.RegionName); | 137 | m_log.DebugFormat( |
138 | "[LOCAL ASSET SERVICES CONNECTOR]: Enabled asset caching for region {0}", | ||
139 | scene.RegionInfo.RegionName); | ||
137 | } | 140 | } |
138 | else | 141 | else |
139 | { | 142 | { |
140 | // Short-circuit directly to storage layer | 143 | // Short-circuit directly to storage layer. This ends up storing temporary and local assets. |
141 | // | 144 | // |
142 | scene.UnregisterModuleInterface<IAssetService>(this); | 145 | scene.UnregisterModuleInterface<IAssetService>(this); |
143 | scene.RegisterModuleInterface<IAssetService>(m_AssetService); | 146 | scene.RegisterModuleInterface<IAssetService>(m_AssetService); |
@@ -246,9 +249,21 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset | |||
246 | m_Cache.Cache(asset); | 249 | m_Cache.Cache(asset); |
247 | 250 | ||
248 | if (asset.Temporary || asset.Local) | 251 | if (asset.Temporary || asset.Local) |
252 | { | ||
253 | // m_log.DebugFormat( | ||
254 | // "[LOCAL ASSET SERVICE CONNECTOR]: Returning asset {0} {1} without querying database since status Temporary = {2}, Local = {3}", | ||
255 | // asset.Name, asset.ID, asset.Temporary, asset.Local); | ||
256 | |||
249 | return asset.ID; | 257 | return asset.ID; |
250 | 258 | } | |
251 | return m_AssetService.Store(asset); | 259 | else |
260 | { | ||
261 | // m_log.DebugFormat( | ||
262 | // "[LOCAL ASSET SERVICE CONNECTOR]: Passing {0} {1} on to asset service for storage, status Temporary = {2}, Local = {3}", | ||
263 | // asset.Name, asset.ID, asset.Temporary, asset.Local); | ||
264 | |||
265 | return m_AssetService.Store(asset); | ||
266 | } | ||
252 | } | 267 | } |
253 | 268 | ||
254 | public bool UpdateContent(string id, byte[] data) | 269 | public bool UpdateContent(string id, byte[] data) |
diff --git a/OpenSim/Region/Framework/Interfaces/IAvatarFactory.cs b/OpenSim/Region/Framework/Interfaces/IAvatarFactory.cs index 6817725..4dbddf4 100644 --- a/OpenSim/Region/Framework/Interfaces/IAvatarFactory.cs +++ b/OpenSim/Region/Framework/Interfaces/IAvatarFactory.cs | |||
@@ -25,6 +25,7 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System.Collections.Generic; | ||
28 | using OpenMetaverse; | 29 | using OpenMetaverse; |
29 | using OpenSim.Framework; | 30 | using OpenSim.Framework; |
30 | 31 | ||
@@ -39,7 +40,23 @@ namespace OpenSim.Region.Framework.Interfaces | |||
39 | /// <returns></returns> | 40 | /// <returns></returns> |
40 | bool SendAppearance(UUID agentId); | 41 | bool SendAppearance(UUID agentId); |
41 | 42 | ||
43 | /// <summary> | ||
44 | /// Return the baked texture ids of the given agent. | ||
45 | /// </summary> | ||
46 | /// <param name="agentId"></param> | ||
47 | /// <returns>An empty list if this agent has no baked textures (e.g. because it's a child agent)</returns> | ||
48 | Dictionary<BakeType, Primitive.TextureEntryFace> GetBakedTextureFaces(UUID agentId); | ||
49 | |||
50 | /// <summary> | ||
51 | /// Save the baked textures for the given agent permanently in the asset database. | ||
52 | /// </summary> | ||
53 | /// <remarks> | ||
54 | /// This is used to preserve apperance textures for NPCs | ||
55 | /// </remarks> | ||
56 | /// <param name="agentId"></param> | ||
57 | /// <returns>true if a valid agent was found, false otherwise</returns> | ||
42 | bool SaveBakedTextures(UUID agentId); | 58 | bool SaveBakedTextures(UUID agentId); |
59 | |||
43 | bool ValidateBakedTextureCache(IClientAPI client); | 60 | bool ValidateBakedTextureCache(IClientAPI client); |
44 | void QueueAppearanceSend(UUID agentid); | 61 | void QueueAppearanceSend(UUID agentid); |
45 | void QueueAppearanceSave(UUID agentid); | 62 | void QueueAppearanceSave(UUID agentid); |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 4148d4b..4143d44 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -1695,9 +1695,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1695 | /// </param> | 1695 | /// </param> |
1696 | public void MoveToTarget(Vector3 pos, bool noFly) | 1696 | public void MoveToTarget(Vector3 pos, bool noFly) |
1697 | { | 1697 | { |
1698 | // m_log.DebugFormat( | 1698 | m_log.DebugFormat( |
1699 | // "[SCENE PRESENCE]: Avatar {0} received request to move to position {1} in {2}", | 1699 | "[SCENE PRESENCE]: Avatar {0} received request to move to position {1} in {2}", |
1700 | // Name, pos, m_scene.RegionInfo.RegionName); | 1700 | Name, pos, m_scene.RegionInfo.RegionName); |
1701 | 1701 | ||
1702 | if (pos.X < 0 || pos.X >= Constants.RegionSize | 1702 | if (pos.X < 0 || pos.X >= Constants.RegionSize |
1703 | || pos.Y < 0 || pos.Y >= Constants.RegionSize | 1703 | || pos.Y < 0 || pos.Y >= Constants.RegionSize |
diff --git a/OpenSim/Services/AssetService/AssetService.cs b/OpenSim/Services/AssetService/AssetService.cs index d40aa4b..2ea513b 100644 --- a/OpenSim/Services/AssetService/AssetService.cs +++ b/OpenSim/Services/AssetService/AssetService.cs | |||
@@ -83,7 +83,7 @@ namespace OpenSim.Services.AssetService | |||
83 | 83 | ||
84 | if (assetLoaderEnabled) | 84 | if (assetLoaderEnabled) |
85 | { | 85 | { |
86 | m_log.InfoFormat("[ASSET]: Loading default asset set from {0}", loaderArgs); | 86 | m_log.DebugFormat("[ASSET]: Loading default asset set from {0}", loaderArgs); |
87 | 87 | ||
88 | m_AssetLoader.ForEachDefaultXmlAsset( | 88 | m_AssetLoader.ForEachDefaultXmlAsset( |
89 | loaderArgs, | 89 | loaderArgs, |
@@ -100,7 +100,7 @@ namespace OpenSim.Services.AssetService | |||
100 | }); | 100 | }); |
101 | } | 101 | } |
102 | 102 | ||
103 | m_log.Info("[ASSET SERVICE]: Local asset service enabled"); | 103 | m_log.Debug("[ASSET SERVICE]: Local asset service enabled"); |
104 | } | 104 | } |
105 | } | 105 | } |
106 | } | 106 | } |
@@ -180,6 +180,11 @@ namespace OpenSim.Services.AssetService | |||
180 | // "[ASSET SERVICE]: Storing asset {0} {1}, bytes {2}", asset.Name, asset.FullID, asset.Data.Length); | 180 | // "[ASSET SERVICE]: Storing asset {0} {1}, bytes {2}", asset.Name, asset.FullID, asset.Data.Length); |
181 | m_Database.StoreAsset(asset); | 181 | m_Database.StoreAsset(asset); |
182 | } | 182 | } |
183 | // else | ||
184 | // { | ||
185 | // m_log.DebugFormat( | ||
186 | // "[ASSET SERVICE]: Not storing asset {0} {1}, bytes {2} as it already exists", asset.Name, asset.FullID, asset.Data.Length); | ||
187 | // } | ||
183 | 188 | ||
184 | return asset.ID; | 189 | return asset.ID; |
185 | } | 190 | } |
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; | |||
40 | using OpenSim.Region.Framework.Interfaces; | 40 | using OpenSim.Region.Framework.Interfaces; |
41 | using OpenSim.Region.Framework.Scenes; | 41 | using OpenSim.Region.Framework.Scenes; |
42 | using OpenSim.Region.CoreModules.Avatar.Gods; | 42 | using OpenSim.Region.CoreModules.Avatar.Gods; |
43 | using OpenSim.Region.CoreModules.Asset; | ||
43 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset; | 44 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset; |
44 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Authentication; | 45 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Authentication; |
45 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory; | 46 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory; |
@@ -56,6 +57,11 @@ namespace OpenSim.Tests.Common | |||
56 | /// </summary> | 57 | /// </summary> |
57 | public class SceneHelpers | 58 | public class SceneHelpers |
58 | { | 59 | { |
60 | public static TestScene SetupScene() | ||
61 | { | ||
62 | return SetupScene(null); | ||
63 | } | ||
64 | |||
59 | /// <summary> | 65 | /// <summary> |
60 | /// Set up a test scene | 66 | /// Set up a test scene |
61 | /// </summary> | 67 | /// </summary> |
@@ -63,9 +69,14 @@ namespace OpenSim.Tests.Common | |||
63 | /// Automatically starts service threads, as would the normal runtime. | 69 | /// Automatically starts service threads, as would the normal runtime. |
64 | /// </remarks> | 70 | /// </remarks> |
65 | /// <returns></returns> | 71 | /// <returns></returns> |
66 | public static TestScene SetupScene() | 72 | public static TestScene SetupScene(CoreAssetCache cache) |
73 | { | ||
74 | return SetupScene("Unit test region", UUID.Random(), 1000, 1000, cache); | ||
75 | } | ||
76 | |||
77 | public static TestScene SetupScene(string name, UUID id, uint x, uint y) | ||
67 | { | 78 | { |
68 | return SetupScene("Unit test region", UUID.Random(), 1000, 1000); | 79 | return SetupScene(name, id, x, y, null); |
69 | } | 80 | } |
70 | 81 | ||
71 | /// <summary> | 82 | /// <summary> |
@@ -78,7 +89,7 @@ namespace OpenSim.Tests.Common | |||
78 | /// <param name="y">Y co-ordinate of the region</param> | 89 | /// <param name="y">Y co-ordinate of the region</param> |
79 | /// <param name="cm">This should be the same if simulating two scenes within a standalone</param> | 90 | /// <param name="cm">This should be the same if simulating two scenes within a standalone</param> |
80 | /// <returns></returns> | 91 | /// <returns></returns> |
81 | public static TestScene SetupScene(string name, UUID id, uint x, uint y) | 92 | public static TestScene SetupScene(string name, UUID id, uint x, uint y, CoreAssetCache cache) |
82 | { | 93 | { |
83 | Console.WriteLine("Setting up test scene {0}", name); | 94 | Console.WriteLine("Setting up test scene {0}", name); |
84 | 95 | ||
@@ -103,7 +114,7 @@ namespace OpenSim.Tests.Common | |||
103 | godsModule.Initialise(testScene, new IniConfigSource()); | 114 | godsModule.Initialise(testScene, new IniConfigSource()); |
104 | testScene.AddModule(godsModule.Name, godsModule); | 115 | testScene.AddModule(godsModule.Name, godsModule); |
105 | 116 | ||
106 | LocalAssetServicesConnector assetService = StartAssetService(testScene); | 117 | LocalAssetServicesConnector assetService = StartAssetService(testScene, cache); |
107 | StartAuthenticationService(testScene); | 118 | StartAuthenticationService(testScene); |
108 | LocalInventoryServicesConnector inventoryService = StartInventoryService(testScene); | 119 | LocalInventoryServicesConnector inventoryService = StartInventoryService(testScene); |
109 | StartGridService(testScene); | 120 | StartGridService(testScene); |
@@ -132,7 +143,7 @@ namespace OpenSim.Tests.Common | |||
132 | return testScene; | 143 | return testScene; |
133 | } | 144 | } |
134 | 145 | ||
135 | private static LocalAssetServicesConnector StartAssetService(Scene testScene) | 146 | private static LocalAssetServicesConnector StartAssetService(Scene testScene, CoreAssetCache cache) |
136 | { | 147 | { |
137 | LocalAssetServicesConnector assetService = new LocalAssetServicesConnector(); | 148 | LocalAssetServicesConnector assetService = new LocalAssetServicesConnector(); |
138 | IConfigSource config = new IniConfigSource(); | 149 | IConfigSource config = new IniConfigSource(); |
@@ -145,6 +156,20 @@ namespace OpenSim.Tests.Common | |||
145 | 156 | ||
146 | assetService.Initialise(config); | 157 | assetService.Initialise(config); |
147 | assetService.AddRegion(testScene); | 158 | assetService.AddRegion(testScene); |
159 | |||
160 | if (cache != null) | ||
161 | { | ||
162 | IConfigSource cacheConfig = new IniConfigSource(); | ||
163 | cacheConfig.AddConfig("Modules"); | ||
164 | cacheConfig.Configs["Modules"].Set("AssetCaching", "CoreAssetCache"); | ||
165 | cacheConfig.AddConfig("AssetCache"); | ||
166 | |||
167 | cache.Initialise(cacheConfig); | ||
168 | cache.AddRegion(testScene); | ||
169 | cache.RegionLoaded(testScene); | ||
170 | testScene.AddRegionModule(cache.Name, cache); | ||
171 | } | ||
172 | |||
148 | assetService.RegionLoaded(testScene); | 173 | assetService.RegionLoaded(testScene); |
149 | testScene.AddRegionModule(assetService.Name, assetService); | 174 | testScene.AddRegionModule(assetService.Name, assetService); |
150 | 175 | ||