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')
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
From 3525195bc9b5fdfd9799411edd452981ef1f4ebd Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 11 Jun 2010 21:52:43 +0100
Subject: Allow IInventoryService.GetFolder(folderId, userId) as well as
GetFolder(InventoryFolderBase folder)
This involves no wire changes since the methods often just construct an InventoryFolderBase under the hood.
This is in line with other methods that alraedy allow requests via uuid
---
OpenSim/Tests/Common/Mock/MockInventoryService.cs | 5 +++++
1 file changed, 5 insertions(+)
(limited to 'OpenSim/Tests/Common')
diff --git a/OpenSim/Tests/Common/Mock/MockInventoryService.cs b/OpenSim/Tests/Common/Mock/MockInventoryService.cs
index 1ea4bc1..fc27487 100644
--- a/OpenSim/Tests/Common/Mock/MockInventoryService.cs
+++ b/OpenSim/Tests/Common/Mock/MockInventoryService.cs
@@ -162,6 +162,11 @@ namespace OpenSim.Tests.Common.Mock
{
return null;
}
+
+ public InventoryFolderBase GetFolder(UUID folderId, UUID userId)
+ {
+ return null;
+ }
public InventoryFolderBase GetFolder(InventoryFolderBase folder)
{
--
cgit v1.1
From 0dce4f1997c57cbdf6bc1f322182c318d3838e40 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 11 Jun 2010 22:11:33 +0100
Subject: Revert "Allow IInventoryService.GetFolder(folderId, userId) as well
as GetFolder(InventoryFolderBase folder)"
This reverts commit 3525195bc9b5fdfd9799411edd452981ef1f4ebd.
---
OpenSim/Tests/Common/Mock/MockInventoryService.cs | 5 -----
1 file changed, 5 deletions(-)
(limited to 'OpenSim/Tests/Common')
diff --git a/OpenSim/Tests/Common/Mock/MockInventoryService.cs b/OpenSim/Tests/Common/Mock/MockInventoryService.cs
index fc27487..1ea4bc1 100644
--- a/OpenSim/Tests/Common/Mock/MockInventoryService.cs
+++ b/OpenSim/Tests/Common/Mock/MockInventoryService.cs
@@ -162,11 +162,6 @@ namespace OpenSim.Tests.Common.Mock
{
return null;
}
-
- public InventoryFolderBase GetFolder(UUID folderId, UUID userId)
- {
- return null;
- }
public InventoryFolderBase GetFolder(InventoryFolderBase folder)
{
--
cgit v1.1