diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Tests/Common/Helpers/SceneHelpers.cs | 2 | ||||
-rw-r--r-- | OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs | 32 | ||||
-rw-r--r-- | OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs | 109 | ||||
-rw-r--r-- | OpenSim/Tests/Common/Mock/MockGroupsServicesConnector.cs | 77 | ||||
-rw-r--r-- | OpenSim/Tests/Common/Mock/MockScriptEngine.cs | 266 | ||||
-rw-r--r-- | OpenSim/Tests/Common/Mock/TestScene.cs | 3 | ||||
-rw-r--r-- | OpenSim/Tests/Common/Mock/TestXInventoryDataPlugin.cs | 25 | ||||
-rw-r--r-- | OpenSim/Tests/Common/TestHelpers.cs | 21 | ||||
-rw-r--r-- | OpenSim/Tests/ConfigurationLoaderTest.cs | 7 | ||||
-rw-r--r-- | OpenSim/Tests/Performance/NPCPerformanceTests.cs | 2 | ||||
-rw-r--r-- | OpenSim/Tests/Performance/ObjectPerformanceTests.cs | 2 | ||||
-rw-r--r-- | OpenSim/Tests/Performance/ScriptPerformanceTests.cs | 2 |
12 files changed, 488 insertions, 60 deletions
diff --git a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs index ea3e348..dc20f13 100644 --- a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs | |||
@@ -139,7 +139,7 @@ namespace OpenSim.Tests.Common | |||
139 | SceneCommunicationService scs = new SceneCommunicationService(); | 139 | SceneCommunicationService scs = new SceneCommunicationService(); |
140 | 140 | ||
141 | TestScene testScene = new TestScene( | 141 | TestScene testScene = new TestScene( |
142 | regInfo, m_acm, scs, m_simDataService, m_estateDataService, false, configSource, null); | 142 | regInfo, m_acm, scs, m_simDataService, m_estateDataService, configSource, null); |
143 | 143 | ||
144 | INonSharedRegionModule godsModule = new GodsModule(); | 144 | INonSharedRegionModule godsModule = new GodsModule(); |
145 | godsModule.Initialise(new IniConfigSource()); | 145 | godsModule.Initialise(new IniConfigSource()); |
diff --git a/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs b/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs index 0a2b30a..bb4b55f 100644 --- a/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs | |||
@@ -46,13 +46,32 @@ namespace OpenSim.Tests.Common | |||
46 | /// <param name="scene"></param> | 46 | /// <param name="scene"></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> | ||
50 | /// <param name="assetIDFrag">UUID or UUID stem</param> | ||
51 | /// <param name="text">The tex to put in the notecard.</param> | ||
52 | /// <returns>The item that was added</returns> | ||
53 | public static TaskInventoryItem AddNotecard( | ||
54 | Scene scene, SceneObjectPart part, string itemName, string itemIDStem, string assetIDStem, string text) | ||
55 | { | ||
56 | return AddNotecard( | ||
57 | scene, part, itemName, TestHelpers.ParseStem(itemIDStem), TestHelpers.ParseStem(assetIDStem), text); | ||
58 | } | ||
59 | |||
60 | /// <summary> | ||
61 | /// Add a notecard item to the given part. | ||
62 | /// </summary> | ||
63 | /// <param name="scene"></param> | ||
64 | /// <param name="part"></param> | ||
65 | /// <param name="itemName"></param> | ||
49 | /// <param name="itemID"></param> | 66 | /// <param name="itemID"></param> |
50 | /// <param name="assetID"></param> | 67 | /// <param name="assetID"></param> |
68 | /// <param name="text">The tex to put in the notecard.</param> | ||
51 | /// <returns>The item that was added</returns> | 69 | /// <returns>The item that was added</returns> |
52 | public static TaskInventoryItem AddNotecard(Scene scene, SceneObjectPart part, string itemName, UUID itemID, UUID assetID) | 70 | public static TaskInventoryItem AddNotecard( |
71 | Scene scene, SceneObjectPart part, string itemName, UUID itemID, UUID assetID, string text) | ||
53 | { | 72 | { |
54 | AssetNotecard nc = new AssetNotecard(); | 73 | AssetNotecard nc = new AssetNotecard(); |
55 | nc.BodyText = "Hello World!"; | 74 | nc.BodyText = text; |
56 | nc.Encode(); | 75 | nc.Encode(); |
57 | 76 | ||
58 | AssetBase ncAsset | 77 | AssetBase ncAsset |
@@ -87,8 +106,8 @@ namespace OpenSim.Tests.Common | |||
87 | /// Add a simple script to the given part. | 106 | /// Add a simple script to the given part. |
88 | /// </summary> | 107 | /// </summary> |
89 | /// <remarks> | 108 | /// <remarks> |
90 | /// TODO: Accept input for item and asset IDs to avoid mysterious script failures that try to use any of these | 109 | /// TODO: Accept input for item and asset IDs so that we have completely replicatable regression tests rather |
91 | /// functions more than once in a test. | 110 | /// than a random component. |
92 | /// </remarks> | 111 | /// </remarks> |
93 | /// <param name="scene"></param> | 112 | /// <param name="scene"></param> |
94 | /// <param name="part"></param> | 113 | /// <param name="part"></param> |
@@ -102,8 +121,9 @@ namespace OpenSim.Tests.Common | |||
102 | ast.Source = scriptSource; | 121 | ast.Source = scriptSource; |
103 | ast.Encode(); | 122 | ast.Encode(); |
104 | 123 | ||
105 | UUID assetUuid = new UUID("00000000-0000-0000-1000-000000000000"); | 124 | UUID assetUuid = UUID.Random(); |
106 | UUID itemUuid = new UUID("00000000-0000-0000-1100-000000000000"); | 125 | UUID itemUuid = UUID.Random(); |
126 | |||
107 | AssetBase asset | 127 | AssetBase asset |
108 | = AssetHelpers.CreateAsset(assetUuid, AssetType.LSLText, ast.AssetData, UUID.Zero); | 128 | = AssetHelpers.CreateAsset(assetUuid, AssetType.LSLText, ast.AssetData, UUID.Zero); |
109 | scene.AssetService.Store(asset); | 129 | scene.AssetService.Store(asset); |
diff --git a/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs b/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs index 87d9410..a1794c9 100644 --- a/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs | |||
@@ -45,6 +45,9 @@ namespace OpenSim.Tests.Common | |||
45 | /// <summary> | 45 | /// <summary> |
46 | /// Add an existing scene object as an item in the user's inventory. | 46 | /// Add an existing scene object as an item in the user's inventory. |
47 | /// </summary> | 47 | /// </summary> |
48 | /// <remarks> | ||
49 | /// Will be added to the system Objects folder. | ||
50 | /// </remarks> | ||
48 | /// <param name='scene'></param> | 51 | /// <param name='scene'></param> |
49 | /// <param name='so'></param> | 52 | /// <param name='so'></param> |
50 | /// <param name='inventoryIdTail'></param> | 53 | /// <param name='inventoryIdTail'></param> |
@@ -63,7 +66,29 @@ namespace OpenSim.Tests.Common | |||
63 | } | 66 | } |
64 | 67 | ||
65 | /// <summary> | 68 | /// <summary> |
66 | /// Creates a notecard in the objects folder and specify an item id. | 69 | /// Add an existing scene object as an item in the user's inventory at the given path. |
70 | /// </summary> | ||
71 | /// <param name='scene'></param> | ||
72 | /// <param name='so'></param> | ||
73 | /// <param name='inventoryIdTail'></param> | ||
74 | /// <param name='assetIdTail'></param> | ||
75 | /// <returns>The inventory item created.</returns> | ||
76 | public static InventoryItemBase AddInventoryItem( | ||
77 | Scene scene, SceneObjectGroup so, int inventoryIdTail, int assetIdTail, string path) | ||
78 | { | ||
79 | return AddInventoryItem( | ||
80 | scene, | ||
81 | so.Name, | ||
82 | TestHelpers.ParseTail(inventoryIdTail), | ||
83 | InventoryType.Object, | ||
84 | AssetHelpers.CreateAsset(TestHelpers.ParseTail(assetIdTail), so), | ||
85 | so.OwnerID, | ||
86 | path); | ||
87 | } | ||
88 | |||
89 | /// <summary> | ||
90 | /// Adds the given item to the existing system folder for its type (e.g. an object will go in the "Objects" | ||
91 | /// folder). | ||
67 | /// </summary> | 92 | /// </summary> |
68 | /// <param name="scene"></param> | 93 | /// <param name="scene"></param> |
69 | /// <param name="itemName"></param> | 94 | /// <param name="itemName"></param> |
@@ -75,6 +100,25 @@ namespace OpenSim.Tests.Common | |||
75 | private static InventoryItemBase AddInventoryItem( | 100 | private static InventoryItemBase AddInventoryItem( |
76 | Scene scene, string itemName, UUID itemId, InventoryType itemType, AssetBase asset, UUID userId) | 101 | Scene scene, string itemName, UUID itemId, InventoryType itemType, AssetBase asset, UUID userId) |
77 | { | 102 | { |
103 | return AddInventoryItem( | ||
104 | scene, itemName, itemId, itemType, asset, userId, | ||
105 | scene.InventoryService.GetFolderForType(userId, (AssetType)asset.Type).Name); | ||
106 | } | ||
107 | |||
108 | /// <summary> | ||
109 | /// Adds the given item to an inventory folder | ||
110 | /// </summary> | ||
111 | /// <param name="scene"></param> | ||
112 | /// <param name="itemName"></param> | ||
113 | /// <param name="itemId"></param> | ||
114 | /// <param name="itemType"></param> | ||
115 | /// <param name="asset">The serialized asset for this item</param> | ||
116 | /// <param name="userId"></param> | ||
117 | /// <param name="path">Existing inventory path at which to add.</param> | ||
118 | /// <returns></returns> | ||
119 | private static InventoryItemBase AddInventoryItem( | ||
120 | Scene scene, string itemName, UUID itemId, InventoryType itemType, AssetBase asset, UUID userId, string path) | ||
121 | { | ||
78 | scene.AssetService.Store(asset); | 122 | scene.AssetService.Store(asset); |
79 | 123 | ||
80 | InventoryItemBase item = new InventoryItemBase(); | 124 | InventoryItemBase item = new InventoryItemBase(); |
@@ -85,7 +129,7 @@ namespace OpenSim.Tests.Common | |||
85 | item.AssetType = asset.Type; | 129 | item.AssetType = asset.Type; |
86 | item.InvType = (int)itemType; | 130 | item.InvType = (int)itemType; |
87 | 131 | ||
88 | InventoryFolderBase folder = scene.InventoryService.GetFolderForType(userId, (AssetType)asset.Type); | 132 | InventoryFolderBase folder = InventoryArchiveUtils.FindFoldersByPath(scene.InventoryService, userId, path)[0]; |
89 | 133 | ||
90 | item.Folder = folder.ID; | 134 | item.Folder = folder.ID; |
91 | scene.AddInventoryItem(item); | 135 | scene.AddInventoryItem(item); |
@@ -156,58 +200,83 @@ namespace OpenSim.Tests.Common | |||
156 | /// <summary> | 200 | /// <summary> |
157 | /// Create inventory folders starting from the user's root folder. | 201 | /// Create inventory folders starting from the user's root folder. |
158 | /// </summary> | 202 | /// </summary> |
159 | /// | ||
160 | /// Ignores any existing folders with the same name | ||
161 | /// | ||
162 | /// <param name="inventoryService"></param> | 203 | /// <param name="inventoryService"></param> |
163 | /// <param name="userId"></param> | 204 | /// <param name="userId"></param> |
164 | /// <param name="path"> | 205 | /// <param name="path"> |
165 | /// The folders to create. Multiple folders can be specified on a path delimited by the PATH_DELIMITER | 206 | /// The folders to create. Multiple folders can be specified on a path delimited by the PATH_DELIMITER |
166 | /// </param> | 207 | /// </param> |
208 | /// <param name="useExistingFolders"> | ||
209 | /// If true, then folders in the path which already the same name are | ||
210 | /// used. This applies to the terminal folder as well. | ||
211 | /// If false, then all folders in the path are created, even if there is already a folder at a particular | ||
212 | /// level with the same name. | ||
213 | /// </param> | ||
167 | /// <returns> | 214 | /// <returns> |
168 | /// The folder created. If the path contains multiple folders then the last one created is returned. | 215 | /// The folder created. If the path contains multiple folders then the last one created is returned. |
169 | /// Will return null if the root folder could not be found. | 216 | /// Will return null if the root folder could not be found. |
170 | /// </returns> | 217 | /// </returns> |
171 | public static InventoryFolderBase CreateInventoryFolder( | 218 | public static InventoryFolderBase CreateInventoryFolder( |
172 | IInventoryService inventoryService, UUID userId, string path) | 219 | IInventoryService inventoryService, UUID userId, string path, bool useExistingFolders) |
173 | { | 220 | { |
174 | InventoryFolderBase rootFolder = inventoryService.GetRootFolder(userId); | 221 | InventoryFolderBase rootFolder = inventoryService.GetRootFolder(userId); |
175 | 222 | ||
176 | if (null == rootFolder) | 223 | if (null == rootFolder) |
177 | return null; | 224 | return null; |
178 | 225 | ||
179 | return CreateInventoryFolder(inventoryService, rootFolder, path); | 226 | return CreateInventoryFolder(inventoryService, rootFolder, path, useExistingFolders); |
180 | } | 227 | } |
181 | 228 | ||
182 | /// <summary> | 229 | /// <summary> |
183 | /// Create inventory folders starting from a given parent folder | 230 | /// Create inventory folders starting from a given parent folder |
184 | /// </summary> | 231 | /// </summary> |
185 | /// | 232 | /// <remarks> |
186 | /// Ignores any existing folders with the same name | 233 | /// If any stem of the path names folders that already exist then these are not recreated. This includes the |
187 | /// | 234 | /// final folder. |
235 | /// TODO: May need to make it an option to create duplicate folders. | ||
236 | /// </remarks> | ||
188 | /// <param name="inventoryService"></param> | 237 | /// <param name="inventoryService"></param> |
189 | /// <param name="parentFolder"></param> | 238 | /// <param name="parentFolder"></param> |
190 | /// <param name="path"> | 239 | /// <param name="path"> |
191 | /// The folders to create. Multiple folders can be specified on a path delimited by the PATH_DELIMITER | 240 | /// The folder to create. |
241 | /// </param> | ||
242 | /// <param name="useExistingFolders"> | ||
243 | /// If true, then folders in the path which already the same name are | ||
244 | /// used. This applies to the terminal folder as well. | ||
245 | /// If false, then all folders in the path are created, even if there is already a folder at a particular | ||
246 | /// level with the same name. | ||
192 | /// </param> | 247 | /// </param> |
193 | /// <returns> | 248 | /// <returns> |
194 | /// The folder created. If the path contains multiple folders then the last one created is returned. | 249 | /// The folder created. If the path contains multiple folders then the last one created is returned. |
195 | /// </returns> | 250 | /// </returns> |
196 | public static InventoryFolderBase CreateInventoryFolder( | 251 | public static InventoryFolderBase CreateInventoryFolder( |
197 | IInventoryService inventoryService, InventoryFolderBase parentFolder, string path) | 252 | IInventoryService inventoryService, InventoryFolderBase parentFolder, string path, bool useExistingFolders) |
198 | { | 253 | { |
199 | string[] components = path.Split(new string[] { PATH_DELIMITER }, 2, StringSplitOptions.None); | 254 | string[] components = path.Split(new string[] { PATH_DELIMITER }, 2, StringSplitOptions.None); |
200 | 255 | ||
201 | InventoryFolderBase newFolder | 256 | InventoryFolderBase folder = null; |
202 | = new InventoryFolderBase( | 257 | |
203 | UUID.Random(), components[0], parentFolder.Owner, (short)AssetType.Unknown, parentFolder.ID, 0); | 258 | if (useExistingFolders) |
204 | 259 | folder = InventoryArchiveUtils.FindFolderByPath(inventoryService, parentFolder, components[0]); | |
205 | inventoryService.AddFolder(newFolder); | 260 | |
261 | if (folder == null) | ||
262 | { | ||
263 | // Console.WriteLine("Creating folder {0} at {1}", components[0], parentFolder.Name); | ||
264 | |||
265 | folder | ||
266 | = new InventoryFolderBase( | ||
267 | UUID.Random(), components[0], parentFolder.Owner, (short)AssetType.Unknown, parentFolder.ID, 0); | ||
268 | |||
269 | inventoryService.AddFolder(folder); | ||
270 | } | ||
271 | // else | ||
272 | // { | ||
273 | // Console.WriteLine("Found existing folder {0}", folder.Name); | ||
274 | // } | ||
206 | 275 | ||
207 | if (components.Length > 1) | 276 | if (components.Length > 1) |
208 | return CreateInventoryFolder(inventoryService, newFolder, components[1]); | 277 | return CreateInventoryFolder(inventoryService, folder, components[1], useExistingFolders); |
209 | else | 278 | else |
210 | return newFolder; | 279 | return folder; |
211 | } | 280 | } |
212 | 281 | ||
213 | /// <summary> | 282 | /// <summary> |
@@ -237,7 +306,7 @@ namespace OpenSim.Tests.Common | |||
237 | /// <returns>An empty list if no matching folders were found</returns> | 306 | /// <returns>An empty list if no matching folders were found</returns> |
238 | public static List<InventoryFolderBase> GetInventoryFolders(IInventoryService inventoryService, UUID userId, string path) | 307 | public static List<InventoryFolderBase> GetInventoryFolders(IInventoryService inventoryService, UUID userId, string path) |
239 | { | 308 | { |
240 | return InventoryArchiveUtils.FindFolderByPath(inventoryService, userId, path); | 309 | return InventoryArchiveUtils.FindFoldersByPath(inventoryService, userId, path); |
241 | } | 310 | } |
242 | 311 | ||
243 | /// <summary> | 312 | /// <summary> |
diff --git a/OpenSim/Tests/Common/Mock/MockGroupsServicesConnector.cs b/OpenSim/Tests/Common/Mock/MockGroupsServicesConnector.cs index 6fb9df1..3035cea 100644 --- a/OpenSim/Tests/Common/Mock/MockGroupsServicesConnector.cs +++ b/OpenSim/Tests/Common/Mock/MockGroupsServicesConnector.cs | |||
@@ -26,12 +26,15 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections; | ||
29 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
30 | using System.Reflection; | 31 | using System.Reflection; |
31 | using log4net; | 32 | using log4net; |
32 | using Mono.Addins; | 33 | using Mono.Addins; |
33 | using Nini.Config; | 34 | using Nini.Config; |
34 | using OpenMetaverse; | 35 | using OpenMetaverse; |
36 | using OpenSim.Data; | ||
37 | using OpenSim.Data.Null; | ||
35 | using OpenSim.Framework; | 38 | using OpenSim.Framework; |
36 | using OpenSim.Region.Framework.Interfaces; | 39 | using OpenSim.Region.Framework.Interfaces; |
37 | using OpenSim.Region.Framework.Scenes; | 40 | using OpenSim.Region.Framework.Scenes; |
@@ -44,6 +47,8 @@ namespace OpenSim.Tests.Common.Mock | |||
44 | { | 47 | { |
45 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 48 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
46 | 49 | ||
50 | IXGroupData m_data = new NullXGroupData(null, null); | ||
51 | |||
47 | public string Name | 52 | public string Name |
48 | { | 53 | { |
49 | get { return "MockGroupsServicesConnector"; } | 54 | get { return "MockGroupsServicesConnector"; } |
@@ -84,7 +89,33 @@ namespace OpenSim.Tests.Common.Mock | |||
84 | int membershipFee, bool openEnrollment, bool allowPublish, | 89 | int membershipFee, bool openEnrollment, bool allowPublish, |
85 | bool maturePublish, UUID founderID) | 90 | bool maturePublish, UUID founderID) |
86 | { | 91 | { |
87 | return UUID.Zero; | 92 | XGroup group = new XGroup() |
93 | { | ||
94 | groupID = UUID.Random(), | ||
95 | ownerRoleID = UUID.Random(), | ||
96 | name = name, | ||
97 | charter = charter, | ||
98 | showInList = showInList, | ||
99 | insigniaID = insigniaID, | ||
100 | membershipFee = membershipFee, | ||
101 | openEnrollment = openEnrollment, | ||
102 | allowPublish = allowPublish, | ||
103 | maturePublish = maturePublish, | ||
104 | founderID = founderID, | ||
105 | everyonePowers = (ulong)XmlRpcGroupsServicesConnectorModule.DefaultEveryonePowers, | ||
106 | ownersPowers = (ulong)XmlRpcGroupsServicesConnectorModule.DefaultOwnerPowers | ||
107 | }; | ||
108 | |||
109 | if (m_data.StoreGroup(group)) | ||
110 | { | ||
111 | m_log.DebugFormat("[MOCK GROUPS SERVICES CONNECTOR]: Created group {0} {1}", group.name, group.groupID); | ||
112 | return group.groupID; | ||
113 | } | ||
114 | else | ||
115 | { | ||
116 | m_log.ErrorFormat("[MOCK GROUPS SERVICES CONNECTOR]: Failed to create group {0}", name); | ||
117 | return UUID.Zero; | ||
118 | } | ||
88 | } | 119 | } |
89 | 120 | ||
90 | public void UpdateGroup(UUID requestingAgentID, UUID groupID, string charter, bool showInList, | 121 | public void UpdateGroup(UUID requestingAgentID, UUID groupID, string charter, bool showInList, |
@@ -107,9 +138,49 @@ namespace OpenSim.Tests.Common.Mock | |||
107 | { | 138 | { |
108 | } | 139 | } |
109 | 140 | ||
110 | public GroupRecord GetGroupRecord(UUID requestingAgentID, UUID GroupID, string GroupName) | 141 | public GroupRecord GetGroupRecord(UUID requestingAgentID, UUID groupID, string groupName) |
111 | { | 142 | { |
112 | return null; | 143 | m_log.DebugFormat( |
144 | "[MOCK GROUPS SERVICES CONNECTOR]: Processing GetGroupRecord() for groupID {0}, name {1}", | ||
145 | groupID, groupName); | ||
146 | |||
147 | XGroup[] groups; | ||
148 | string field, val; | ||
149 | |||
150 | if (groupID != UUID.Zero) | ||
151 | { | ||
152 | field = "groupID"; | ||
153 | val = groupID.ToString(); | ||
154 | } | ||
155 | else | ||
156 | { | ||
157 | field = "name"; | ||
158 | val = groupName; | ||
159 | } | ||
160 | |||
161 | groups = m_data.GetGroups(field, val); | ||
162 | |||
163 | if (groups.Length == 0) | ||
164 | return null; | ||
165 | |||
166 | XGroup xg = groups[0]; | ||
167 | |||
168 | GroupRecord gr = new GroupRecord() | ||
169 | { | ||
170 | GroupID = xg.groupID, | ||
171 | GroupName = xg.name, | ||
172 | AllowPublish = xg.allowPublish, | ||
173 | MaturePublish = xg.maturePublish, | ||
174 | Charter = xg.charter, | ||
175 | FounderID = xg.founderID, | ||
176 | // FIXME: group picture storage location unknown | ||
177 | MembershipFee = xg.membershipFee, | ||
178 | OpenEnrollment = xg.openEnrollment, | ||
179 | OwnerRoleID = xg.ownerRoleID, | ||
180 | ShowInList = xg.showInList | ||
181 | }; | ||
182 | |||
183 | return gr; | ||
113 | } | 184 | } |
114 | 185 | ||
115 | public GroupProfileData GetMemberGroupProfile(UUID requestingAgentID, UUID GroupID, UUID AgentID) | 186 | public GroupProfileData GetMemberGroupProfile(UUID requestingAgentID, UUID GroupID, UUID AgentID) |
diff --git a/OpenSim/Tests/Common/Mock/MockScriptEngine.cs b/OpenSim/Tests/Common/Mock/MockScriptEngine.cs new file mode 100644 index 0000000..b444241 --- /dev/null +++ b/OpenSim/Tests/Common/Mock/MockScriptEngine.cs | |||
@@ -0,0 +1,266 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Reflection; | ||
32 | using Nini.Config; | ||
33 | using OpenMetaverse; | ||
34 | using OpenSim.Framework; | ||
35 | using OpenSim.Region.Framework.Interfaces; | ||
36 | using OpenSim.Region.Framework.Scenes; | ||
37 | using OpenSim.Region.ScriptEngine.Interfaces; | ||
38 | using OpenSim.Region.ScriptEngine.Shared; | ||
39 | |||
40 | namespace OpenSim.Tests.Common | ||
41 | { | ||
42 | public class MockScriptEngine : INonSharedRegionModule, IScriptModule, IScriptEngine | ||
43 | { | ||
44 | public IConfigSource ConfigSource { get; private set; } | ||
45 | |||
46 | public IConfig Config { get; private set; } | ||
47 | |||
48 | private Scene m_scene; | ||
49 | |||
50 | /// <summary> | ||
51 | /// Expose posted events to tests. | ||
52 | /// </summary> | ||
53 | public Dictionary<UUID, List<EventParams>> PostedEvents { get; private set; } | ||
54 | |||
55 | /// <summary> | ||
56 | /// A very primitive way of hooking text cose to a posed event. | ||
57 | /// </summary> | ||
58 | /// <remarks> | ||
59 | /// May be replaced with something that uses more original code in the future. | ||
60 | /// </remarks> | ||
61 | public event Action<UUID, EventParams> PostEventHook; | ||
62 | |||
63 | public void Initialise(IConfigSource source) | ||
64 | { | ||
65 | ConfigSource = source; | ||
66 | |||
67 | // Can set later on if required | ||
68 | Config = new IniConfig("MockScriptEngine", ConfigSource); | ||
69 | |||
70 | PostedEvents = new Dictionary<UUID, List<EventParams>>(); | ||
71 | } | ||
72 | |||
73 | public void Close() | ||
74 | { | ||
75 | } | ||
76 | |||
77 | public void AddRegion(Scene scene) | ||
78 | { | ||
79 | m_scene = scene; | ||
80 | |||
81 | m_scene.StackModuleInterface<IScriptModule>(this); | ||
82 | } | ||
83 | |||
84 | public void RemoveRegion(Scene scene) | ||
85 | { | ||
86 | } | ||
87 | |||
88 | public void RegionLoaded(Scene scene) | ||
89 | { | ||
90 | } | ||
91 | |||
92 | public string Name { get { return "Mock Script Engine"; } } | ||
93 | public string ScriptEngineName { get { return Name; } } | ||
94 | |||
95 | public Type ReplaceableInterface { get { return null; } } | ||
96 | |||
97 | public event ScriptRemoved OnScriptRemoved; | ||
98 | public event ObjectRemoved OnObjectRemoved; | ||
99 | |||
100 | public string GetXMLState (UUID itemID) | ||
101 | { | ||
102 | throw new System.NotImplementedException (); | ||
103 | } | ||
104 | |||
105 | public bool SetXMLState(UUID itemID, string xml) | ||
106 | { | ||
107 | throw new System.NotImplementedException (); | ||
108 | } | ||
109 | |||
110 | public bool PostScriptEvent(UUID itemID, string name, object[] args) | ||
111 | { | ||
112 | // Console.WriteLine("Posting event {0} for {1}", name, itemID); | ||
113 | |||
114 | return PostScriptEvent(itemID, new EventParams(name, args, null)); | ||
115 | } | ||
116 | |||
117 | public bool PostScriptEvent(UUID itemID, EventParams evParams) | ||
118 | { | ||
119 | List<EventParams> eventsForItem; | ||
120 | |||
121 | if (!PostedEvents.ContainsKey(itemID)) | ||
122 | { | ||
123 | eventsForItem = new List<EventParams>(); | ||
124 | PostedEvents.Add(itemID, eventsForItem); | ||
125 | } | ||
126 | else | ||
127 | { | ||
128 | eventsForItem = PostedEvents[itemID]; | ||
129 | } | ||
130 | |||
131 | eventsForItem.Add(evParams); | ||
132 | |||
133 | if (PostEventHook != null) | ||
134 | PostEventHook(itemID, evParams); | ||
135 | |||
136 | return true; | ||
137 | } | ||
138 | |||
139 | public bool PostObjectEvent(uint localID, EventParams evParams) | ||
140 | { | ||
141 | return PostObjectEvent(m_scene.GetSceneObjectPart(localID), evParams); | ||
142 | } | ||
143 | |||
144 | public bool PostObjectEvent(UUID itemID, string name, object[] args) | ||
145 | { | ||
146 | return PostObjectEvent(m_scene.GetSceneObjectPart(itemID), new EventParams(name, args, null)); | ||
147 | } | ||
148 | |||
149 | private bool PostObjectEvent(SceneObjectPart part, EventParams evParams) | ||
150 | { | ||
151 | foreach (TaskInventoryItem item in part.Inventory.GetInventoryItems(InventoryType.LSL)) | ||
152 | PostScriptEvent(item.ItemID, evParams); | ||
153 | |||
154 | return true; | ||
155 | } | ||
156 | |||
157 | public void SuspendScript(UUID itemID) | ||
158 | { | ||
159 | throw new System.NotImplementedException (); | ||
160 | } | ||
161 | |||
162 | public void ResumeScript(UUID itemID) | ||
163 | { | ||
164 | throw new System.NotImplementedException (); | ||
165 | } | ||
166 | |||
167 | public ArrayList GetScriptErrors(UUID itemID) | ||
168 | { | ||
169 | throw new System.NotImplementedException (); | ||
170 | } | ||
171 | |||
172 | public bool HasScript(UUID itemID, out bool running) | ||
173 | { | ||
174 | throw new System.NotImplementedException (); | ||
175 | } | ||
176 | |||
177 | public bool GetScriptState(UUID itemID) | ||
178 | { | ||
179 | throw new System.NotImplementedException (); | ||
180 | } | ||
181 | |||
182 | public void SaveAllState() | ||
183 | { | ||
184 | throw new System.NotImplementedException (); | ||
185 | } | ||
186 | |||
187 | public void StartProcessing() | ||
188 | { | ||
189 | throw new System.NotImplementedException (); | ||
190 | } | ||
191 | |||
192 | public float GetScriptExecutionTime(List<UUID> itemIDs) | ||
193 | { | ||
194 | throw new System.NotImplementedException (); | ||
195 | } | ||
196 | |||
197 | public Dictionary<uint, float> GetObjectScriptsExecutionTimes() | ||
198 | { | ||
199 | throw new System.NotImplementedException (); | ||
200 | } | ||
201 | |||
202 | public IScriptWorkItem QueueEventHandler(object parms) | ||
203 | { | ||
204 | throw new System.NotImplementedException (); | ||
205 | } | ||
206 | |||
207 | public DetectParams GetDetectParams(UUID item, int number) | ||
208 | { | ||
209 | throw new System.NotImplementedException (); | ||
210 | } | ||
211 | |||
212 | public void SetMinEventDelay(UUID itemID, double delay) | ||
213 | { | ||
214 | throw new System.NotImplementedException (); | ||
215 | } | ||
216 | |||
217 | public int GetStartParameter(UUID itemID) | ||
218 | { | ||
219 | throw new System.NotImplementedException (); | ||
220 | } | ||
221 | |||
222 | public void SetScriptState(UUID itemID, bool state) | ||
223 | { | ||
224 | throw new System.NotImplementedException (); | ||
225 | } | ||
226 | |||
227 | public void SetState(UUID itemID, string newState) | ||
228 | { | ||
229 | throw new System.NotImplementedException (); | ||
230 | } | ||
231 | |||
232 | public void ApiResetScript(UUID itemID) | ||
233 | { | ||
234 | throw new System.NotImplementedException (); | ||
235 | } | ||
236 | |||
237 | public void ResetScript (UUID itemID) | ||
238 | { | ||
239 | throw new System.NotImplementedException (); | ||
240 | } | ||
241 | |||
242 | public IScriptApi GetApi(UUID itemID, string name) | ||
243 | { | ||
244 | throw new System.NotImplementedException (); | ||
245 | } | ||
246 | |||
247 | public Scene World { get { return m_scene; } } | ||
248 | |||
249 | public IScriptModule ScriptModule { get { return this; } } | ||
250 | |||
251 | public string ScriptEnginePath { get { throw new System.NotImplementedException (); }} | ||
252 | |||
253 | public string ScriptClassName { get { throw new System.NotImplementedException (); } } | ||
254 | |||
255 | public string ScriptBaseClassName { get { throw new System.NotImplementedException (); } } | ||
256 | |||
257 | public string[] ScriptReferencedAssemblies { get { throw new System.NotImplementedException (); } } | ||
258 | |||
259 | public ParameterInfo[] ScriptBaseClassParameters { get { throw new System.NotImplementedException (); } } | ||
260 | |||
261 | public void ClearPostedEvents() | ||
262 | { | ||
263 | PostedEvents.Clear(); | ||
264 | } | ||
265 | } | ||
266 | } \ No newline at end of file | ||
diff --git a/OpenSim/Tests/Common/Mock/TestScene.cs b/OpenSim/Tests/Common/Mock/TestScene.cs index d4b5648..a7e0dfb 100644 --- a/OpenSim/Tests/Common/Mock/TestScene.cs +++ b/OpenSim/Tests/Common/Mock/TestScene.cs | |||
@@ -41,10 +41,9 @@ namespace OpenSim.Tests.Common.Mock | |||
41 | public TestScene( | 41 | public TestScene( |
42 | RegionInfo regInfo, AgentCircuitManager authen, | 42 | RegionInfo regInfo, AgentCircuitManager authen, |
43 | SceneCommunicationService sceneGridService, ISimulationDataService simDataService, IEstateDataService estateDataService, | 43 | SceneCommunicationService sceneGridService, ISimulationDataService simDataService, IEstateDataService estateDataService, |
44 | bool dumpAssetsToFile, | ||
45 | IConfigSource config, string simulatorVersion) | 44 | IConfigSource config, string simulatorVersion) |
46 | : base(regInfo, authen, sceneGridService, simDataService, estateDataService, | 45 | : base(regInfo, authen, sceneGridService, simDataService, estateDataService, |
47 | dumpAssetsToFile, config, simulatorVersion) | 46 | config, simulatorVersion) |
48 | { | 47 | { |
49 | } | 48 | } |
50 | 49 | ||
diff --git a/OpenSim/Tests/Common/Mock/TestXInventoryDataPlugin.cs b/OpenSim/Tests/Common/Mock/TestXInventoryDataPlugin.cs index f9bf768..ccbdf81 100644 --- a/OpenSim/Tests/Common/Mock/TestXInventoryDataPlugin.cs +++ b/OpenSim/Tests/Common/Mock/TestXInventoryDataPlugin.cs | |||
@@ -33,10 +33,11 @@ using log4net; | |||
33 | using OpenMetaverse; | 33 | using OpenMetaverse; |
34 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using OpenSim.Data; | 35 | using OpenSim.Data; |
36 | using OpenSim.Data.Null; | ||
36 | 37 | ||
37 | namespace OpenSim.Tests.Common.Mock | 38 | namespace OpenSim.Tests.Common.Mock |
38 | { | 39 | { |
39 | public class TestXInventoryDataPlugin : IXInventoryData | 40 | public class TestXInventoryDataPlugin : NullGenericDataHandler, IXInventoryData |
40 | { | 41 | { |
41 | private Dictionary<UUID, XInventoryFolder> m_allFolders = new Dictionary<UUID, XInventoryFolder>(); | 42 | private Dictionary<UUID, XInventoryFolder> m_allFolders = new Dictionary<UUID, XInventoryFolder>(); |
42 | private Dictionary<UUID, XInventoryItem> m_allItems = new Dictionary<UUID, XInventoryItem>(); | 43 | private Dictionary<UUID, XInventoryItem> m_allItems = new Dictionary<UUID, XInventoryItem>(); |
@@ -58,28 +59,6 @@ namespace OpenSim.Tests.Common.Mock | |||
58 | return origFolders.Select(f => f.Clone()).ToArray(); | 59 | return origFolders.Select(f => f.Clone()).ToArray(); |
59 | } | 60 | } |
60 | 61 | ||
61 | private List<T> Get<T>(string[] fields, string[] vals, List<T> inputEntities) | ||
62 | { | ||
63 | List<T> entities = inputEntities; | ||
64 | |||
65 | for (int i = 0; i < fields.Length; i++) | ||
66 | { | ||
67 | entities | ||
68 | = entities.Where( | ||
69 | e => | ||
70 | { | ||
71 | FieldInfo fi = typeof(T).GetField(fields[i]); | ||
72 | if (fi == null) | ||
73 | throw new NotImplementedException(string.Format("No field {0} for val {1}", fields[i], vals[i])); | ||
74 | |||
75 | return fi.GetValue(e).ToString() == vals[i]; | ||
76 | } | ||
77 | ).ToList(); | ||
78 | } | ||
79 | |||
80 | return entities; | ||
81 | } | ||
82 | |||
83 | public bool StoreFolder(XInventoryFolder folder) | 62 | public bool StoreFolder(XInventoryFolder folder) |
84 | { | 63 | { |
85 | m_allFolders[folder.folderID] = folder.Clone(); | 64 | m_allFolders[folder.folderID] = folder.Clone(); |
diff --git a/OpenSim/Tests/Common/TestHelpers.cs b/OpenSim/Tests/Common/TestHelpers.cs index 57da802..a684d72 100644 --- a/OpenSim/Tests/Common/TestHelpers.cs +++ b/OpenSim/Tests/Common/TestHelpers.cs | |||
@@ -114,6 +114,27 @@ namespace OpenSim.Tests.Common | |||
114 | } | 114 | } |
115 | 115 | ||
116 | /// <summary> | 116 | /// <summary> |
117 | /// Parse a UUID stem into a full UUID. | ||
118 | /// </summary> | ||
119 | /// <remarks> | ||
120 | /// Yes, this is completely inconsistent with ParseTail but this is probably a better way to do it, | ||
121 | /// UUIDs are conceptually not hexadecmial numbers. | ||
122 | /// The fragment will come at the start of the UUID. The rest will be 0s | ||
123 | /// </remarks> | ||
124 | /// <returns></returns> | ||
125 | /// <param name='frag'> | ||
126 | /// A UUID fragment that will be parsed into a full UUID. Therefore, it can only contain | ||
127 | /// cahracters which are valid in a UUID, except for "-" which is currently only allowed if a full UUID is | ||
128 | /// given as the 'fragment'. | ||
129 | /// </param> | ||
130 | public static UUID ParseStem(string stem) | ||
131 | { | ||
132 | string rawUuid = stem.PadRight(32, '0'); | ||
133 | |||
134 | return UUID.Parse(rawUuid); | ||
135 | } | ||
136 | |||
137 | /// <summary> | ||
117 | /// Parse tail section into full UUID. | 138 | /// Parse tail section into full UUID. |
118 | /// </summary> | 139 | /// </summary> |
119 | /// <param name="tail"></param> | 140 | /// <param name="tail"></param> |
diff --git a/OpenSim/Tests/ConfigurationLoaderTest.cs b/OpenSim/Tests/ConfigurationLoaderTest.cs index 067264d..a409a13 100644 --- a/OpenSim/Tests/ConfigurationLoaderTest.cs +++ b/OpenSim/Tests/ConfigurationLoaderTest.cs | |||
@@ -29,11 +29,12 @@ using System.IO; | |||
29 | using Nini.Config; | 29 | using Nini.Config; |
30 | using NUnit.Framework; | 30 | using NUnit.Framework; |
31 | using OpenSim.Framework; | 31 | using OpenSim.Framework; |
32 | using OpenSim.Tests.Common; | ||
32 | 33 | ||
33 | namespace OpenSim.Tests | 34 | namespace OpenSim.Tests |
34 | { | 35 | { |
35 | [TestFixture] | 36 | [TestFixture] |
36 | public class ConfigurationLoaderTests | 37 | public class ConfigurationLoaderTests : OpenSimTestCase |
37 | { | 38 | { |
38 | private const string m_testSubdirectory = "test"; | 39 | private const string m_testSubdirectory = "test"; |
39 | private string m_basePath; | 40 | private string m_basePath; |
@@ -44,8 +45,10 @@ namespace OpenSim.Tests | |||
44 | /// Set up a test directory. | 45 | /// Set up a test directory. |
45 | /// </summary> | 46 | /// </summary> |
46 | [SetUp] | 47 | [SetUp] |
47 | public void SetUp() | 48 | public override void SetUp() |
48 | { | 49 | { |
50 | base.SetUp(); | ||
51 | |||
49 | m_basePath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); | 52 | m_basePath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); |
50 | string path = Path.Combine(m_basePath, m_testSubdirectory); | 53 | string path = Path.Combine(m_basePath, m_testSubdirectory); |
51 | Directory.CreateDirectory(path); | 54 | Directory.CreateDirectory(path); |
diff --git a/OpenSim/Tests/Performance/NPCPerformanceTests.cs b/OpenSim/Tests/Performance/NPCPerformanceTests.cs index afda574..fde1b91 100644 --- a/OpenSim/Tests/Performance/NPCPerformanceTests.cs +++ b/OpenSim/Tests/Performance/NPCPerformanceTests.cs | |||
@@ -58,7 +58,7 @@ namespace OpenSim.Tests.Performance | |||
58 | /// earlier tests. | 58 | /// earlier tests. |
59 | /// </remarks> | 59 | /// </remarks> |
60 | [TestFixture] | 60 | [TestFixture] |
61 | public class NPCPerformanceTests | 61 | public class NPCPerformanceTests : OpenSimTestCase |
62 | { | 62 | { |
63 | private TestScene scene; | 63 | private TestScene scene; |
64 | private AvatarFactoryModule afm; | 64 | private AvatarFactoryModule afm; |
diff --git a/OpenSim/Tests/Performance/ObjectPerformanceTests.cs b/OpenSim/Tests/Performance/ObjectPerformanceTests.cs index 2264d86..656a971 100644 --- a/OpenSim/Tests/Performance/ObjectPerformanceTests.cs +++ b/OpenSim/Tests/Performance/ObjectPerformanceTests.cs | |||
@@ -47,7 +47,7 @@ namespace OpenSim.Tests.Performance | |||
47 | /// earlier tests. | 47 | /// earlier tests. |
48 | /// </remarks> | 48 | /// </remarks> |
49 | [TestFixture] | 49 | [TestFixture] |
50 | public class ObjectPerformanceTests | 50 | public class ObjectPerformanceTests : OpenSimTestCase |
51 | { | 51 | { |
52 | [TearDown] | 52 | [TearDown] |
53 | public void TearDown() | 53 | public void TearDown() |
diff --git a/OpenSim/Tests/Performance/ScriptPerformanceTests.cs b/OpenSim/Tests/Performance/ScriptPerformanceTests.cs index d708abd..4064edc 100644 --- a/OpenSim/Tests/Performance/ScriptPerformanceTests.cs +++ b/OpenSim/Tests/Performance/ScriptPerformanceTests.cs | |||
@@ -53,7 +53,7 @@ namespace OpenSim.Tests.Performance | |||
53 | /// earlier tests. | 53 | /// earlier tests. |
54 | /// </remarks> | 54 | /// </remarks> |
55 | [TestFixture] | 55 | [TestFixture] |
56 | public class ScriptPerformanceTests | 56 | public class ScriptPerformanceTests : OpenSimTestCase |
57 | { | 57 | { |
58 | private TestScene m_scene; | 58 | private TestScene m_scene; |
59 | private XEngine m_xEngine; | 59 | private XEngine m_xEngine; |