aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Tests/Common
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Tests/Common')
-rw-r--r--OpenSim/Tests/Common/Mock/MockAssetService.cs22
-rw-r--r--OpenSim/Tests/Common/Setup/AssetHelpers.cs7
-rw-r--r--OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs7
3 files changed, 30 insertions, 6 deletions
diff --git a/OpenSim/Tests/Common/Mock/MockAssetService.cs b/OpenSim/Tests/Common/Mock/MockAssetService.cs
index 4118308..9d7c5e2 100644
--- a/OpenSim/Tests/Common/Mock/MockAssetService.cs
+++ b/OpenSim/Tests/Common/Mock/MockAssetService.cs
@@ -54,13 +54,19 @@ namespace OpenSim.Tests.Common.Mock
54 54
55 public AssetBase Get(string id) 55 public AssetBase Get(string id)
56 { 56 {
57 m_log.DebugFormat("[MOCK ASSET SERVICE]: Getting asset with id {0}", id); 57// m_log.DebugFormat("[MOCK ASSET SERVICE]: Getting asset with id {0}", id);
58 58
59 AssetBase asset; 59 AssetBase asset;
60 if (Assets.ContainsKey(id)) 60 if (Assets.ContainsKey(id))
61 {
61 asset = Assets[id]; 62 asset = Assets[id];
63// m_log.DebugFormat(
64// "[MOCK ASSET SERVICE]: Got asset {0} {1}, bytes {2}", asset.Name, asset.ID, asset.Data.Length);
65 }
62 else 66 else
63 asset = null; 67 {
68 asset = null;
69 }
64 70
65 return asset; 71 return asset;
66 } 72 }
@@ -77,7 +83,14 @@ namespace OpenSim.Tests.Common.Mock
77 83
78 public byte[] GetData(string id) 84 public byte[] GetData(string id)
79 { 85 {
80 throw new System.NotImplementedException(); 86// m_log.DebugFormat("[MOCK ASSET SERVICE]: Requesting data for asset {0}", id);
87
88 AssetBase asset = Get(id);
89
90 if (asset == null)
91 return null;
92 else
93 return asset.Data;
81 } 94 }
82 95
83 public bool Get(string id, object sender, AssetRetrieved handler) 96 public bool Get(string id, object sender, AssetRetrieved handler)
@@ -89,7 +102,8 @@ namespace OpenSim.Tests.Common.Mock
89 102
90 public string Store(AssetBase asset) 103 public string Store(AssetBase asset)
91 { 104 {
92 m_log.DebugFormat("[MOCK ASSET SERVICE]: Storing asset {0}", asset.ID); 105// m_log.DebugFormat(
106// "[MOCK ASSET SERVICE]: Storing asset {0} {1}, bytes {2}", asset.Name, asset.ID, asset.Data.Length);
93 107
94 Assets[asset.ID] = asset; 108 Assets[asset.ID] = asset;
95 109
diff --git a/OpenSim/Tests/Common/Setup/AssetHelpers.cs b/OpenSim/Tests/Common/Setup/AssetHelpers.cs
index 971c6bc..d572249 100644
--- a/OpenSim/Tests/Common/Setup/AssetHelpers.cs
+++ b/OpenSim/Tests/Common/Setup/AssetHelpers.cs
@@ -30,6 +30,7 @@ using OpenMetaverse;
30using OpenSim.Framework; 30using OpenSim.Framework;
31using OpenSim.Region.Framework.Scenes; 31using OpenSim.Region.Framework.Scenes;
32using OpenSim.Region.Framework.Scenes.Serialization; 32using OpenSim.Region.Framework.Scenes.Serialization;
33using OpenSim.Services.Interfaces;
33 34
34namespace OpenSim.Tests.Common 35namespace OpenSim.Tests.Common
35{ 36{
@@ -118,5 +119,11 @@ namespace OpenSim.Tests.Common
118 asset.Data = data; 119 asset.Data = data;
119 return asset; 120 return asset;
120 } 121 }
122
123 public static string ReadAssetAsString(IAssetService assetService, UUID uuid)
124 {
125 byte[] assetData = assetService.GetData(uuid.ToString());
126 return Encoding.ASCII.GetString(assetData);
127 }
121 } 128 }
122} 129}
diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
index eb08b62..837f4e2 100644
--- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
+++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
@@ -168,14 +168,17 @@ namespace OpenSim.Tests.Common.Setup
168 { 168 {
169 LocalAssetServicesConnector assetService = new LocalAssetServicesConnector(); 169 LocalAssetServicesConnector assetService = new LocalAssetServicesConnector();
170 IConfigSource config = new IniConfigSource(); 170 IConfigSource config = new IniConfigSource();
171 config.AddConfig("Modules"); 171 config.AddConfig("Modules");
172 config.AddConfig("AssetService");
173 config.Configs["Modules"].Set("AssetServices", "LocalAssetServicesConnector"); 172 config.Configs["Modules"].Set("AssetServices", "LocalAssetServicesConnector");
173
174 config.AddConfig("AssetService");
174 if (real) 175 if (real)
175 config.Configs["AssetService"].Set("LocalServiceModule", "OpenSim.Services.AssetService.dll:AssetService"); 176 config.Configs["AssetService"].Set("LocalServiceModule", "OpenSim.Services.AssetService.dll:AssetService");
176 else 177 else
177 config.Configs["AssetService"].Set("LocalServiceModule", "OpenSim.Tests.Common.dll:MockAssetService"); 178 config.Configs["AssetService"].Set("LocalServiceModule", "OpenSim.Tests.Common.dll:MockAssetService");
179
178 config.Configs["AssetService"].Set("StorageProvider", "OpenSim.Tests.Common.dll"); 180 config.Configs["AssetService"].Set("StorageProvider", "OpenSim.Tests.Common.dll");
181
179 assetService.Initialise(config); 182 assetService.Initialise(config);
180 assetService.AddRegion(testScene); 183 assetService.AddRegion(testScene);
181 assetService.RegionLoaded(testScene); 184 assetService.RegionLoaded(testScene);