diff options
author | Justin Clark-Casey (justincc) | 2015-02-25 20:30:03 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2015-02-25 20:30:03 +0000 |
commit | b1b72d7c2f16e7d1e239a0579dc0b28ea9812ed7 (patch) | |
tree | e271b19776ad3a956730a947af3764de2c645431 | |
parent | On shutdown (job engine stop), don't allow the ObjectDisposedException on Blo... (diff) | |
download | opensim-SC-b1b72d7c2f16e7d1e239a0579dc0b28ea9812ed7.zip opensim-SC-b1b72d7c2f16e7d1e239a0579dc0b28ea9812ed7.tar.gz opensim-SC-b1b72d7c2f16e7d1e239a0579dc0b28ea9812ed7.tar.bz2 opensim-SC-b1b72d7c2f16e7d1e239a0579dc0b28ea9812ed7.tar.xz |
Reduce coupling in regression test task inventory creation methods to make them usable in tests with no scene present
Diffstat (limited to '')
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 5fb995b..f0dc238 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 | |||
546 | SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, sp.UUID, "att-name", 0x10); | 546 | SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, sp.UUID, "att-name", 0x10); |
547 | TaskInventoryItem scriptItem | 547 | TaskInventoryItem scriptItem |
548 | = TaskInventoryHelpers.AddScript( | 548 | = TaskInventoryHelpers.AddScript( |
549 | scene, | 549 | scene.AssetService, |
550 | so.RootPart, | 550 | so.RootPart, |
551 | "scriptItem", | 551 | "scriptItem", |
552 | "default { attach(key id) { if (id != NULL_KEY) { llSay(0, \"Hello World\"); } } }"); | 552 | "default { attach(key id) { if (id != NULL_KEY) { llSay(0, \"Hello World\"); } } }"); |
@@ -659,7 +659,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
659 | SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, sp.UUID, "att-name", 0x10); | 659 | SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, sp.UUID, "att-name", 0x10); |
660 | TaskInventoryItem scriptTaskItem | 660 | TaskInventoryItem scriptTaskItem |
661 | = TaskInventoryHelpers.AddScript( | 661 | = TaskInventoryHelpers.AddScript( |
662 | scene, | 662 | scene.AssetService, |
663 | so.RootPart, | 663 | so.RootPart, |
664 | "scriptItem", | 664 | "scriptItem", |
665 | "default { attach(key id) { if (id != NULL_KEY) { llSay(0, \"Hello World\"); } } }"); | 665 | "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 9655d19..8ec6974 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 | |||
64 | 64 | ||
65 | // Create an object embedded inside the first | 65 | // Create an object embedded inside the first |
66 | UUID taskSceneObjectItemId = UUID.Parse("00000000-0000-0000-0000-100000000000"); | 66 | UUID taskSceneObjectItemId = UUID.Parse("00000000-0000-0000-0000-100000000000"); |
67 | TaskInventoryHelpers.AddSceneObject(scene, sop1, "tso", taskSceneObjectItemId, user1.PrincipalID); | 67 | TaskInventoryHelpers.AddSceneObject(scene.AssetService, sop1, "tso", taskSceneObjectItemId, user1.PrincipalID); |
68 | 68 | ||
69 | TaskInventoryItem addedItem = sop1.Inventory.GetInventoryItem(taskSceneObjectItemId); | 69 | TaskInventoryItem addedItem = sop1.Inventory.GetInventoryItem(taskSceneObjectItemId); |
70 | Assert.That(addedItem.ItemID, Is.EqualTo(taskSceneObjectItemId)); | 70 | Assert.That(addedItem.ItemID, Is.EqualTo(taskSceneObjectItemId)); |
@@ -88,7 +88,7 @@ namespace OpenSim.Region.Framework.Tests | |||
88 | // Create an object embedded inside the first | 88 | // Create an object embedded inside the first |
89 | UUID taskSceneObjectItemId = UUID.Parse("00000000-0000-0000-0000-100000000000"); | 89 | UUID taskSceneObjectItemId = UUID.Parse("00000000-0000-0000-0000-100000000000"); |
90 | TaskInventoryItem taskSceneObjectItem | 90 | TaskInventoryItem taskSceneObjectItem |
91 | = TaskInventoryHelpers.AddSceneObject(scene, sop1, "tso", taskSceneObjectItemId, user1.PrincipalID); | 91 | = TaskInventoryHelpers.AddSceneObject(scene.AssetService, sop1, "tso", taskSceneObjectItemId, user1.PrincipalID); |
92 | 92 | ||
93 | scene.AddSceneObject(sog1); | 93 | scene.AddSceneObject(sog1); |
94 | 94 | ||
@@ -129,7 +129,7 @@ namespace OpenSim.Region.Framework.Tests | |||
129 | SceneObjectPart sop1 = sog1.RootPart; | 129 | SceneObjectPart sop1 = sog1.RootPart; |
130 | TaskInventoryItem sopItem1 | 130 | TaskInventoryItem sopItem1 |
131 | = TaskInventoryHelpers.AddNotecard( | 131 | = TaskInventoryHelpers.AddNotecard( |
132 | scene, sop1, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!"); | 132 | scene.AssetService, sop1, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!"); |
133 | 133 | ||
134 | InventoryFolderBase folder | 134 | InventoryFolderBase folder |
135 | = InventoryArchiveUtils.FindFoldersByPath(scene.InventoryService, user1.PrincipalID, "Objects")[0]; | 135 | = InventoryArchiveUtils.FindFoldersByPath(scene.InventoryService, user1.PrincipalID, "Objects")[0]; |
@@ -162,7 +162,7 @@ namespace OpenSim.Region.Framework.Tests | |||
162 | SceneObjectPart sop1 = sog1.RootPart; | 162 | SceneObjectPart sop1 = sog1.RootPart; |
163 | TaskInventoryItem sopItem1 | 163 | TaskInventoryItem sopItem1 |
164 | = TaskInventoryHelpers.AddNotecard( | 164 | = TaskInventoryHelpers.AddNotecard( |
165 | scene, sop1, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!"); | 165 | scene.AssetService, sop1, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!"); |
166 | 166 | ||
167 | // Perform test | 167 | // Perform test |
168 | string message; | 168 | string message; |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs index 4ae27d7..0b41039 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 | |||
89 | { | 89 | { |
90 | TestHelpers.InMethod(); | 90 | TestHelpers.InMethod(); |
91 | // TestHelpers.EnableLogging(); | 91 | // TestHelpers.EnableLogging(); |
92 | 92 | ||
93 | UUID ownerId = TestHelpers.ParseTail(0x10); | 93 | UUID ownerId = TestHelpers.ParseTail(0x10); |
94 | UUID embeddedId = TestHelpers.ParseTail(0x20); | 94 | UUID embeddedId = TestHelpers.ParseTail(0x20); |
95 | UUID secondLevelEmbeddedId = TestHelpers.ParseTail(0x21); | 95 | UUID secondLevelEmbeddedId = TestHelpers.ParseTail(0x21); |
@@ -120,5 +120,42 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
120 | Assert.That(m_uuidGatherer.GatheredUuids.ContainsKey(embeddedId)); | 120 | Assert.That(m_uuidGatherer.GatheredUuids.ContainsKey(embeddedId)); |
121 | Assert.That(m_uuidGatherer.GatheredUuids.ContainsKey(secondLevelEmbeddedId)); | 121 | Assert.That(m_uuidGatherer.GatheredUuids.ContainsKey(secondLevelEmbeddedId)); |
122 | } | 122 | } |
123 | |||
124 | [Test] | ||
125 | public void TestTaskItem() | ||
126 | { | ||
127 | TestHelpers.InMethod(); | ||
128 | TestHelpers.EnableLogging(); | ||
129 | |||
130 | UUID ownerId = TestHelpers.ParseTail(0x10); | ||
131 | UUID embeddedId = TestHelpers.ParseTail(0x20); | ||
132 | UUID secondLevelEmbeddedId = TestHelpers.ParseTail(0x21); | ||
133 | UUID missingEmbeddedId = TestHelpers.ParseTail(0x22); | ||
134 | UUID ncAssetId = TestHelpers.ParseTail(0x30); | ||
135 | |||
136 | AssetBase ncAsset | ||
137 | = AssetHelpers.CreateNotecardAsset( | ||
138 | ncAssetId, string.Format("Hello{0}World{1}", embeddedId, missingEmbeddedId)); | ||
139 | m_assetService.Store(ncAsset); | ||
140 | |||
141 | AssetBase embeddedAsset | ||
142 | = AssetHelpers.CreateNotecardAsset(embeddedId, string.Format("{0} We'll meet again.", secondLevelEmbeddedId)); | ||
143 | m_assetService.Store(embeddedAsset); | ||
144 | |||
145 | AssetBase secondLevelEmbeddedAsset | ||
146 | = AssetHelpers.CreateNotecardAsset(secondLevelEmbeddedId, "Don't know where, don't know when."); | ||
147 | m_assetService.Store(secondLevelEmbeddedAsset); | ||
148 | |||
149 | m_uuidGatherer.AddForInspection(ncAssetId); | ||
150 | m_uuidGatherer.GatherAll(); | ||
151 | |||
152 | // foreach (UUID key in m_uuidGatherer.GatheredUuids.Keys) | ||
153 | // System.Console.WriteLine("key : {0}", key); | ||
154 | |||
155 | Assert.That(m_uuidGatherer.GatheredUuids.Count, Is.EqualTo(3)); | ||
156 | Assert.That(m_uuidGatherer.GatheredUuids.ContainsKey(ncAssetId)); | ||
157 | Assert.That(m_uuidGatherer.GatheredUuids.ContainsKey(embeddedId)); | ||
158 | Assert.That(m_uuidGatherer.GatheredUuids.ContainsKey(secondLevelEmbeddedId)); | ||
159 | } | ||
123 | } | 160 | } |
124 | } \ No newline at end of file | 161 | } \ 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 14e45ff..e35de9c 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 | |||
100 | SceneHelpers.SetupSceneModules(m_scene, new IniConfigSource(), m_engine, m_urlModule); | 100 | SceneHelpers.SetupSceneModules(m_scene, new IniConfigSource(), m_engine, m_urlModule); |
101 | 101 | ||
102 | SceneObjectGroup so = SceneHelpers.AddSceneObject(m_scene); | 102 | SceneObjectGroup so = SceneHelpers.AddSceneObject(m_scene); |
103 | m_scriptItem = TaskInventoryHelpers.AddScript(m_scene, so.RootPart); | 103 | m_scriptItem = TaskInventoryHelpers.AddScript(m_scene.AssetService, so.RootPart); |
104 | 104 | ||
105 | // This is disconnected from the actual script - the mock engine does not set up any LSL_Api atm. | 105 | // This is disconnected from the actual script - the mock engine does not set up any LSL_Api atm. |
106 | // Possibly this could be done and we could obtain it directly from the MockScriptEngine. | 106 | // 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 9fd8532..3ff4c6b 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 | |||
91 | 91 | ||
92 | // Create an object embedded inside the first | 92 | // Create an object embedded inside the first |
93 | UUID itemId = TestHelpers.ParseTail(0x20); | 93 | UUID itemId = TestHelpers.ParseTail(0x20); |
94 | TaskInventoryHelpers.AddSceneObject(m_scene, so1.RootPart, inventoryItemName, itemId, userId); | 94 | TaskInventoryHelpers.AddSceneObject(m_scene.AssetService, so1.RootPart, inventoryItemName, itemId, userId); |
95 | 95 | ||
96 | LSL_Api api = new LSL_Api(); | 96 | LSL_Api api = new LSL_Api(); |
97 | api.Initialize(m_engine, so1.RootPart, null, null); | 97 | api.Initialize(m_engine, so1.RootPart, null, null); |
@@ -131,7 +131,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
131 | 131 | ||
132 | // Create an object embedded inside the first | 132 | // Create an object embedded inside the first |
133 | UUID itemId = TestHelpers.ParseTail(0x20); | 133 | UUID itemId = TestHelpers.ParseTail(0x20); |
134 | TaskInventoryHelpers.AddSceneObject(m_scene, so1.RootPart, inventoryItemName, itemId, user1Id); | 134 | TaskInventoryHelpers.AddSceneObject(m_scene.AssetService, so1.RootPart, inventoryItemName, itemId, user1Id); |
135 | 135 | ||
136 | // Create a second object | 136 | // Create a second object |
137 | SceneObjectGroup so2 = SceneHelpers.CreateSceneObject(1, user2Id, "so2", 0x100); | 137 | SceneObjectGroup so2 = SceneHelpers.CreateSceneObject(1, user2Id, "so2", 0x100); |
@@ -188,7 +188,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
188 | 188 | ||
189 | // Create an object embedded inside the first | 189 | // Create an object embedded inside the first |
190 | UUID itemId = TestHelpers.ParseTail(0x20); | 190 | UUID itemId = TestHelpers.ParseTail(0x20); |
191 | TaskInventoryHelpers.AddSceneObject(m_scene, so1.RootPart, inventoryItemName, itemId, user1Id); | 191 | TaskInventoryHelpers.AddSceneObject(m_scene.AssetService, so1.RootPart, inventoryItemName, itemId, user1Id); |
192 | 192 | ||
193 | UserAccountHelpers.CreateUserWithInventory(m_scene, user2Id); | 193 | UserAccountHelpers.CreateUserWithInventory(m_scene, user2Id); |
194 | 194 | ||
@@ -223,7 +223,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
223 | // Create an object embedded inside the first | 223 | // Create an object embedded inside the first |
224 | UUID itemId = TestHelpers.ParseTail(0x20); | 224 | UUID itemId = TestHelpers.ParseTail(0x20); |
225 | TaskInventoryItem tii | 225 | TaskInventoryItem tii |
226 | = TaskInventoryHelpers.AddSceneObject(m_scene, so1.RootPart, inventoryItemName, itemId, user1Id); | 226 | = TaskInventoryHelpers.AddSceneObject(m_scene.AssetService, so1.RootPart, inventoryItemName, itemId, user1Id); |
227 | tii.NextPermissions &= ~((uint)PermissionMask.Modify); | 227 | tii.NextPermissions &= ~((uint)PermissionMask.Modify); |
228 | 228 | ||
229 | UserAccountHelpers.CreateUserWithInventory(m_scene, user2Id); | 229 | UserAccountHelpers.CreateUserWithInventory(m_scene, user2Id); |
@@ -251,7 +251,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
251 | m_scene.AddSceneObject(sourceSo); | 251 | m_scene.AddSceneObject(sourceSo); |
252 | LSL_Api api = new LSL_Api(); | 252 | LSL_Api api = new LSL_Api(); |
253 | api.Initialize(m_engine, sourceSo.RootPart, null, null); | 253 | api.Initialize(m_engine, sourceSo.RootPart, null, null); |
254 | TaskInventoryHelpers.AddScript(m_scene, sourceSo.RootPart, "script", "Hello World"); | 254 | TaskInventoryHelpers.AddScript(m_scene.AssetService, sourceSo.RootPart, "script", "Hello World"); |
255 | 255 | ||
256 | SceneObjectGroup targetSo = SceneHelpers.AddSceneObject(m_scene, "targetSo", user1Id); | 256 | SceneObjectGroup targetSo = SceneHelpers.AddSceneObject(m_scene, "targetSo", user1Id); |
257 | SceneObjectGroup otherOwnedTargetSo = SceneHelpers.AddSceneObject(m_scene, "otherOwnedTargetSo", user2Id); | 257 | 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 f347869..b6f5e09 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 | |||
92 | // FIXME: This should really be a script item (with accompanying script) | 92 | // FIXME: This should really be a script item (with accompanying script) |
93 | TaskInventoryItem grp1Item | 93 | TaskInventoryItem grp1Item |
94 | = TaskInventoryHelpers.AddNotecard( | 94 | = TaskInventoryHelpers.AddNotecard( |
95 | m_scene, grp1.RootPart, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!"); | 95 | m_scene.AssetService, grp1.RootPart, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!"); |
96 | grp1Item.PermsMask |= ScriptBaseClass.PERMISSION_CHANGE_LINKS; | 96 | grp1Item.PermsMask |= ScriptBaseClass.PERMISSION_CHANGE_LINKS; |
97 | 97 | ||
98 | SceneObjectGroup grp2 = SceneHelpers.CreateSceneObject(2, ownerId, "grp2-", 0x20); | 98 | SceneObjectGroup grp2 = SceneHelpers.CreateSceneObject(2, ownerId, "grp2-", 0x20); |
@@ -126,7 +126,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
126 | // FIXME: This should really be a script item (with accompanying script) | 126 | // FIXME: This should really be a script item (with accompanying script) |
127 | TaskInventoryItem grp1Item | 127 | TaskInventoryItem grp1Item |
128 | = TaskInventoryHelpers.AddNotecard( | 128 | = TaskInventoryHelpers.AddNotecard( |
129 | m_scene, grp1.RootPart, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!"); | 129 | m_scene.AssetService, grp1.RootPart, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!"); |
130 | 130 | ||
131 | grp1Item.PermsMask |= ScriptBaseClass.PERMISSION_CHANGE_LINKS; | 131 | grp1Item.PermsMask |= ScriptBaseClass.PERMISSION_CHANGE_LINKS; |
132 | 132 | ||
@@ -155,7 +155,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
155 | // FIXME: This should really be a script item (with accompanying script) | 155 | // FIXME: This should really be a script item (with accompanying script) |
156 | TaskInventoryItem grp1Item | 156 | TaskInventoryItem grp1Item |
157 | = TaskInventoryHelpers.AddNotecard( | 157 | = TaskInventoryHelpers.AddNotecard( |
158 | m_scene, grp1.RootPart, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!"); | 158 | m_scene.AssetService, grp1.RootPart, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!"); |
159 | 159 | ||
160 | grp1Item.PermsMask |= ScriptBaseClass.PERMISSION_CHANGE_LINKS; | 160 | grp1Item.PermsMask |= ScriptBaseClass.PERMISSION_CHANGE_LINKS; |
161 | 161 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiNotecardTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiNotecardTests.cs index b9028ab..2ac12cb 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 | |||
61 | SceneHelpers.SetupSceneModules(m_scene, new IniConfigSource(), m_engine); | 61 | SceneHelpers.SetupSceneModules(m_scene, new IniConfigSource(), m_engine); |
62 | 62 | ||
63 | m_so = SceneHelpers.AddSceneObject(m_scene); | 63 | m_so = SceneHelpers.AddSceneObject(m_scene); |
64 | m_scriptItem = TaskInventoryHelpers.AddScript(m_scene, m_so.RootPart); | 64 | m_scriptItem = TaskInventoryHelpers.AddScript(m_scene.AssetService, m_so.RootPart); |
65 | 65 | ||
66 | // This is disconnected from the actual script - the mock engine does not set up any LSL_Api atm. | 66 | // This is disconnected from the actual script - the mock engine does not set up any LSL_Api atm. |
67 | // Possibly this could be done and we could obtain it directly from the MockScriptEngine. | 67 | // Possibly this could be done and we could obtain it directly from the MockScriptEngine. |
@@ -77,7 +77,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
77 | string[] ncLines = { "One", "Twoè", "Three" }; | 77 | string[] ncLines = { "One", "Twoè", "Three" }; |
78 | 78 | ||
79 | TaskInventoryItem ncItem | 79 | TaskInventoryItem ncItem |
80 | = TaskInventoryHelpers.AddNotecard(m_scene, m_so.RootPart, "nc", "1", "10", string.Join("\n", ncLines)); | 80 | = TaskInventoryHelpers.AddNotecard(m_scene.AssetService, m_so.RootPart, "nc", "1", "10", string.Join("\n", ncLines)); |
81 | 81 | ||
82 | AssertValidNotecardLine(ncItem.Name, 0, ncLines[0]); | 82 | AssertValidNotecardLine(ncItem.Name, 0, ncLines[0]); |
83 | AssertValidNotecardLine(ncItem.Name, 2, ncLines[2]); | 83 | AssertValidNotecardLine(ncItem.Name, 2, ncLines[2]); |
@@ -102,7 +102,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
102 | { | 102 | { |
103 | TestHelpers.InMethod(); | 103 | TestHelpers.InMethod(); |
104 | 104 | ||
105 | TaskInventoryItem ncItem = TaskInventoryHelpers.AddScript(m_scene, m_so.RootPart, "nc1", "Not important"); | 105 | TaskInventoryItem ncItem = TaskInventoryHelpers.AddScript(m_scene.AssetService, m_so.RootPart, "nc1", "Not important"); |
106 | 106 | ||
107 | AssertInValidNotecardLine(ncItem.Name, 0); | 107 | AssertInValidNotecardLine(ncItem.Name, 0); |
108 | } | 108 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiUserTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiUserTests.cs index 6424ea1..40082b5 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 | |||
68 | UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(m_scene, userId); | 68 | UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(m_scene, userId); |
69 | 69 | ||
70 | SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene).RootPart; | 70 | SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene).RootPart; |
71 | TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene, part); | 71 | TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene.AssetService, part); |
72 | 72 | ||
73 | LSL_Api apiGrp1 = new LSL_Api(); | 73 | LSL_Api apiGrp1 = new LSL_Api(); |
74 | apiGrp1.Initialize(m_engine, part, scriptItem, null); | 74 | 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 caba4a4..2fe558a 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 | |||
96 | UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(m_scene, 0x1); | 96 | UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(m_scene, 0x1); |
97 | ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, ua1.PrincipalID); | 97 | ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, ua1.PrincipalID); |
98 | SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID); | 98 | SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID); |
99 | TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene, inWorldObj.RootPart); | 99 | TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene.AssetService, inWorldObj.RootPart); |
100 | 100 | ||
101 | new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem, null); | 101 | new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem, null); |
102 | OSSL_Api osslApi = new OSSL_Api(); | 102 | OSSL_Api osslApi = new OSSL_Api(); |
@@ -105,7 +105,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
105 | // SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, ua1.PrincipalID); | 105 | // SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, ua1.PrincipalID); |
106 | 106 | ||
107 | // Create an object embedded inside the first | 107 | // Create an object embedded inside the first |
108 | TaskInventoryHelpers.AddSceneObject(m_scene, inWorldObj.RootPart, taskInvObjItemName, taskInvObjItemId, ua1.PrincipalID); | 108 | TaskInventoryHelpers.AddSceneObject(m_scene.AssetService, inWorldObj.RootPart, taskInvObjItemName, taskInvObjItemId, ua1.PrincipalID); |
109 | 109 | ||
110 | osslApi.osForceAttachToAvatarFromInventory(taskInvObjItemName, (int)attachPoint); | 110 | osslApi.osForceAttachToAvatarFromInventory(taskInvObjItemName, (int)attachPoint); |
111 | 111 | ||
@@ -142,7 +142,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
142 | UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(m_scene, 0x1); | 142 | UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(m_scene, 0x1); |
143 | ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, ua1.PrincipalID); | 143 | ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, ua1.PrincipalID); |
144 | SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID); | 144 | SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID); |
145 | TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene, inWorldObj.RootPart); | 145 | TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene.AssetService, inWorldObj.RootPart); |
146 | 146 | ||
147 | new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem, null); | 147 | new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem, null); |
148 | OSSL_Api osslApi = new OSSL_Api(); | 148 | OSSL_Api osslApi = new OSSL_Api(); |
@@ -150,7 +150,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
150 | 150 | ||
151 | // Create an object embedded inside the first | 151 | // Create an object embedded inside the first |
152 | TaskInventoryHelpers.AddNotecard( | 152 | TaskInventoryHelpers.AddNotecard( |
153 | m_scene, inWorldObj.RootPart, taskInvObjItemName, taskInvObjItemId, TestHelpers.ParseTail(0x900), "Hello World!"); | 153 | m_scene.AssetService, inWorldObj.RootPart, taskInvObjItemName, taskInvObjItemId, TestHelpers.ParseTail(0x900), "Hello World!"); |
154 | 154 | ||
155 | bool exceptionCaught = false; | 155 | bool exceptionCaught = false; |
156 | 156 | ||
@@ -190,7 +190,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
190 | 190 | ||
191 | ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, ua1); | 191 | ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, ua1); |
192 | SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID); | 192 | SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID); |
193 | TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene, inWorldObj.RootPart); | 193 | TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene.AssetService, inWorldObj.RootPart); |
194 | 194 | ||
195 | new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem, null); | 195 | new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem, null); |
196 | OSSL_Api osslApi = new OSSL_Api(); | 196 | OSSL_Api osslApi = new OSSL_Api(); |
@@ -198,7 +198,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
198 | 198 | ||
199 | // Create an object embedded inside the first | 199 | // Create an object embedded inside the first |
200 | TaskInventoryHelpers.AddSceneObject( | 200 | TaskInventoryHelpers.AddSceneObject( |
201 | m_scene, inWorldObj.RootPart, taskInvObjItemName, taskInvObjItemId, ua1.PrincipalID); | 201 | m_scene.AssetService, inWorldObj.RootPart, taskInvObjItemName, taskInvObjItemId, ua1.PrincipalID); |
202 | 202 | ||
203 | ScenePresence sp2 = SceneHelpers.AddScenePresence(m_scene, ua2); | 203 | ScenePresence sp2 = SceneHelpers.AddScenePresence(m_scene, ua2); |
204 | 204 | ||
diff --git a/OpenSim/Region/ScriptEngine/XEngine/Tests/XEnginePersistenceTests.cs b/OpenSim/Region/ScriptEngine/XEngine/Tests/XEnginePersistenceTests.cs index 5b7e5f7..2ef4058 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 | |||
114 | 114 | ||
115 | SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, sp.UUID, "att-name", 0x10); | 115 | SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, sp.UUID, "att-name", 0x10); |
116 | TaskInventoryHelpers.AddScript( | 116 | TaskInventoryHelpers.AddScript( |
117 | scene, | 117 | scene.AssetService, |
118 | so.RootPart, | 118 | so.RootPart, |
119 | "scriptItem", | 119 | "scriptItem", |
120 | "default { attach(key id) { if (id != NULL_KEY) { llSay(0, \"Hello World\"); } } }"); | 120 | "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 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 | |||
43 | /// <summary> | 43 | /// <summary> |
44 | /// Add a notecard item to the given part. | 44 | /// Add a notecard item to the given part. |
45 | /// </summary> | 45 | /// </summary> |
46 | /// <param name="scene"></param> | 46 | /// <param name="assetService"></param> |
47 | /// <param name="part"></param> | 47 | /// <param name="part"></param> |
48 | /// <param name="itemName"></param> | 48 | /// <param name="itemName"></param> |
49 | /// <param name="itemIDFrag">UUID or UUID stem</param> | 49 | /// <param name="itemIDFrag">UUID or UUID stem</param> |
@@ -51,16 +51,16 @@ namespace OpenSim.Tests.Common | |||
51 | /// <param name="text">The tex to put in the notecard.</param> | 51 | /// <param name="text">The tex to put in the notecard.</param> |
52 | /// <returns>The item that was added</returns> | 52 | /// <returns>The item that was added</returns> |
53 | public static TaskInventoryItem AddNotecard( | 53 | public static TaskInventoryItem AddNotecard( |
54 | Scene scene, SceneObjectPart part, string itemName, string itemIDStem, string assetIDStem, string text) | 54 | IAssetService assetService, SceneObjectPart part, string itemName, string itemIDStem, string assetIDStem, string text) |
55 | { | 55 | { |
56 | return AddNotecard( | 56 | return AddNotecard( |
57 | scene, part, itemName, TestHelpers.ParseStem(itemIDStem), TestHelpers.ParseStem(assetIDStem), text); | 57 | assetService, part, itemName, TestHelpers.ParseStem(itemIDStem), TestHelpers.ParseStem(assetIDStem), text); |
58 | } | 58 | } |
59 | 59 | ||
60 | /// <summary> | 60 | /// <summary> |
61 | /// Add a notecard item to the given part. | 61 | /// Add a notecard item to the given part. |
62 | /// </summary> | 62 | /// </summary> |
63 | /// <param name="scene"></param> | 63 | /// <param name="assetService"></param> |
64 | /// <param name="part"></param> | 64 | /// <param name="part"></param> |
65 | /// <param name="itemName"></param> | 65 | /// <param name="itemName"></param> |
66 | /// <param name="itemID"></param> | 66 | /// <param name="itemID"></param> |
@@ -68,7 +68,7 @@ namespace OpenSim.Tests.Common | |||
68 | /// <param name="text">The tex to put in the notecard.</param> | 68 | /// <param name="text">The tex to put in the notecard.</param> |
69 | /// <returns>The item that was added</returns> | 69 | /// <returns>The item that was added</returns> |
70 | public static TaskInventoryItem AddNotecard( | 70 | public static TaskInventoryItem AddNotecard( |
71 | Scene scene, SceneObjectPart part, string itemName, UUID itemID, UUID assetID, string text) | 71 | IAssetService assetService, SceneObjectPart part, string itemName, UUID itemID, UUID assetID, string text) |
72 | { | 72 | { |
73 | AssetNotecard nc = new AssetNotecard(); | 73 | AssetNotecard nc = new AssetNotecard(); |
74 | nc.BodyText = text; | 74 | nc.BodyText = text; |
@@ -76,7 +76,7 @@ namespace OpenSim.Tests.Common | |||
76 | 76 | ||
77 | AssetBase ncAsset | 77 | AssetBase ncAsset |
78 | = AssetHelpers.CreateAsset(assetID, AssetType.Notecard, nc.AssetData, UUID.Zero); | 78 | = AssetHelpers.CreateAsset(assetID, AssetType.Notecard, nc.AssetData, UUID.Zero); |
79 | scene.AssetService.Store(ncAsset); | 79 | assetService.Store(ncAsset); |
80 | 80 | ||
81 | TaskInventoryItem ncItem | 81 | TaskInventoryItem ncItem |
82 | = new TaskInventoryItem | 82 | = new TaskInventoryItem |
@@ -94,12 +94,12 @@ namespace OpenSim.Tests.Common | |||
94 | /// TODO: Accept input for item and asset IDs to avoid mysterious script failures that try to use any of these | 94 | /// TODO: Accept input for item and asset IDs to avoid mysterious script failures that try to use any of these |
95 | /// functions more than once in a test. | 95 | /// functions more than once in a test. |
96 | /// </remarks> | 96 | /// </remarks> |
97 | /// <param name="scene"></param> | 97 | /// <param name="assetService"></param> |
98 | /// <param name="part"></param> | 98 | /// <param name="part"></param> |
99 | /// <returns>The item that was added</returns> | 99 | /// <returns>The item that was added</returns> |
100 | public static TaskInventoryItem AddScript(Scene scene, SceneObjectPart part) | 100 | public static TaskInventoryItem AddScript(IAssetService assetService, SceneObjectPart part) |
101 | { | 101 | { |
102 | return AddScript(scene, part, "scriptItem", "default { state_entry() { llSay(0, \"Hello World\"); } }"); | 102 | return AddScript(assetService, part, "scriptItem", "default { state_entry() { llSay(0, \"Hello World\"); } }"); |
103 | } | 103 | } |
104 | 104 | ||
105 | /// <summary> | 105 | /// <summary> |
@@ -109,15 +109,15 @@ namespace OpenSim.Tests.Common | |||
109 | /// TODO: Accept input for item and asset IDs so that we have completely replicatable regression tests rather | 109 | /// TODO: Accept input for item and asset IDs so that we have completely replicatable regression tests rather |
110 | /// than a random component. | 110 | /// than a random component. |
111 | /// </remarks> | 111 | /// </remarks> |
112 | /// <param name="scene"></param> | 112 | /// <param name="assetService"></param> |
113 | /// <param name="part"></param> | 113 | /// <param name="part"></param> |
114 | /// <param name="scriptName">Name of the script to add</param> | 114 | /// <param name="scriptName">Name of the script to add</param> |
115 | /// <param name="scriptSource">LSL script source</param> | 115 | /// <param name="scriptSource">LSL script source</param> |
116 | /// <returns>The item that was added</returns> | 116 | /// <returns>The item that was added</returns> |
117 | public static TaskInventoryItem AddScript( | 117 | public static TaskInventoryItem AddScript( |
118 | Scene scene, SceneObjectPart part, string scriptName, string scriptSource) | 118 | IAssetService assetService, SceneObjectPart part, string scriptName, string scriptSource) |
119 | { | 119 | { |
120 | return AddScript(scene, part, UUID.Random(), UUID.Random(), scriptName, scriptSource); | 120 | return AddScript(assetService, part, UUID.Random(), UUID.Random(), scriptName, scriptSource); |
121 | } | 121 | } |
122 | 122 | ||
123 | /// <summary> | 123 | /// <summary> |
@@ -127,7 +127,7 @@ namespace OpenSim.Tests.Common | |||
127 | /// TODO: Accept input for item and asset IDs so that we have completely replicatable regression tests rather | 127 | /// TODO: Accept input for item and asset IDs so that we have completely replicatable regression tests rather |
128 | /// than a random component. | 128 | /// than a random component. |
129 | /// </remarks> | 129 | /// </remarks> |
130 | /// <param name="scene"></param> | 130 | /// <param name="assetService"></param> |
131 | /// <param name="part"></param> | 131 | /// <param name="part"></param> |
132 | /// <param name="itemId">Item UUID for the script</param> | 132 | /// <param name="itemId">Item UUID for the script</param> |
133 | /// <param name="assetId">Asset UUID for the script</param> | 133 | /// <param name="assetId">Asset UUID for the script</param> |
@@ -135,7 +135,7 @@ namespace OpenSim.Tests.Common | |||
135 | /// <param name="scriptSource">LSL script source</param> | 135 | /// <param name="scriptSource">LSL script source</param> |
136 | /// <returns>The item that was added</returns> | 136 | /// <returns>The item that was added</returns> |
137 | public static TaskInventoryItem AddScript( | 137 | public static TaskInventoryItem AddScript( |
138 | Scene scene, SceneObjectPart part, UUID itemId, UUID assetId, string scriptName, string scriptSource) | 138 | IAssetService assetService, SceneObjectPart part, UUID itemId, UUID assetId, string scriptName, string scriptSource) |
139 | { | 139 | { |
140 | AssetScriptText ast = new AssetScriptText(); | 140 | AssetScriptText ast = new AssetScriptText(); |
141 | ast.Source = scriptSource; | 141 | ast.Source = scriptSource; |
@@ -143,7 +143,7 @@ namespace OpenSim.Tests.Common | |||
143 | 143 | ||
144 | AssetBase asset | 144 | AssetBase asset |
145 | = AssetHelpers.CreateAsset(assetId, AssetType.LSLText, ast.AssetData, UUID.Zero); | 145 | = AssetHelpers.CreateAsset(assetId, AssetType.LSLText, ast.AssetData, UUID.Zero); |
146 | scene.AssetService.Store(asset); | 146 | assetService.Store(asset); |
147 | TaskInventoryItem item | 147 | TaskInventoryItem item |
148 | = new TaskInventoryItem | 148 | = new TaskInventoryItem |
149 | { Name = scriptName, AssetID = assetId, ItemID = itemId, | 149 | { Name = scriptName, AssetID = assetId, ItemID = itemId, |
@@ -162,17 +162,17 @@ namespace OpenSim.Tests.Common | |||
162 | /// functions more than once in a test. | 162 | /// functions more than once in a test. |
163 | /// </remarks> | 163 | /// </remarks> |
164 | /// | 164 | /// |
165 | /// <param name="scene"></param> | 165 | /// <param name="assetService"></param> |
166 | /// <param name="sop"></param> | 166 | /// <param name="sop"></param> |
167 | /// <param name="itemName"></param> | 167 | /// <param name="itemName"></param> |
168 | /// <param name="id"></param> | 168 | /// <param name="id"></param> |
169 | /// <param name="userId"></param> | 169 | /// <param name="userId"></param> |
170 | public static TaskInventoryItem AddSceneObject( | 170 | public static TaskInventoryItem AddSceneObject( |
171 | Scene scene, SceneObjectPart sop, string itemName, UUID id, UUID userId) | 171 | IAssetService assetService, SceneObjectPart sop, string itemName, UUID id, UUID userId) |
172 | { | 172 | { |
173 | SceneObjectGroup taskSceneObject = SceneHelpers.CreateSceneObject(1, UUID.Zero); | 173 | SceneObjectGroup taskSceneObject = SceneHelpers.CreateSceneObject(1, UUID.Zero); |
174 | AssetBase taskSceneObjectAsset = AssetHelpers.CreateAsset(0x10, taskSceneObject); | 174 | AssetBase taskSceneObjectAsset = AssetHelpers.CreateAsset(0x10, taskSceneObject); |
175 | scene.AssetService.Store(taskSceneObjectAsset); | 175 | assetService.Store(taskSceneObjectAsset); |
176 | TaskInventoryItem taskSceneObjectItem | 176 | TaskInventoryItem taskSceneObjectItem |
177 | = new TaskInventoryItem | 177 | = new TaskInventoryItem |
178 | { Name = itemName, | 178 | { Name = itemName, |