From b1b72d7c2f16e7d1e239a0579dc0b28ea9812ed7 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 25 Feb 2015 20:30:03 +0000
Subject: Reduce coupling in regression test task inventory creation methods to
make them usable in tests with no scene present
---
.../Tests/Common/Helpers/TaskInventoryHelpers.cs | 36 +++++++++++-----------
1 file changed, 18 insertions(+), 18 deletions(-)
(limited to 'OpenSim/Tests/Common')
diff --git a/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs b/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs
index b4bd50b..a15127e 100644
--- a/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs
+++ b/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs
@@ -43,7 +43,7 @@ namespace OpenSim.Tests.Common
///
/// Add a notecard item to the given part.
///
- ///
+ ///
///
///
/// UUID or UUID stem
@@ -51,16 +51,16 @@ namespace OpenSim.Tests.Common
/// The tex to put in the notecard.
/// The item that was added
public static TaskInventoryItem AddNotecard(
- Scene scene, SceneObjectPart part, string itemName, string itemIDStem, string assetIDStem, string text)
+ IAssetService assetService, SceneObjectPart part, string itemName, string itemIDStem, string assetIDStem, string text)
{
return AddNotecard(
- scene, part, itemName, TestHelpers.ParseStem(itemIDStem), TestHelpers.ParseStem(assetIDStem), text);
+ assetService, part, itemName, TestHelpers.ParseStem(itemIDStem), TestHelpers.ParseStem(assetIDStem), text);
}
///
/// Add a notecard item to the given part.
///
- ///
+ ///
///
///
///
@@ -68,7 +68,7 @@ namespace OpenSim.Tests.Common
/// The tex to put in the notecard.
/// The item that was added
public static TaskInventoryItem AddNotecard(
- Scene scene, SceneObjectPart part, string itemName, UUID itemID, UUID assetID, string text)
+ IAssetService assetService, SceneObjectPart part, string itemName, UUID itemID, UUID assetID, string text)
{
AssetNotecard nc = new AssetNotecard();
nc.BodyText = text;
@@ -76,7 +76,7 @@ namespace OpenSim.Tests.Common
AssetBase ncAsset
= AssetHelpers.CreateAsset(assetID, AssetType.Notecard, nc.AssetData, UUID.Zero);
- scene.AssetService.Store(ncAsset);
+ assetService.Store(ncAsset);
TaskInventoryItem ncItem
= new TaskInventoryItem
@@ -94,12 +94,12 @@ namespace OpenSim.Tests.Common
/// TODO: Accept input for item and asset IDs to avoid mysterious script failures that try to use any of these
/// functions more than once in a test.
///
- ///
+ ///
///
/// The item that was added
- public static TaskInventoryItem AddScript(Scene scene, SceneObjectPart part)
+ public static TaskInventoryItem AddScript(IAssetService assetService, SceneObjectPart part)
{
- return AddScript(scene, part, "scriptItem", "default { state_entry() { llSay(0, \"Hello World\"); } }");
+ return AddScript(assetService, part, "scriptItem", "default { state_entry() { llSay(0, \"Hello World\"); } }");
}
///
@@ -109,15 +109,15 @@ namespace OpenSim.Tests.Common
/// TODO: Accept input for item and asset IDs so that we have completely replicatable regression tests rather
/// than a random component.
///
- ///
+ ///
///
/// Name of the script to add
/// LSL script source
/// The item that was added
public static TaskInventoryItem AddScript(
- Scene scene, SceneObjectPart part, string scriptName, string scriptSource)
+ IAssetService assetService, SceneObjectPart part, string scriptName, string scriptSource)
{
- return AddScript(scene, part, UUID.Random(), UUID.Random(), scriptName, scriptSource);
+ return AddScript(assetService, part, UUID.Random(), UUID.Random(), scriptName, scriptSource);
}
///
@@ -127,7 +127,7 @@ namespace OpenSim.Tests.Common
/// TODO: Accept input for item and asset IDs so that we have completely replicatable regression tests rather
/// than a random component.
///
- ///
+ ///
///
/// Item UUID for the script
/// Asset UUID for the script
@@ -135,7 +135,7 @@ namespace OpenSim.Tests.Common
/// LSL script source
/// The item that was added
public static TaskInventoryItem AddScript(
- Scene scene, SceneObjectPart part, UUID itemId, UUID assetId, string scriptName, string scriptSource)
+ IAssetService assetService, SceneObjectPart part, UUID itemId, UUID assetId, string scriptName, string scriptSource)
{
AssetScriptText ast = new AssetScriptText();
ast.Source = scriptSource;
@@ -143,7 +143,7 @@ namespace OpenSim.Tests.Common
AssetBase asset
= AssetHelpers.CreateAsset(assetId, AssetType.LSLText, ast.AssetData, UUID.Zero);
- scene.AssetService.Store(asset);
+ assetService.Store(asset);
TaskInventoryItem item
= new TaskInventoryItem
{ Name = scriptName, AssetID = assetId, ItemID = itemId,
@@ -162,17 +162,17 @@ namespace OpenSim.Tests.Common
/// functions more than once in a test.
///
///
- ///
+ ///
///
///
///
///
public static TaskInventoryItem AddSceneObject(
- Scene scene, SceneObjectPart sop, string itemName, UUID id, UUID userId)
+ IAssetService assetService, SceneObjectPart sop, string itemName, UUID id, UUID userId)
{
SceneObjectGroup taskSceneObject = SceneHelpers.CreateSceneObject(1, UUID.Zero);
AssetBase taskSceneObjectAsset = AssetHelpers.CreateAsset(0x10, taskSceneObject);
- scene.AssetService.Store(taskSceneObjectAsset);
+ assetService.Store(taskSceneObjectAsset);
TaskInventoryItem taskSceneObjectItem
= new TaskInventoryItem
{ Name = itemName,
--
cgit v1.1