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 /OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs | |
parent | On shutdown (job engine stop), don't allow the ObjectDisposedException on Blo... (diff) | |
download | opensim-SC_OLD-b1b72d7c2f16e7d1e239a0579dc0b28ea9812ed7.zip opensim-SC_OLD-b1b72d7c2f16e7d1e239a0579dc0b28ea9812ed7.tar.gz opensim-SC_OLD-b1b72d7c2f16e7d1e239a0579dc0b28ea9812ed7.tar.bz2 opensim-SC_OLD-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 '')
-rw-r--r-- | OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs | 36 |
1 files changed, 18 insertions, 18 deletions
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, |