diff options
Diffstat (limited to 'OpenSim/Tests/Common/Setup/AssetHelpers.cs')
-rw-r--r-- | OpenSim/Tests/Common/Setup/AssetHelpers.cs | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/OpenSim/Tests/Common/Setup/AssetHelpers.cs b/OpenSim/Tests/Common/Setup/AssetHelpers.cs index af66d7f..d572249 100644 --- a/OpenSim/Tests/Common/Setup/AssetHelpers.cs +++ b/OpenSim/Tests/Common/Setup/AssetHelpers.cs | |||
@@ -30,6 +30,7 @@ using OpenMetaverse; | |||
30 | using OpenSim.Framework; | 30 | using OpenSim.Framework; |
31 | using OpenSim.Region.Framework.Scenes; | 31 | using OpenSim.Region.Framework.Scenes; |
32 | using OpenSim.Region.Framework.Scenes.Serialization; | 32 | using OpenSim.Region.Framework.Scenes.Serialization; |
33 | using OpenSim.Services.Interfaces; | ||
33 | 34 | ||
34 | namespace OpenSim.Tests.Common | 35 | namespace OpenSim.Tests.Common |
35 | { | 36 | { |
@@ -55,7 +56,7 @@ namespace OpenSim.Tests.Common | |||
55 | AssetBase asset = CreateAsset(UUID.Random(), AssetType.Notecard, "hello", creatorId); | 56 | AssetBase asset = CreateAsset(UUID.Random(), AssetType.Notecard, "hello", creatorId); |
56 | scene.AssetService.Store(asset); | 57 | scene.AssetService.Store(asset); |
57 | return asset; | 58 | return asset; |
58 | } | 59 | } |
59 | 60 | ||
60 | /// <summary> | 61 | /// <summary> |
61 | /// Create an asset from the given scene object. | 62 | /// Create an asset from the given scene object. |
@@ -75,6 +76,20 @@ namespace OpenSim.Tests.Common | |||
75 | /// <summary> | 76 | /// <summary> |
76 | /// Create an asset from the given scene object. | 77 | /// Create an asset from the given scene object. |
77 | /// </summary> | 78 | /// </summary> |
79 | /// <param name="assetUuidTailZ"> | ||
80 | /// The hexadecimal last part of the UUID for the asset created. A UUID of the form "00000000-0000-0000-0000-{0:XD12}" | ||
81 | /// will be used. | ||
82 | /// </param> | ||
83 | /// <param name="coa"></param> | ||
84 | /// <returns></returns> | ||
85 | public static AssetBase CreateAsset(int assetUuidTail, CoalescedSceneObjects coa) | ||
86 | { | ||
87 | return CreateAsset(new UUID(string.Format("00000000-0000-0000-0000-{0:X12}", assetUuidTail)), coa); | ||
88 | } | ||
89 | |||
90 | /// <summary> | ||
91 | /// Create an asset from the given scene object. | ||
92 | /// </summary> | ||
78 | /// <param name="assetUuid"></param> | 93 | /// <param name="assetUuid"></param> |
79 | /// <param name="coa"></param> | 94 | /// <param name="coa"></param> |
80 | /// <returns></returns> | 95 | /// <returns></returns> |
@@ -85,7 +100,7 @@ namespace OpenSim.Tests.Common | |||
85 | AssetType.Object, | 100 | AssetType.Object, |
86 | Encoding.ASCII.GetBytes(CoalescedSceneObjectsSerializer.ToXml(coa)), | 101 | Encoding.ASCII.GetBytes(CoalescedSceneObjectsSerializer.ToXml(coa)), |
87 | coa.CreatorId); | 102 | coa.CreatorId); |
88 | } | 103 | } |
89 | 104 | ||
90 | /// <summary> | 105 | /// <summary> |
91 | /// Create an asset from the given data. | 106 | /// Create an asset from the given data. |
@@ -104,5 +119,11 @@ namespace OpenSim.Tests.Common | |||
104 | asset.Data = data; | 119 | asset.Data = data; |
105 | return asset; | 120 | return asset; |
106 | } | 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 | } | ||
107 | } | 128 | } |
108 | } | 129 | } |