From b1b72d7c2f16e7d1e239a0579dc0b28ea9812ed7 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Wed, 25 Feb 2015 20:30:03 +0000 Subject: [PATCH] Reduce coupling in regression test task inventory creation methods to make them usable in tests with no scene present --- .../Tests/AttachmentsModuleTests.cs | 4 +- .../Scenes/Tests/TaskInventoryTests.cs | 8 ++-- .../Scenes/Tests/UuidGathererTests.cs | 39 ++++++++++++++++++- .../Shared/Tests/LSL_ApiHttpTests.cs | 2 +- .../Shared/Tests/LSL_ApiInventoryTests.cs | 10 ++--- .../Shared/Tests/LSL_ApiLinkingTests.cs | 6 +-- .../Shared/Tests/LSL_ApiNotecardTests.cs | 6 +-- .../Shared/Tests/LSL_ApiUserTests.cs | 2 +- .../Shared/Tests/OSSL_ApiAttachmentTests.cs | 12 +++--- .../XEngine/Tests/XEnginePersistenceTests.cs | 2 +- .../Common/Helpers/TaskInventoryHelpers.cs | 36 ++++++++--------- 11 files changed, 82 insertions(+), 45 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs index 5fb995b2f7..f0dc2385e8 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs @@ -546,7 +546,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, sp.UUID, "att-name", 0x10); TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript( - scene, + scene.AssetService, so.RootPart, "scriptItem", "default { attach(key id) { if (id != NULL_KEY) { llSay(0, \"Hello World\"); } } }"); @@ -659,7 +659,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, sp.UUID, "att-name", 0x10); TaskInventoryItem scriptTaskItem = TaskInventoryHelpers.AddScript( - scene, + scene.AssetService, so.RootPart, "scriptItem", "default { attach(key id) { if (id != NULL_KEY) { llSay(0, \"Hello World\"); } } }"); diff --git a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs index 9655d19cef..8ec69740e7 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs @@ -64,7 +64,7 @@ namespace OpenSim.Region.Framework.Tests // Create an object embedded inside the first UUID taskSceneObjectItemId = UUID.Parse("00000000-0000-0000-0000-100000000000"); - TaskInventoryHelpers.AddSceneObject(scene, sop1, "tso", taskSceneObjectItemId, user1.PrincipalID); + TaskInventoryHelpers.AddSceneObject(scene.AssetService, sop1, "tso", taskSceneObjectItemId, user1.PrincipalID); TaskInventoryItem addedItem = sop1.Inventory.GetInventoryItem(taskSceneObjectItemId); Assert.That(addedItem.ItemID, Is.EqualTo(taskSceneObjectItemId)); @@ -88,7 +88,7 @@ namespace OpenSim.Region.Framework.Tests // Create an object embedded inside the first UUID taskSceneObjectItemId = UUID.Parse("00000000-0000-0000-0000-100000000000"); TaskInventoryItem taskSceneObjectItem - = TaskInventoryHelpers.AddSceneObject(scene, sop1, "tso", taskSceneObjectItemId, user1.PrincipalID); + = TaskInventoryHelpers.AddSceneObject(scene.AssetService, sop1, "tso", taskSceneObjectItemId, user1.PrincipalID); scene.AddSceneObject(sog1); @@ -129,7 +129,7 @@ namespace OpenSim.Region.Framework.Tests SceneObjectPart sop1 = sog1.RootPart; TaskInventoryItem sopItem1 = TaskInventoryHelpers.AddNotecard( - scene, sop1, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!"); + scene.AssetService, sop1, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!"); InventoryFolderBase folder = InventoryArchiveUtils.FindFoldersByPath(scene.InventoryService, user1.PrincipalID, "Objects")[0]; @@ -162,7 +162,7 @@ namespace OpenSim.Region.Framework.Tests SceneObjectPart sop1 = sog1.RootPart; TaskInventoryItem sopItem1 = TaskInventoryHelpers.AddNotecard( - scene, sop1, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!"); + scene.AssetService, sop1, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!"); // Perform test string message; diff --git a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs index 4ae27d7b85..0b41039c48 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs @@ -89,7 +89,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests { TestHelpers.InMethod(); // TestHelpers.EnableLogging(); - + UUID ownerId = TestHelpers.ParseTail(0x10); UUID embeddedId = TestHelpers.ParseTail(0x20); UUID secondLevelEmbeddedId = TestHelpers.ParseTail(0x21); @@ -120,5 +120,42 @@ namespace OpenSim.Region.Framework.Scenes.Tests Assert.That(m_uuidGatherer.GatheredUuids.ContainsKey(embeddedId)); Assert.That(m_uuidGatherer.GatheredUuids.ContainsKey(secondLevelEmbeddedId)); } + + [Test] + public void TestTaskItem() + { + TestHelpers.InMethod(); + TestHelpers.EnableLogging(); + + UUID ownerId = TestHelpers.ParseTail(0x10); + UUID embeddedId = TestHelpers.ParseTail(0x20); + UUID secondLevelEmbeddedId = TestHelpers.ParseTail(0x21); + UUID missingEmbeddedId = TestHelpers.ParseTail(0x22); + UUID ncAssetId = TestHelpers.ParseTail(0x30); + + AssetBase ncAsset + = AssetHelpers.CreateNotecardAsset( + ncAssetId, string.Format("Hello{0}World{1}", embeddedId, missingEmbeddedId)); + m_assetService.Store(ncAsset); + + AssetBase embeddedAsset + = AssetHelpers.CreateNotecardAsset(embeddedId, string.Format("{0} We'll meet again.", secondLevelEmbeddedId)); + m_assetService.Store(embeddedAsset); + + AssetBase secondLevelEmbeddedAsset + = AssetHelpers.CreateNotecardAsset(secondLevelEmbeddedId, "Don't know where, don't know when."); + m_assetService.Store(secondLevelEmbeddedAsset); + + m_uuidGatherer.AddForInspection(ncAssetId); + m_uuidGatherer.GatherAll(); + + // foreach (UUID key in m_uuidGatherer.GatheredUuids.Keys) + // System.Console.WriteLine("key : {0}", key); + + Assert.That(m_uuidGatherer.GatheredUuids.Count, Is.EqualTo(3)); + Assert.That(m_uuidGatherer.GatheredUuids.ContainsKey(ncAssetId)); + Assert.That(m_uuidGatherer.GatheredUuids.ContainsKey(embeddedId)); + Assert.That(m_uuidGatherer.GatheredUuids.ContainsKey(secondLevelEmbeddedId)); + } } } \ No newline at end of file diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiHttpTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiHttpTests.cs index 14e45ff7e9..e35de9c762 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiHttpTests.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiHttpTests.cs @@ -100,7 +100,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests SceneHelpers.SetupSceneModules(m_scene, new IniConfigSource(), m_engine, m_urlModule); SceneObjectGroup so = SceneHelpers.AddSceneObject(m_scene); - m_scriptItem = TaskInventoryHelpers.AddScript(m_scene, so.RootPart); + m_scriptItem = TaskInventoryHelpers.AddScript(m_scene.AssetService, so.RootPart); // This is disconnected from the actual script - the mock engine does not set up any LSL_Api atm. // Possibly this could be done and we could obtain it directly from the MockScriptEngine. diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs index 9fd8532bc4..3ff4c6b747 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs @@ -91,7 +91,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests // Create an object embedded inside the first UUID itemId = TestHelpers.ParseTail(0x20); - TaskInventoryHelpers.AddSceneObject(m_scene, so1.RootPart, inventoryItemName, itemId, userId); + TaskInventoryHelpers.AddSceneObject(m_scene.AssetService, so1.RootPart, inventoryItemName, itemId, userId); LSL_Api api = new LSL_Api(); api.Initialize(m_engine, so1.RootPart, null, null); @@ -131,7 +131,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests // Create an object embedded inside the first UUID itemId = TestHelpers.ParseTail(0x20); - TaskInventoryHelpers.AddSceneObject(m_scene, so1.RootPart, inventoryItemName, itemId, user1Id); + TaskInventoryHelpers.AddSceneObject(m_scene.AssetService, so1.RootPart, inventoryItemName, itemId, user1Id); // Create a second object SceneObjectGroup so2 = SceneHelpers.CreateSceneObject(1, user2Id, "so2", 0x100); @@ -188,7 +188,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests // Create an object embedded inside the first UUID itemId = TestHelpers.ParseTail(0x20); - TaskInventoryHelpers.AddSceneObject(m_scene, so1.RootPart, inventoryItemName, itemId, user1Id); + TaskInventoryHelpers.AddSceneObject(m_scene.AssetService, so1.RootPart, inventoryItemName, itemId, user1Id); UserAccountHelpers.CreateUserWithInventory(m_scene, user2Id); @@ -223,7 +223,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests // Create an object embedded inside the first UUID itemId = TestHelpers.ParseTail(0x20); TaskInventoryItem tii - = TaskInventoryHelpers.AddSceneObject(m_scene, so1.RootPart, inventoryItemName, itemId, user1Id); + = TaskInventoryHelpers.AddSceneObject(m_scene.AssetService, so1.RootPart, inventoryItemName, itemId, user1Id); tii.NextPermissions &= ~((uint)PermissionMask.Modify); UserAccountHelpers.CreateUserWithInventory(m_scene, user2Id); @@ -251,7 +251,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests m_scene.AddSceneObject(sourceSo); LSL_Api api = new LSL_Api(); api.Initialize(m_engine, sourceSo.RootPart, null, null); - TaskInventoryHelpers.AddScript(m_scene, sourceSo.RootPart, "script", "Hello World"); + TaskInventoryHelpers.AddScript(m_scene.AssetService, sourceSo.RootPart, "script", "Hello World"); SceneObjectGroup targetSo = SceneHelpers.AddSceneObject(m_scene, "targetSo", user1Id); SceneObjectGroup otherOwnedTargetSo = SceneHelpers.AddSceneObject(m_scene, "otherOwnedTargetSo", user2Id); diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiLinkingTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiLinkingTests.cs index f347869e1c..b6f5e099c2 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiLinkingTests.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiLinkingTests.cs @@ -92,7 +92,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests // FIXME: This should really be a script item (with accompanying script) TaskInventoryItem grp1Item = TaskInventoryHelpers.AddNotecard( - m_scene, grp1.RootPart, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!"); + m_scene.AssetService, grp1.RootPart, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!"); grp1Item.PermsMask |= ScriptBaseClass.PERMISSION_CHANGE_LINKS; SceneObjectGroup grp2 = SceneHelpers.CreateSceneObject(2, ownerId, "grp2-", 0x20); @@ -126,7 +126,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests // FIXME: This should really be a script item (with accompanying script) TaskInventoryItem grp1Item = TaskInventoryHelpers.AddNotecard( - m_scene, grp1.RootPart, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!"); + m_scene.AssetService, grp1.RootPart, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!"); grp1Item.PermsMask |= ScriptBaseClass.PERMISSION_CHANGE_LINKS; @@ -155,7 +155,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests // FIXME: This should really be a script item (with accompanying script) TaskInventoryItem grp1Item = TaskInventoryHelpers.AddNotecard( - m_scene, grp1.RootPart, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!"); + m_scene.AssetService, grp1.RootPart, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!"); grp1Item.PermsMask |= ScriptBaseClass.PERMISSION_CHANGE_LINKS; diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiNotecardTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiNotecardTests.cs index b9028ab385..2ac12cb890 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiNotecardTests.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiNotecardTests.cs @@ -61,7 +61,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests SceneHelpers.SetupSceneModules(m_scene, new IniConfigSource(), m_engine); m_so = SceneHelpers.AddSceneObject(m_scene); - m_scriptItem = TaskInventoryHelpers.AddScript(m_scene, m_so.RootPart); + m_scriptItem = TaskInventoryHelpers.AddScript(m_scene.AssetService, m_so.RootPart); // This is disconnected from the actual script - the mock engine does not set up any LSL_Api atm. // Possibly this could be done and we could obtain it directly from the MockScriptEngine. @@ -77,7 +77,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests string[] ncLines = { "One", "Twoè", "Three" }; TaskInventoryItem ncItem - = TaskInventoryHelpers.AddNotecard(m_scene, m_so.RootPart, "nc", "1", "10", string.Join("\n", ncLines)); + = TaskInventoryHelpers.AddNotecard(m_scene.AssetService, m_so.RootPart, "nc", "1", "10", string.Join("\n", ncLines)); AssertValidNotecardLine(ncItem.Name, 0, ncLines[0]); AssertValidNotecardLine(ncItem.Name, 2, ncLines[2]); @@ -102,7 +102,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests { TestHelpers.InMethod(); - TaskInventoryItem ncItem = TaskInventoryHelpers.AddScript(m_scene, m_so.RootPart, "nc1", "Not important"); + TaskInventoryItem ncItem = TaskInventoryHelpers.AddScript(m_scene.AssetService, m_so.RootPart, "nc1", "Not important"); AssertInValidNotecardLine(ncItem.Name, 0); } diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiUserTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiUserTests.cs index 6424ea1584..40082b5c4d 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiUserTests.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiUserTests.cs @@ -68,7 +68,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(m_scene, userId); SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene).RootPart; - TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene, part); + TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene.AssetService, part); LSL_Api apiGrp1 = new LSL_Api(); apiGrp1.Initialize(m_engine, part, scriptItem, null); diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAttachmentTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAttachmentTests.cs index caba4a4a4c..2fe558a7e6 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAttachmentTests.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAttachmentTests.cs @@ -96,7 +96,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(m_scene, 0x1); ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, ua1.PrincipalID); SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID); - TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene, inWorldObj.RootPart); + TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene.AssetService, inWorldObj.RootPart); new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem, null); OSSL_Api osslApi = new OSSL_Api(); @@ -105,7 +105,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests // SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, ua1.PrincipalID); // Create an object embedded inside the first - TaskInventoryHelpers.AddSceneObject(m_scene, inWorldObj.RootPart, taskInvObjItemName, taskInvObjItemId, ua1.PrincipalID); + TaskInventoryHelpers.AddSceneObject(m_scene.AssetService, inWorldObj.RootPart, taskInvObjItemName, taskInvObjItemId, ua1.PrincipalID); osslApi.osForceAttachToAvatarFromInventory(taskInvObjItemName, (int)attachPoint); @@ -142,7 +142,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(m_scene, 0x1); ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, ua1.PrincipalID); SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID); - TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene, inWorldObj.RootPart); + TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene.AssetService, inWorldObj.RootPart); new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem, null); OSSL_Api osslApi = new OSSL_Api(); @@ -150,7 +150,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests // Create an object embedded inside the first TaskInventoryHelpers.AddNotecard( - m_scene, inWorldObj.RootPart, taskInvObjItemName, taskInvObjItemId, TestHelpers.ParseTail(0x900), "Hello World!"); + m_scene.AssetService, inWorldObj.RootPart, taskInvObjItemName, taskInvObjItemId, TestHelpers.ParseTail(0x900), "Hello World!"); bool exceptionCaught = false; @@ -190,7 +190,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, ua1); SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID); - TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene, inWorldObj.RootPart); + TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene.AssetService, inWorldObj.RootPart); new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem, null); OSSL_Api osslApi = new OSSL_Api(); @@ -198,7 +198,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests // Create an object embedded inside the first TaskInventoryHelpers.AddSceneObject( - m_scene, inWorldObj.RootPart, taskInvObjItemName, taskInvObjItemId, ua1.PrincipalID); + m_scene.AssetService, inWorldObj.RootPart, taskInvObjItemName, taskInvObjItemId, ua1.PrincipalID); ScenePresence sp2 = SceneHelpers.AddScenePresence(m_scene, ua2); diff --git a/OpenSim/Region/ScriptEngine/XEngine/Tests/XEnginePersistenceTests.cs b/OpenSim/Region/ScriptEngine/XEngine/Tests/XEnginePersistenceTests.cs index 5b7e5f7722..2ef405861e 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/Tests/XEnginePersistenceTests.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/Tests/XEnginePersistenceTests.cs @@ -114,7 +114,7 @@ namespace OpenSim.Region.ScriptEngine.Tests SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, sp.UUID, "att-name", 0x10); TaskInventoryHelpers.AddScript( - scene, + scene.AssetService, so.RootPart, "scriptItem", "default { attach(key id) { if (id != NULL_KEY) { llSay(0, \"Hello World\"); } } }"); diff --git a/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs b/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs index b4bd50b745..a15127eeba 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,