aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Tests/Common/Setup/AssetHelpers.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Tests/Common/Setup/AssetHelpers.cs')
-rw-r--r--OpenSim/Tests/Common/Setup/AssetHelpers.cs38
1 files changed, 37 insertions, 1 deletions
diff --git a/OpenSim/Tests/Common/Setup/AssetHelpers.cs b/OpenSim/Tests/Common/Setup/AssetHelpers.cs
index ff4423f..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{
@@ -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.
@@ -71,6 +72,35 @@ namespace OpenSim.Tests.Common
71 Encoding.ASCII.GetBytes(SceneObjectSerializer.ToOriginalXmlFormat(sog)), 72 Encoding.ASCII.GetBytes(SceneObjectSerializer.ToOriginalXmlFormat(sog)),
72 sog.OwnerID); 73 sog.OwnerID);
73 } 74 }
75
76 /// <summary>
77 /// Create an asset from the given scene object.
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>
93 /// <param name="assetUuid"></param>
94 /// <param name="coa"></param>
95 /// <returns></returns>
96 public static AssetBase CreateAsset(UUID assetUuid, CoalescedSceneObjects coa)
97 {
98 return CreateAsset(
99 assetUuid,
100 AssetType.Object,
101 Encoding.ASCII.GetBytes(CoalescedSceneObjectsSerializer.ToXml(coa)),
102 coa.CreatorId);
103 }
74 104
75 /// <summary> 105 /// <summary>
76 /// Create an asset from the given data. 106 /// Create an asset from the given data.
@@ -89,5 +119,11 @@ namespace OpenSim.Tests.Common
89 asset.Data = data; 119 asset.Data = data;
90 return asset; 120 return asset;
91 } 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 }
92 } 128 }
93} 129}