diff options
author | Justin Clark-Casey (justincc) | 2015-01-16 22:44:54 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2015-01-16 22:46:48 +0000 |
commit | 8d724e90de0fb3b406f82f4e06b6f5b79c5a538c (patch) | |
tree | 069eac2d8fa46b63267d4119795a6cabf218c97f /OpenSim/Tests | |
parent | minor: Suppress the log messages when user profiles data is requested for an ... (diff) | |
download | opensim-SC_OLD-8d724e90de0fb3b406f82f4e06b6f5b79c5a538c.zip opensim-SC_OLD-8d724e90de0fb3b406f82f4e06b6f5b79c5a538c.tar.gz opensim-SC_OLD-8d724e90de0fb3b406f82f4e06b6f5b79c5a538c.tar.bz2 opensim-SC_OLD-8d724e90de0fb3b406f82f4e06b6f5b79c5a538c.tar.xz |
For scripts in attachments, don't save .state files apart from the initial one as these are ignored since .state is saved in the attachment's asset.
This eliminates pointless work and exceptions when an appdomain is unloaded whilst an attachment script state is persisted.
Adds test for this case.
Relates to http://opensimulator.org/mantis/view.php?id=7407
Diffstat (limited to 'OpenSim/Tests')
-rw-r--r-- | OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs b/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs index bb4b55f..b4bd50b 100644 --- a/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs | |||
@@ -117,25 +117,43 @@ namespace OpenSim.Tests.Common | |||
117 | public static TaskInventoryItem AddScript( | 117 | public static TaskInventoryItem AddScript( |
118 | Scene scene, SceneObjectPart part, string scriptName, string scriptSource) | 118 | Scene scene, SceneObjectPart part, string scriptName, string scriptSource) |
119 | { | 119 | { |
120 | return AddScript(scene, part, UUID.Random(), UUID.Random(), scriptName, scriptSource); | ||
121 | } | ||
122 | |||
123 | /// <summary> | ||
124 | /// Add a simple script to the given part. | ||
125 | /// </summary> | ||
126 | /// <remarks> | ||
127 | /// TODO: Accept input for item and asset IDs so that we have completely replicatable regression tests rather | ||
128 | /// than a random component. | ||
129 | /// </remarks> | ||
130 | /// <param name="scene"></param> | ||
131 | /// <param name="part"></param> | ||
132 | /// <param name="itemId">Item UUID for the script</param> | ||
133 | /// <param name="assetId">Asset UUID for the script</param> | ||
134 | /// <param name="scriptName">Name of the script to add</param> | ||
135 | /// <param name="scriptSource">LSL script source</param> | ||
136 | /// <returns>The item that was added</returns> | ||
137 | public static TaskInventoryItem AddScript( | ||
138 | Scene scene, SceneObjectPart part, UUID itemId, UUID assetId, string scriptName, string scriptSource) | ||
139 | { | ||
120 | AssetScriptText ast = new AssetScriptText(); | 140 | AssetScriptText ast = new AssetScriptText(); |
121 | ast.Source = scriptSource; | 141 | ast.Source = scriptSource; |
122 | ast.Encode(); | 142 | ast.Encode(); |
123 | 143 | ||
124 | UUID assetUuid = UUID.Random(); | ||
125 | UUID itemUuid = UUID.Random(); | ||
126 | |||
127 | AssetBase asset | 144 | AssetBase asset |
128 | = AssetHelpers.CreateAsset(assetUuid, AssetType.LSLText, ast.AssetData, UUID.Zero); | 145 | = AssetHelpers.CreateAsset(assetId, AssetType.LSLText, ast.AssetData, UUID.Zero); |
129 | scene.AssetService.Store(asset); | 146 | scene.AssetService.Store(asset); |
130 | TaskInventoryItem item | 147 | TaskInventoryItem item |
131 | = new TaskInventoryItem | 148 | = new TaskInventoryItem |
132 | { Name = scriptName, AssetID = assetUuid, ItemID = itemUuid, | 149 | { Name = scriptName, AssetID = assetId, ItemID = itemId, |
133 | Type = (int)AssetType.LSLText, InvType = (int)InventoryType.LSL }; | 150 | Type = (int)AssetType.LSLText, InvType = (int)InventoryType.LSL }; |
134 | part.Inventory.AddInventoryItem(item, true); | 151 | part.Inventory.AddInventoryItem(item, true); |
135 | 152 | ||
136 | return item; | 153 | return item; |
137 | } | 154 | } |
138 | 155 | ||
156 | |||
139 | /// <summary> | 157 | /// <summary> |
140 | /// Add a scene object item to the given part. | 158 | /// Add a scene object item to the given part. |
141 | /// </summary> | 159 | /// </summary> |