aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs19
-rw-r--r--OpenSim/Services/Interfaces/IAssetService.cs46
-rw-r--r--OpenSim/Tests/Common/Mock/TestAssetService.cs14
3 files changed, 53 insertions, 26 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
index 2169e36..470a386 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
@@ -74,7 +74,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
74 /// <summary> 74 /// <summary>
75 /// Test saving a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet). 75 /// Test saving a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet).
76 /// </summary> 76 /// </summary>
77 //[Test] 77 [Test]
78 public void TestSaveIarV0_1() 78 public void TestSaveIarV0_1()
79 { 79 {
80 TestHelper.InMethod(); 80 TestHelper.InMethod();
@@ -82,7 +82,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
82 82
83 InventoryArchiverModule archiverModule = new InventoryArchiverModule(); 83 InventoryArchiverModule archiverModule = new InventoryArchiverModule();
84 84
85 Scene scene = SceneSetupHelpers.SetupScene(""); 85 Scene scene = SceneSetupHelpers.SetupScene("Inventory");
86 SceneSetupHelpers.SetupSceneModules(scene, archiverModule); 86 SceneSetupHelpers.SetupSceneModules(scene, archiverModule);
87 CommunicationsManager cm = scene.CommsManager; 87 CommunicationsManager cm = scene.CommsManager;
88 88
@@ -222,7 +222,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
222 /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where 222 /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where
223 /// an account exists with the creator name. 223 /// an account exists with the creator name.
224 /// </summary> 224 /// </summary>
225 //[Test] 225 [Test]
226 public void TestLoadIarV0_1ExistingUsers() 226 public void TestLoadIarV0_1ExistingUsers()
227 { 227 {
228 TestHelper.InMethod(); 228 TestHelper.InMethod();
@@ -262,7 +262,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
262 InventoryArchiverModule archiverModule = new InventoryArchiverModule(); 262 InventoryArchiverModule archiverModule = new InventoryArchiverModule();
263 263
264 // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene 264 // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene
265 Scene scene = SceneSetupHelpers.SetupScene(); 265 Scene scene = SceneSetupHelpers.SetupScene("inventory");
266 IUserAdminService userAdminService = scene.CommsManager.UserAdminService; 266 IUserAdminService userAdminService = scene.CommsManager.UserAdminService;
267 267
268 SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); 268 SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
@@ -276,16 +276,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
276 276
277 CachedUserInfo userInfo 277 CachedUserInfo userInfo
278 = scene.CommsManager.UserProfileCacheService.GetUserDetails(userFirstName, userLastName); 278 = scene.CommsManager.UserProfileCacheService.GetUserDetails(userFirstName, userLastName);
279 //userInfo.FetchInventory(); 279
280 /*
281 for (int i = 0 ; i < 50 ; i++)
282 {
283 if (userInfo.HasReceivedInventory == true)
284 break;
285 Thread.Sleep(200);
286 }
287 Assert.That(userInfo.HasReceivedInventory, Is.True, "FetchInventory timed out (10 seconds)");
288 */
289 InventoryItemBase foundItem = userInfo.RootFolder.FindItemByPath(itemName); 280 InventoryItemBase foundItem = userInfo.RootFolder.FindItemByPath(itemName);
290 Assert.That(foundItem, Is.Not.Null, "Didn't find loaded item"); 281 Assert.That(foundItem, Is.Not.Null, "Didn't find loaded item");
291 Assert.That( 282 Assert.That(
diff --git a/OpenSim/Services/Interfaces/IAssetService.cs b/OpenSim/Services/Interfaces/IAssetService.cs
index ec8a71b..6dfe78d 100644
--- a/OpenSim/Services/Interfaces/IAssetService.cs
+++ b/OpenSim/Services/Interfaces/IAssetService.cs
@@ -34,25 +34,53 @@ namespace OpenSim.Services.Interfaces
34 34
35 public interface IAssetService 35 public interface IAssetService
36 { 36 {
37 // Three different ways to retrieve an asset 37 /// <summary>
38 // 38 /// Get an asset synchronously.
39 /// </summary>
40 /// <param name="id"></param>
41 /// <returns></returns>
39 AssetBase Get(string id); 42 AssetBase Get(string id);
43
44 /// <summary>
45 /// Get an asset's metadata
46 /// </summary>
47 /// <param name="id"></param>
48 /// <returns></returns>
40 AssetMetadata GetMetadata(string id); 49 AssetMetadata GetMetadata(string id);
50
41 byte[] GetData(string id); 51 byte[] GetData(string id);
42 52
53 /// <summary>
54 /// Get an asset asynchronously
55 /// </summary>
56 /// <param name="id">The asset id</param>
57 /// <param name="sender">Represents the requester. Passed back via the handler</param>
58 /// <param name="handler">The handler to call back once the asset has been retrieved</param>
59 /// <returns>True if the id was parseable, false otherwise</returns>
43 bool Get(string id, Object sender, AssetRetrieved handler); 60 bool Get(string id, Object sender, AssetRetrieved handler);
44 61
45 // Creates a new asset 62 /// <summary>
46 // Returns a random ID if none is passed into it 63 /// Creates a new asset
47 // 64 /// </summary>
65 /// Returns a random ID if none is passed into it
66 /// <param name="asset"></param>
67 /// <returns></returns>
48 string Store(AssetBase asset); 68 string Store(AssetBase asset);
49 69
50 // Attachments and bare scripts need this!! 70 /// <summary>
51 // 71 /// Update an asset's content
72 /// </summary>
73 /// Attachments and bare scripts need this!!
74 /// <param name="id"> </param>
75 /// <param name="data"></param>
76 /// <returns></returns>
52 bool UpdateContent(string id, byte[] data); 77 bool UpdateContent(string id, byte[] data);
53 78
54 // Kill an asset 79 /// <summary>
55 // 80 /// Delete an asset
81 /// </summary>
82 /// <param name="id"></param>
83 /// <returns></returns>
56 bool Delete(string id); 84 bool Delete(string id);
57 } 85 }
58} 86}
diff --git a/OpenSim/Tests/Common/Mock/TestAssetService.cs b/OpenSim/Tests/Common/Mock/TestAssetService.cs
index 5f1184b..81f123a 100644
--- a/OpenSim/Tests/Common/Mock/TestAssetService.cs
+++ b/OpenSim/Tests/Common/Mock/TestAssetService.cs
@@ -45,7 +45,13 @@ namespace OpenSim.Tests.Common.Mock
45 45
46 public AssetBase Get(string id) 46 public AssetBase Get(string id)
47 { 47 {
48 return Assets[ id ]; 48 AssetBase asset;
49 if (Assets.ContainsKey(id))
50 asset = Assets[id];
51 else
52 asset = null;
53
54 return asset;
49 } 55 }
50 56
51 public AssetMetadata GetMetadata(string id) 57 public AssetMetadata GetMetadata(string id)
@@ -59,8 +65,10 @@ namespace OpenSim.Tests.Common.Mock
59 } 65 }
60 66
61 public bool Get(string id, object sender, AssetRetrieved handler) 67 public bool Get(string id, object sender, AssetRetrieved handler)
62 { 68 {
63 throw new NotImplementedException(); 69 handler(id, sender, Get(id));
70
71 return true;
64 } 72 }
65 73
66 public string Store(AssetBase asset) 74 public string Store(AssetBase asset)