diff options
Diffstat (limited to 'OpenSim/Tests')
-rw-r--r-- | OpenSim/Tests/Common/Helpers/SceneHelpers.cs | 42 | ||||
-rw-r--r-- | OpenSim/Tests/Common/Mock/MockGroupsServicesConnector.cs | 77 | ||||
-rw-r--r-- | OpenSim/Tests/Common/Mock/TestClient.cs | 10 | ||||
-rw-r--r-- | OpenSim/Tests/Common/Mock/TestScene.cs | 6 | ||||
-rw-r--r-- | OpenSim/Tests/Common/Mock/TestXInventoryDataPlugin.cs | 26 | ||||
-rw-r--r-- | OpenSim/Tests/ConfigurationLoaderTest.cs | 3 | ||||
-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 |
9 files changed, 102 insertions, 68 deletions
diff --git a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs index fc49169..ea3e348 100644 --- a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs | |||
@@ -139,11 +139,11 @@ 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, null, false, configSource, null); | 142 | regInfo, m_acm, scs, m_simDataService, m_estateDataService, false, configSource, null); |
143 | 143 | ||
144 | IRegionModule godsModule = new GodsModule(); | 144 | INonSharedRegionModule godsModule = new GodsModule(); |
145 | godsModule.Initialise(testScene, new IniConfigSource()); | 145 | godsModule.Initialise(new IniConfigSource()); |
146 | testScene.AddModule(godsModule.Name, godsModule); | 146 | godsModule.AddRegion(testScene); |
147 | 147 | ||
148 | // Add scene to services | 148 | // Add scene to services |
149 | m_assetService.AddRegion(testScene); | 149 | m_assetService.AddRegion(testScene); |
@@ -350,6 +350,10 @@ namespace OpenSim.Tests.Common | |||
350 | /// </summary> | 350 | /// </summary> |
351 | /// <remarks> | 351 | /// <remarks> |
352 | /// If called directly, then all the modules must be shared modules. | 352 | /// If called directly, then all the modules must be shared modules. |
353 | /// | ||
354 | /// We are emulating here the normal calls made to setup region modules | ||
355 | /// (Initialise(), PostInitialise(), AddRegion, RegionLoaded()). | ||
356 | /// TODO: Need to reuse normal runtime module code. | ||
353 | /// </remarks> | 357 | /// </remarks> |
354 | /// <param name="scenes"></param> | 358 | /// <param name="scenes"></param> |
355 | /// <param name="config"></param> | 359 | /// <param name="config"></param> |
@@ -359,28 +363,10 @@ namespace OpenSim.Tests.Common | |||
359 | List<IRegionModuleBase> newModules = new List<IRegionModuleBase>(); | 363 | List<IRegionModuleBase> newModules = new List<IRegionModuleBase>(); |
360 | foreach (object module in modules) | 364 | foreach (object module in modules) |
361 | { | 365 | { |
362 | // Console.WriteLine("MODULE RAW {0}", module); | 366 | IRegionModuleBase m = (IRegionModuleBase)module; |
363 | if (module is IRegionModule) | 367 | // Console.WriteLine("MODULE {0}", m.Name); |
364 | { | 368 | m.Initialise(config); |
365 | IRegionModule m = (IRegionModule)module; | 369 | newModules.Add(m); |
366 | |||
367 | foreach (Scene scene in scenes) | ||
368 | { | ||
369 | m.Initialise(scene, config); | ||
370 | scene.AddModule(m.Name, m); | ||
371 | } | ||
372 | |||
373 | m.PostInitialise(); | ||
374 | } | ||
375 | else if (module is IRegionModuleBase) | ||
376 | { | ||
377 | // for the new system, everything has to be initialised first, | ||
378 | // shared modules have to be post-initialised, then all get an AddRegion with the scene | ||
379 | IRegionModuleBase m = (IRegionModuleBase)module; | ||
380 | // Console.WriteLine("MODULE {0}", m.Name); | ||
381 | m.Initialise(config); | ||
382 | newModules.Add(m); | ||
383 | } | ||
384 | } | 370 | } |
385 | 371 | ||
386 | foreach (IRegionModuleBase module in newModules) | 372 | foreach (IRegionModuleBase module in newModules) |
@@ -396,7 +382,7 @@ namespace OpenSim.Tests.Common | |||
396 | scene.AddRegionModule(module.Name, module); | 382 | scene.AddRegionModule(module.Name, module); |
397 | } | 383 | } |
398 | } | 384 | } |
399 | 385 | ||
400 | // RegionLoaded is fired after all modules have been appropriately added to all scenes | 386 | // RegionLoaded is fired after all modules have been appropriately added to all scenes |
401 | foreach (IRegionModuleBase module in newModules) | 387 | foreach (IRegionModuleBase module in newModules) |
402 | foreach (Scene scene in scenes) | 388 | foreach (Scene scene in scenes) |
@@ -709,4 +695,4 @@ namespace OpenSim.Tests.Common | |||
709 | return sog; | 695 | return sog; |
710 | } | 696 | } |
711 | } | 697 | } |
712 | } \ No newline at end of file | 698 | } |
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/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs index bb8b935..dde37ab 100644 --- a/OpenSim/Tests/Common/Mock/TestClient.cs +++ b/OpenSim/Tests/Common/Mock/TestClient.cs | |||
@@ -528,13 +528,9 @@ namespace OpenSim.Tests.Common.Mock | |||
528 | { | 528 | { |
529 | } | 529 | } |
530 | 530 | ||
531 | public virtual void SendChatMessage(string message, byte type, Vector3 fromPos, string fromName, | 531 | public virtual void SendChatMessage( |
532 | UUID fromAgentID, byte source, byte audible) | 532 | string message, byte type, Vector3 fromPos, string fromName, |
533 | { | 533 | UUID fromAgentID, UUID ownerID, byte source, byte audible) |
534 | } | ||
535 | |||
536 | public virtual void SendChatMessage(byte[] message, byte type, Vector3 fromPos, string fromName, | ||
537 | UUID fromAgentID, byte source, byte audible) | ||
538 | { | 534 | { |
539 | } | 535 | } |
540 | 536 | ||
diff --git a/OpenSim/Tests/Common/Mock/TestScene.cs b/OpenSim/Tests/Common/Mock/TestScene.cs index eea68c3..d4b5648 100644 --- a/OpenSim/Tests/Common/Mock/TestScene.cs +++ b/OpenSim/Tests/Common/Mock/TestScene.cs | |||
@@ -41,9 +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 | ModuleLoader moduleLoader, bool dumpAssetsToFile, | 44 | bool dumpAssetsToFile, |
45 | IConfigSource config, string simulatorVersion) | 45 | IConfigSource config, string simulatorVersion) |
46 | : base(regInfo, authen, sceneGridService, simDataService, estateDataService, moduleLoader, | 46 | : base(regInfo, authen, sceneGridService, simDataService, estateDataService, |
47 | dumpAssetsToFile, config, simulatorVersion) | 47 | dumpAssetsToFile, config, simulatorVersion) |
48 | { | 48 | { |
49 | } | 49 | } |
@@ -73,4 +73,4 @@ namespace OpenSim.Tests.Common.Mock | |||
73 | get { return m_asyncSceneObjectDeleter; } | 73 | get { return m_asyncSceneObjectDeleter; } |
74 | } | 74 | } |
75 | } | 75 | } |
76 | } \ No newline at end of file | 76 | } |
diff --git a/OpenSim/Tests/Common/Mock/TestXInventoryDataPlugin.cs b/OpenSim/Tests/Common/Mock/TestXInventoryDataPlugin.cs index bca5979..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(); |
@@ -125,6 +104,7 @@ namespace OpenSim.Tests.Common.Mock | |||
125 | } | 104 | } |
126 | 105 | ||
127 | public bool MoveItem(string id, string newParent) { throw new NotImplementedException(); } | 106 | public bool MoveItem(string id, string newParent) { throw new NotImplementedException(); } |
107 | public bool MoveFolder(string id, string newParent) { throw new NotImplementedException(); } | ||
128 | public XInventoryItem[] GetActiveGestures(UUID principalID) { throw new NotImplementedException(); } | 108 | public XInventoryItem[] GetActiveGestures(UUID principalID) { throw new NotImplementedException(); } |
129 | public int GetAssetPermissions(UUID principalID, UUID assetID) { throw new NotImplementedException(); } | 109 | public int GetAssetPermissions(UUID principalID, UUID assetID) { throw new NotImplementedException(); } |
130 | } | 110 | } |
diff --git a/OpenSim/Tests/ConfigurationLoaderTest.cs b/OpenSim/Tests/ConfigurationLoaderTest.cs index 067264d..e5186ae 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; |
diff --git a/OpenSim/Tests/Performance/NPCPerformanceTests.cs b/OpenSim/Tests/Performance/NPCPerformanceTests.cs index 627765b..2026a88 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; |