aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Tests/Common
diff options
context:
space:
mode:
authorMelanie2010-06-12 00:08:20 +0100
committerMelanie2010-06-12 00:08:20 +0100
commit836728e5ded245df7553b6a1b6c279d2e11ee370 (patch)
treed0ff3f9a5cc3747357f36aa09367c5d2eb8a7543 /OpenSim/Tests/Common
parentMerge branch 'master' into careminster-presence-refactor (diff)
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC-836728e5ded245df7553b6a1b6c279d2e11ee370.zip
opensim-SC-836728e5ded245df7553b6a1b6c279d2e11ee370.tar.gz
opensim-SC-836728e5ded245df7553b6a1b6c279d2e11ee370.tar.bz2
opensim-SC-836728e5ded245df7553b6a1b6c279d2e11ee370.tar.xz
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Tests/Common')
-rw-r--r--OpenSim/Tests/Common/Setup/AssetHelpers.cs46
-rw-r--r--OpenSim/Tests/Common/Setup/UserInventoryTestUtils.cs18
2 files changed, 52 insertions, 12 deletions
diff --git a/OpenSim/Tests/Common/Setup/AssetHelpers.cs b/OpenSim/Tests/Common/Setup/AssetHelpers.cs
index 6dc993f..f9a80b0 100644
--- a/OpenSim/Tests/Common/Setup/AssetHelpers.cs
+++ b/OpenSim/Tests/Common/Setup/AssetHelpers.cs
@@ -36,25 +36,29 @@ namespace OpenSim.Tests.Common
36 public class AssetHelpers 36 public class AssetHelpers
37 { 37 {
38 /// <summary> 38 /// <summary>
39 /// Create an asset from the given data 39 /// Create a notecard asset with a random uuid and dummy text.
40 /// </summary> 40 /// </summary>
41 public static AssetBase CreateAsset(UUID assetUuid, AssetType assetType, byte[] data, UUID creatorID) 41 /// <param name="creatorId">/param>
42 /// <returns></returns>
43 public static AssetBase CreateAsset(UUID creatorId)
42 { 44 {
43 AssetBase asset = new AssetBase(assetUuid, assetUuid.ToString(), (sbyte)assetType, creatorID.ToString()); 45 return CreateAsset(UUID.Random(), AssetType.Notecard, "hello", creatorId);
44 asset.Data = data;
45 return asset;
46 } 46 }
47 47
48 /// <summary> 48 /// <summary>
49 /// Create an asset from the given data 49 /// Create and store a notecard asset with a random uuid and dummy text.
50 /// </summary> 50 /// </summary>
51 public static AssetBase CreateAsset(UUID assetUuid, AssetType assetType, string data, UUID creatorID) 51 /// <param name="creatorId">/param>
52 /// <returns></returns>
53 public static AssetBase CreateAsset(Scene scene, UUID creatorId)
52 { 54 {
53 return CreateAsset(assetUuid, assetType, Encoding.ASCII.GetBytes(data), creatorID); 55 AssetBase asset = CreateAsset(UUID.Random(), AssetType.Notecard, "hello", creatorId);
54 } 56 scene.AssetService.Store(asset);
55 57 return asset;
58 }
59
56 /// <summary> 60 /// <summary>
57 /// Create an asset from the given scene object 61 /// Create an asset from the given scene object.
58 /// </summary> 62 /// </summary>
59 /// <param name="assetUuid"></param> 63 /// <param name="assetUuid"></param>
60 /// <param name="sog"></param> 64 /// <param name="sog"></param>
@@ -67,5 +71,23 @@ namespace OpenSim.Tests.Common
67 Encoding.ASCII.GetBytes(SceneObjectSerializer.ToXml2Format(sog)), 71 Encoding.ASCII.GetBytes(SceneObjectSerializer.ToXml2Format(sog)),
68 sog.OwnerID); 72 sog.OwnerID);
69 } 73 }
74
75 /// <summary>
76 /// Create an asset from the given data.
77 /// </summary>
78 public static AssetBase CreateAsset(UUID assetUuid, AssetType assetType, string data, UUID creatorID)
79 {
80 return CreateAsset(assetUuid, assetType, Encoding.ASCII.GetBytes(data), creatorID);
81 }
82
83 /// <summary>
84 /// Create an asset from the given data.
85 /// </summary>
86 public static AssetBase CreateAsset(UUID assetUuid, AssetType assetType, byte[] data, UUID creatorID)
87 {
88 AssetBase asset = new AssetBase(assetUuid, assetUuid.ToString(), (sbyte)assetType, creatorID.ToString());
89 asset.Data = data;
90 return asset;
91 }
70 } 92 }
71} 93}
diff --git a/OpenSim/Tests/Common/Setup/UserInventoryTestUtils.cs b/OpenSim/Tests/Common/Setup/UserInventoryTestUtils.cs
index 7e0c567..c57363a 100644
--- a/OpenSim/Tests/Common/Setup/UserInventoryTestUtils.cs
+++ b/OpenSim/Tests/Common/Setup/UserInventoryTestUtils.cs
@@ -28,6 +28,7 @@
28using System; 28using System;
29using OpenMetaverse; 29using OpenMetaverse;
30using OpenSim.Framework; 30using OpenSim.Framework;
31using OpenSim.Region.Framework.Scenes;
31using OpenSim.Services.Interfaces; 32using OpenSim.Services.Interfaces;
32 33
33namespace OpenSim.Tests.Common 34namespace OpenSim.Tests.Common
@@ -39,6 +40,23 @@ namespace OpenSim.Tests.Common
39 { 40 {
40 public static readonly string PATH_DELIMITER = "/"; 41 public static readonly string PATH_DELIMITER = "/";
41 42
43 public static InventoryItemBase CreateInventoryItem(
44 Scene scene, string itemName, UUID itemId, string folderPath, UUID userId)
45 {
46 InventoryItemBase item = new InventoryItemBase();
47 item.Name = itemName;
48 item.AssetID = AssetHelpers.CreateAsset(scene, userId).FullID;
49 item.ID = itemId;
50
51 // Really quite bad since the objs folder could be moved in the future and confuse the tests
52 InventoryFolderBase objsFolder = scene.InventoryService.GetFolderForType(userId, AssetType.Object);
53
54 item.Folder = objsFolder.ID;
55 scene.AddInventoryItem(userId, item);
56
57 return item;
58 }
59
42 /// <summary> 60 /// <summary>
43 /// Create inventory folders starting from the user's root folder. 61 /// Create inventory folders starting from the user's root folder.
44 /// </summary> 62 /// </summary>