From 1a16a92a62069a50efd618b8fd6cbc0d530c7654 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 11 Jun 2010 21:18:09 +0100
Subject: create inactive test for iar folders/items merged with existing paths
add various helper functions for simplifying test readability
---
OpenSim/Tests/Common/Setup/AssetHelpers.cs | 46 ++++++++++++++++------
.../Tests/Common/Setup/UserInventoryTestUtils.cs | 18 +++++++++
2 files changed, 52 insertions(+), 12 deletions(-)
(limited to 'OpenSim/Tests/Common/Setup')
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
public class AssetHelpers
{
///
- /// Create an asset from the given data
+ /// Create a notecard asset with a random uuid and dummy text.
///
- public static AssetBase CreateAsset(UUID assetUuid, AssetType assetType, byte[] data, UUID creatorID)
+ /// /param>
+ ///
+ public static AssetBase CreateAsset(UUID creatorId)
{
- AssetBase asset = new AssetBase(assetUuid, assetUuid.ToString(), (sbyte)assetType, creatorID.ToString());
- asset.Data = data;
- return asset;
+ return CreateAsset(UUID.Random(), AssetType.Notecard, "hello", creatorId);
}
-
+
///
- /// Create an asset from the given data
+ /// Create and store a notecard asset with a random uuid and dummy text.
///
- public static AssetBase CreateAsset(UUID assetUuid, AssetType assetType, string data, UUID creatorID)
+ /// /param>
+ ///
+ public static AssetBase CreateAsset(Scene scene, UUID creatorId)
{
- return CreateAsset(assetUuid, assetType, Encoding.ASCII.GetBytes(data), creatorID);
- }
-
+ AssetBase asset = CreateAsset(UUID.Random(), AssetType.Notecard, "hello", creatorId);
+ scene.AssetService.Store(asset);
+ return asset;
+ }
+
///
- /// Create an asset from the given scene object
+ /// Create an asset from the given scene object.
///
///
///
@@ -67,5 +71,23 @@ namespace OpenSim.Tests.Common
Encoding.ASCII.GetBytes(SceneObjectSerializer.ToXml2Format(sog)),
sog.OwnerID);
}
+
+ ///
+ /// Create an asset from the given data.
+ ///
+ public static AssetBase CreateAsset(UUID assetUuid, AssetType assetType, string data, UUID creatorID)
+ {
+ return CreateAsset(assetUuid, assetType, Encoding.ASCII.GetBytes(data), creatorID);
+ }
+
+ ///
+ /// Create an asset from the given data.
+ ///
+ public static AssetBase CreateAsset(UUID assetUuid, AssetType assetType, byte[] data, UUID creatorID)
+ {
+ AssetBase asset = new AssetBase(assetUuid, assetUuid.ToString(), (sbyte)assetType, creatorID.ToString());
+ asset.Data = data;
+ return asset;
+ }
}
}
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 @@
using System;
using OpenMetaverse;
using OpenSim.Framework;
+using OpenSim.Region.Framework.Scenes;
using OpenSim.Services.Interfaces;
namespace OpenSim.Tests.Common
@@ -39,6 +40,23 @@ namespace OpenSim.Tests.Common
{
public static readonly string PATH_DELIMITER = "/";
+ public static InventoryItemBase CreateInventoryItem(
+ Scene scene, string itemName, UUID itemId, string folderPath, UUID userId)
+ {
+ InventoryItemBase item = new InventoryItemBase();
+ item.Name = itemName;
+ item.AssetID = AssetHelpers.CreateAsset(scene, userId).FullID;
+ item.ID = itemId;
+
+ // Really quite bad since the objs folder could be moved in the future and confuse the tests
+ InventoryFolderBase objsFolder = scene.InventoryService.GetFolderForType(userId, AssetType.Object);
+
+ item.Folder = objsFolder.ID;
+ scene.AddInventoryItem(userId, item);
+
+ return item;
+ }
+
///
/// Create inventory folders starting from the user's root folder.
///
--
cgit v1.1