diff options
author | Arthur Valadares | 2009-08-11 12:07:54 -0300 |
---|---|---|
committer | Arthur Valadares | 2009-08-11 12:07:54 -0300 |
commit | 18aa2ea0c5ebd8d5131902ed9856e68f46e76e11 (patch) | |
tree | c4adcda365c46052c3d15b4e6395e1bb8a2e97c5 /OpenSim | |
parent | Replace the Replaceable modules name (diff) | |
download | opensim-SC_OLD-18aa2ea0c5ebd8d5131902ed9856e68f46e76e11.zip opensim-SC_OLD-18aa2ea0c5ebd8d5131902ed9856e68f46e76e11.tar.gz opensim-SC_OLD-18aa2ea0c5ebd8d5131902ed9856e68f46e76e11.tar.bz2 opensim-SC_OLD-18aa2ea0c5ebd8d5131902ed9856e68f46e76e11.tar.xz |
* Improves SceneSetupHelper to allow the tester to choose a real or mock, inventory and asset, service modules. The boolean startServices was replaced with realServices string. If the string contains the word asset, it will start a real asset module, if it contains inventory, it starts a real inventory. Otherwise, it use mock (NullPlugin-like) objects, for tests that don't really need functionality.
* SetupScene is now actually sharing the asset and inventory modules if the tester wishes to have multiple regions connected. To link regions, just start SetupScene with the same CommunicationManager for all scenes. SceneSetupHelper will hold a static reference to the modules and won't initialize them again, just run the scenes through the modules AddRegion, RegionLoaded and PostInitialize.
* With the recent changes, both asset and inventory (and in the future, user) services should always be asked from the scene, not instantiated alone. The tests should reflect this new behavior and always start a scene.
Diffstat (limited to 'OpenSim')
9 files changed, 240 insertions, 163 deletions
diff --git a/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs b/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs index fdc20dd..0402883 100644 --- a/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs +++ b/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs | |||
@@ -54,6 +54,7 @@ namespace OpenSim.Framework.Communications.Tests | |||
54 | CachedUserInfo nonExistingUserInfo; | 54 | CachedUserInfo nonExistingUserInfo; |
55 | 55 | ||
56 | TestCommunicationsManager commsManager = new TestCommunicationsManager(); | 56 | TestCommunicationsManager commsManager = new TestCommunicationsManager(); |
57 | Scene myScene = SceneSetupHelpers.SetupScene(commsManager, ""); | ||
57 | 58 | ||
58 | // Check we can't retrieve info before it exists by uuid | 59 | // Check we can't retrieve info before it exists by uuid |
59 | nonExistingUserInfo = commsManager.UserProfileCacheService.GetUserDetails(userId); | 60 | nonExistingUserInfo = commsManager.UserProfileCacheService.GetUserDetails(userId); |
@@ -116,7 +117,7 @@ namespace OpenSim.Framework.Communications.Tests | |||
116 | { | 117 | { |
117 | TestHelper.InMethod(); | 118 | TestHelper.InMethod(); |
118 | 119 | ||
119 | Scene myScene = SceneSetupHelpers.SetupScene(); | 120 | Scene myScene = SceneSetupHelpers.SetupScene("inventory"); |
120 | CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager); | 121 | CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager); |
121 | for (int i = 0 ; i < 50 ; i++) | 122 | for (int i = 0 ; i < 50 ; i++) |
122 | { | 123 | { |
@@ -132,7 +133,7 @@ namespace OpenSim.Framework.Communications.Tests | |||
132 | { | 133 | { |
133 | TestHelper.InMethod(); | 134 | TestHelper.InMethod(); |
134 | 135 | ||
135 | Scene myScene = SceneSetupHelpers.SetupScene(); | 136 | Scene myScene = SceneSetupHelpers.SetupScene("inventory"); |
136 | CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager); | 137 | CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager); |
137 | for (int i = 0 ; i < 50 ; i++) | 138 | for (int i = 0 ; i < 50 ; i++) |
138 | { | 139 | { |
@@ -154,7 +155,7 @@ namespace OpenSim.Framework.Communications.Tests | |||
154 | { | 155 | { |
155 | TestHelper.InMethod(); | 156 | TestHelper.InMethod(); |
156 | 157 | ||
157 | Scene myScene = SceneSetupHelpers.SetupScene(); | 158 | Scene myScene = SceneSetupHelpers.SetupScene("inventory"); |
158 | CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager); | 159 | CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager); |
159 | for (int i = 0 ; i < 50 ; i++) | 160 | for (int i = 0 ; i < 50 ; i++) |
160 | { | 161 | { |
@@ -190,7 +191,7 @@ namespace OpenSim.Framework.Communications.Tests | |||
190 | { | 191 | { |
191 | TestHelper.InMethod(); | 192 | TestHelper.InMethod(); |
192 | 193 | ||
193 | Scene myScene = SceneSetupHelpers.SetupScene(); | 194 | Scene myScene = SceneSetupHelpers.SetupScene("inventory"); |
194 | CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager); | 195 | CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager); |
195 | for (int i = 0 ; i < 50 ; i++) | 196 | for (int i = 0 ; i < 50 ; i++) |
196 | { | 197 | { |
@@ -256,7 +257,7 @@ namespace OpenSim.Framework.Communications.Tests | |||
256 | { | 257 | { |
257 | TestHelper.InMethod(); | 258 | TestHelper.InMethod(); |
258 | 259 | ||
259 | Scene myScene = SceneSetupHelpers.SetupScene(); | 260 | Scene myScene = SceneSetupHelpers.SetupScene("inventory"); |
260 | CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager); | 261 | CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager); |
261 | for (int i = 0 ; i < 50 ; i++) | 262 | for (int i = 0 ; i < 50 ; i++) |
262 | { | 263 | { |
@@ -297,7 +298,7 @@ namespace OpenSim.Framework.Communications.Tests | |||
297 | TestHelper.InMethod(); | 298 | TestHelper.InMethod(); |
298 | //log4net.Config.XmlConfigurator.Configure(); | 299 | //log4net.Config.XmlConfigurator.Configure(); |
299 | 300 | ||
300 | Scene myScene = SceneSetupHelpers.SetupScene(); | 301 | Scene myScene = SceneSetupHelpers.SetupScene("inventory"); |
301 | CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager); | 302 | CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager); |
302 | for (int i = 0 ; i < 50 ; i++) | 303 | for (int i = 0 ; i < 50 ; i++) |
303 | { | 304 | { |
diff --git a/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs b/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs index 47e0293..9e181f3 100644 --- a/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs +++ b/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs | |||
@@ -36,6 +36,7 @@ using Nwc.XmlRpc; | |||
36 | using OpenSim.Framework.Communications.Cache; | 36 | using OpenSim.Framework.Communications.Cache; |
37 | using OpenSim.Framework.Communications.Services; | 37 | using OpenSim.Framework.Communications.Services; |
38 | using OpenSim.Region.Communications.Local; | 38 | using OpenSim.Region.Communications.Local; |
39 | using OpenSim.Tests.Common.Setup; | ||
39 | using OpenSim.Tests.Common.Mock; | 40 | using OpenSim.Tests.Common.Mock; |
40 | using OpenSim.Client.Linden; | 41 | using OpenSim.Client.Linden; |
41 | using OpenSim.Tests.Common; | 42 | using OpenSim.Tests.Common; |
@@ -57,11 +58,12 @@ namespace OpenSim.Framework.Communications.Tests | |||
57 | private string m_regionExternalName = "localhost"; | 58 | private string m_regionExternalName = "localhost"; |
58 | 59 | ||
59 | private IPEndPoint m_capsEndPoint; | 60 | private IPEndPoint m_capsEndPoint; |
60 | private CommunicationsManager m_commsManager; | 61 | private TestCommunicationsManager m_commsManager; |
61 | private TestLoginToRegionConnector m_regionConnector; | 62 | private TestLoginToRegionConnector m_regionConnector; |
62 | private LocalUserServices m_localUserServices; | 63 | private LocalUserServices m_localUserServices; |
63 | private LoginService m_loginService; | 64 | private LoginService m_loginService; |
64 | private UserProfileData m_userProfileData; | 65 | private UserProfileData m_userProfileData; |
66 | private TestScene m_testScene; | ||
65 | 67 | ||
66 | [SetUp] | 68 | [SetUp] |
67 | public void SetUpLoginEnviroment() | 69 | public void SetUpLoginEnviroment() |
@@ -69,13 +71,16 @@ namespace OpenSim.Framework.Communications.Tests | |||
69 | m_capsEndPoint = new IPEndPoint(IPAddress.Loopback, 9123); | 71 | m_capsEndPoint = new IPEndPoint(IPAddress.Loopback, 9123); |
70 | m_commsManager = new TestCommunicationsManager(new NetworkServersInfo(42, 43)); | 72 | m_commsManager = new TestCommunicationsManager(new NetworkServersInfo(42, 43)); |
71 | m_regionConnector = new TestLoginToRegionConnector(); | 73 | m_regionConnector = new TestLoginToRegionConnector(); |
74 | m_testScene = SceneSetupHelpers.SetupScene(m_commsManager, ""); | ||
72 | 75 | ||
73 | m_regionConnector.AddRegion(new RegionInfo(42, 43, m_capsEndPoint, m_regionExternalName)); | 76 | m_regionConnector.AddRegion(new RegionInfo(42, 43, m_capsEndPoint, m_regionExternalName)); |
74 | 77 | ||
78 | //IInventoryService m_inventoryService = new TestInventoryService(); | ||
79 | |||
75 | m_localUserServices = (LocalUserServices) m_commsManager.UserService; | 80 | m_localUserServices = (LocalUserServices) m_commsManager.UserService; |
76 | m_localUserServices.AddUser(m_firstName,m_lastName,"boingboing","abc@ftw.com",42,43); | 81 | m_localUserServices.AddUser(m_firstName,m_lastName,"boingboing","abc@ftw.com",42,43); |
77 | 82 | ||
78 | m_loginService = new LLStandaloneLoginService((UserManagerBase) m_localUserServices, "Hello folks", new TestInventoryService(), | 83 | m_loginService = new LLStandaloneLoginService((UserManagerBase) m_localUserServices, "Hello folks", m_testScene.InventoryService, |
79 | m_commsManager.NetworkServersInfo, true, new LibraryRootFolder(String.Empty), m_regionConnector); | 84 | m_commsManager.NetworkServersInfo, true, new LibraryRootFolder(String.Empty), m_regionConnector); |
80 | 85 | ||
81 | m_userProfileData = m_localUserServices.GetUserProfile(m_firstName, m_lastName); | 86 | m_userProfileData = m_localUserServices.GetUserProfile(m_firstName, m_lastName); |
@@ -442,123 +447,4 @@ namespace OpenSim.Framework.Communications.Tests | |||
442 | #endregion | 447 | #endregion |
443 | } | 448 | } |
444 | } | 449 | } |
445 | |||
446 | class TestInventoryService : IInventoryService | ||
447 | { | ||
448 | public TestInventoryService() | ||
449 | { | ||
450 | } | ||
451 | |||
452 | /// <summary> | ||
453 | /// <see cref="OpenSim.Framework.Communications.IInterServiceInventoryServices"/> | ||
454 | /// </summary> | ||
455 | /// <param name="userId"></param> | ||
456 | /// <returns></returns> | ||
457 | public bool CreateUserInventory(UUID userId) | ||
458 | { | ||
459 | return false; | ||
460 | } | ||
461 | |||
462 | /// <summary> | ||
463 | /// <see cref="OpenSim.Framework.Communications.IInterServiceInventoryServices"/> | ||
464 | /// </summary> | ||
465 | /// <param name="userId"></param> | ||
466 | /// <returns></returns> | ||
467 | public List<InventoryFolderBase> GetInventorySkeleton(UUID userId) | ||
468 | { | ||
469 | List<InventoryFolderBase> folders = new List<InventoryFolderBase>(); | ||
470 | InventoryFolderBase folder = new InventoryFolderBase(); | ||
471 | folder.ID = UUID.Random(); | ||
472 | folder.Owner = userId; | ||
473 | folders.Add(folder); | ||
474 | return folders; | ||
475 | } | ||
476 | |||
477 | /// <summary> | ||
478 | /// Returns a list of all the active gestures in a user's inventory. | ||
479 | /// </summary> | ||
480 | /// <param name="userId"> | ||
481 | /// The <see cref="UUID"/> of the user | ||
482 | /// </param> | ||
483 | /// <returns> | ||
484 | /// A flat list of the gesture items. | ||
485 | /// </returns> | ||
486 | public List<InventoryItemBase> GetActiveGestures(UUID userId) | ||
487 | { | ||
488 | return null; | ||
489 | } | ||
490 | |||
491 | public InventoryCollection GetUserInventory(UUID userID) | ||
492 | { | ||
493 | return null; | ||
494 | } | ||
495 | |||
496 | public void GetUserInventory(UUID userID, OpenSim.Services.Interfaces.InventoryReceiptCallback callback) | ||
497 | { | ||
498 | } | ||
499 | |||
500 | public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID) | ||
501 | { | ||
502 | return null; | ||
503 | } | ||
504 | |||
505 | public bool AddFolder(InventoryFolderBase folder) | ||
506 | { | ||
507 | return false; | ||
508 | } | ||
509 | |||
510 | public bool UpdateFolder(InventoryFolderBase folder) | ||
511 | { | ||
512 | return false; | ||
513 | } | ||
514 | |||
515 | public bool MoveFolder(InventoryFolderBase folder) | ||
516 | { | ||
517 | return false; | ||
518 | } | ||
519 | |||
520 | public bool PurgeFolder(InventoryFolderBase folder) | ||
521 | { | ||
522 | return false; | ||
523 | } | ||
524 | |||
525 | public bool AddItem(InventoryItemBase item) | ||
526 | { | ||
527 | return false; | ||
528 | } | ||
529 | |||
530 | public bool UpdateItem(InventoryItemBase item) | ||
531 | { | ||
532 | return false; | ||
533 | } | ||
534 | |||
535 | public bool DeleteItem(InventoryItemBase item) | ||
536 | { | ||
537 | return false; | ||
538 | } | ||
539 | |||
540 | public InventoryItemBase QueryItem(InventoryItemBase item) | ||
541 | { | ||
542 | return null; | ||
543 | } | ||
544 | |||
545 | public InventoryFolderBase QueryFolder(InventoryFolderBase folder) | ||
546 | { | ||
547 | return null; | ||
548 | } | ||
549 | |||
550 | public bool HasInventoryForUser(UUID userID) | ||
551 | { | ||
552 | return false; | ||
553 | } | ||
554 | |||
555 | public InventoryFolderBase RequestRootFolder(UUID userID) | ||
556 | { | ||
557 | InventoryFolderBase root = new InventoryFolderBase(); | ||
558 | root.ID = UUID.Random(); | ||
559 | root.Owner = userID; | ||
560 | root.ParentID = UUID.Zero; | ||
561 | return root; | ||
562 | } | ||
563 | } | ||
564 | } | 450 | } |
diff --git a/OpenSim/Framework/Communications/UserManagerBase.cs b/OpenSim/Framework/Communications/UserManagerBase.cs index bd5d0e3..b9044eb 100644 --- a/OpenSim/Framework/Communications/UserManagerBase.cs +++ b/OpenSim/Framework/Communications/UserManagerBase.cs | |||
@@ -698,7 +698,7 @@ namespace OpenSim.Framework.Communications | |||
698 | if (rootfolder != null) | 698 | if (rootfolder != null) |
699 | userProf.RootInventoryFolderID = rootfolder.ID; | 699 | userProf.RootInventoryFolderID = rootfolder.ID; |
700 | } | 700 | } |
701 | else if (m_commsManager.InterServiceInventoryService != null) | 701 | else |
702 | { | 702 | { |
703 | // used by the user server | 703 | // used by the user server |
704 | m_log.Debug("[USERSTORAGE]: using m_commsManager.InterServiceInventoryService to create user's inventory"); | 704 | m_log.Debug("[USERSTORAGE]: using m_commsManager.InterServiceInventoryService to create user's inventory"); |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index 12d3e95..1480512 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs | |||
@@ -74,7 +74,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
74 | 74 | ||
75 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(); | 75 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(); |
76 | 76 | ||
77 | Scene scene = SceneSetupHelpers.SetupScene(false); | 77 | Scene scene = SceneSetupHelpers.SetupScene(""); |
78 | SceneSetupHelpers.SetupSceneModules(scene, archiverModule); | 78 | SceneSetupHelpers.SetupSceneModules(scene, archiverModule); |
79 | CommunicationsManager cm = scene.CommsManager; | 79 | CommunicationsManager cm = scene.CommsManager; |
80 | 80 | ||
@@ -363,7 +363,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
363 | public void TestReplicateArchivePathToUserInventory() | 363 | public void TestReplicateArchivePathToUserInventory() |
364 | { | 364 | { |
365 | TestHelper.InMethod(); | 365 | TestHelper.InMethod(); |
366 | Scene scene = SceneSetupHelpers.SetupScene(false); | 366 | Scene scene = SceneSetupHelpers.SetupScene(""); |
367 | CommunicationsManager commsManager = scene.CommsManager; | 367 | CommunicationsManager commsManager = scene.CommsManager; |
368 | 368 | ||
369 | CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager); | 369 | CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager); |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs index ed280c8..5c42e94 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs | |||
@@ -87,7 +87,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests | |||
87 | SerialiserModule serialiserModule = new SerialiserModule(); | 87 | SerialiserModule serialiserModule = new SerialiserModule(); |
88 | TerrainModule terrainModule = new TerrainModule(); | 88 | TerrainModule terrainModule = new TerrainModule(); |
89 | 89 | ||
90 | Scene scene = SceneSetupHelpers.SetupScene(false); | 90 | Scene scene = SceneSetupHelpers.SetupScene("asset"); |
91 | SceneSetupHelpers.SetupSceneModules(scene, archiverModule, serialiserModule, terrainModule); | 91 | SceneSetupHelpers.SetupSceneModules(scene, archiverModule, serialiserModule, terrainModule); |
92 | 92 | ||
93 | SceneObjectPart part1; | 93 | SceneObjectPart part1; |
diff --git a/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs b/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs index c894d8e..373b6ab 100644 --- a/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs +++ b/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs | |||
@@ -237,7 +237,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests | |||
237 | public void Init() | 237 | public void Init() |
238 | { | 238 | { |
239 | m_serialiserModule = new SerialiserModule(); | 239 | m_serialiserModule = new SerialiserModule(); |
240 | m_scene = SceneSetupHelpers.SetupScene(false); | 240 | m_scene = SceneSetupHelpers.SetupScene(""); |
241 | SceneSetupHelpers.SetupSceneModules(m_scene, m_serialiserModule); | 241 | SceneSetupHelpers.SetupSceneModules(m_scene, m_serialiserModule); |
242 | } | 242 | } |
243 | 243 | ||
diff --git a/OpenSim/Tests/Common/Mock/TestAssetService.cs b/OpenSim/Tests/Common/Mock/TestAssetService.cs index d35e3ed..5f1184b 100644 --- a/OpenSim/Tests/Common/Mock/TestAssetService.cs +++ b/OpenSim/Tests/Common/Mock/TestAssetService.cs | |||
@@ -31,13 +31,18 @@ using OpenMetaverse; | |||
31 | using OpenSim.Framework; | 31 | using OpenSim.Framework; |
32 | using OpenSim.Data; | 32 | using OpenSim.Data; |
33 | using OpenSim.Services.Interfaces; | 33 | using OpenSim.Services.Interfaces; |
34 | using Nini.Config; | ||
34 | 35 | ||
35 | namespace OpenSim.Tests.Common.Mock | 36 | namespace OpenSim.Tests.Common.Mock |
36 | { | 37 | { |
37 | public class TestAssetService : IAssetService | 38 | public class TestAssetService : IAssetService |
38 | { | 39 | { |
39 | private readonly Dictionary<string, AssetBase> Assets = new Dictionary<string, AssetBase>(); | 40 | private readonly Dictionary<string, AssetBase> Assets = new Dictionary<string, AssetBase>(); |
40 | 41 | ||
42 | public TestAssetService(IConfigSource config) | ||
43 | { | ||
44 | } | ||
45 | |||
41 | public AssetBase Get(string id) | 46 | public AssetBase Get(string id) |
42 | { | 47 | { |
43 | return Assets[ id ]; | 48 | return Assets[ id ]; |
diff --git a/OpenSim/Tests/Common/Mock/TestInventoryService.cs b/OpenSim/Tests/Common/Mock/TestInventoryService.cs new file mode 100644 index 0000000..cf1a3a9 --- /dev/null +++ b/OpenSim/Tests/Common/Mock/TestInventoryService.cs | |||
@@ -0,0 +1,133 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using OpenSim.Framework; | ||
5 | using OpenMetaverse; | ||
6 | using OpenSim.Services.Interfaces; | ||
7 | using Nini.Config; | ||
8 | |||
9 | namespace OpenSim.Tests.Common.Mock | ||
10 | { | ||
11 | public class TestInventoryService : IInventoryService | ||
12 | { | ||
13 | public TestInventoryService() | ||
14 | { | ||
15 | } | ||
16 | |||
17 | public TestInventoryService(IConfigSource config) | ||
18 | { | ||
19 | } | ||
20 | |||
21 | /// <summary> | ||
22 | /// <see cref="OpenSim.Framework.Communications.IInterServiceInventoryServices"/> | ||
23 | /// </summary> | ||
24 | /// <param name="userId"></param> | ||
25 | /// <returns></returns> | ||
26 | public bool CreateUserInventory(UUID userId) | ||
27 | { | ||
28 | return false; | ||
29 | } | ||
30 | |||
31 | /// <summary> | ||
32 | /// <see cref="OpenSim.Framework.Communications.IInterServiceInventoryServices"/> | ||
33 | /// </summary> | ||
34 | /// <param name="userId"></param> | ||
35 | /// <returns></returns> | ||
36 | public List<InventoryFolderBase> GetInventorySkeleton(UUID userId) | ||
37 | { | ||
38 | List<InventoryFolderBase> folders = new List<InventoryFolderBase>(); | ||
39 | InventoryFolderBase folder = new InventoryFolderBase(); | ||
40 | folder.ID = UUID.Random(); | ||
41 | folder.Owner = userId; | ||
42 | folders.Add(folder); | ||
43 | return folders; | ||
44 | } | ||
45 | |||
46 | /// <summary> | ||
47 | /// Returns a list of all the active gestures in a user's inventory. | ||
48 | /// </summary> | ||
49 | /// <param name="userId"> | ||
50 | /// The <see cref="UUID"/> of the user | ||
51 | /// </param> | ||
52 | /// <returns> | ||
53 | /// A flat list of the gesture items. | ||
54 | /// </returns> | ||
55 | public List<InventoryItemBase> GetActiveGestures(UUID userId) | ||
56 | { | ||
57 | return null; | ||
58 | } | ||
59 | |||
60 | public InventoryCollection GetUserInventory(UUID userID) | ||
61 | { | ||
62 | return null; | ||
63 | } | ||
64 | |||
65 | public void GetUserInventory(UUID userID, OpenSim.Services.Interfaces.InventoryReceiptCallback callback) | ||
66 | { | ||
67 | } | ||
68 | |||
69 | public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID) | ||
70 | { | ||
71 | return null; | ||
72 | } | ||
73 | |||
74 | public bool AddFolder(InventoryFolderBase folder) | ||
75 | { | ||
76 | return false; | ||
77 | } | ||
78 | |||
79 | public bool UpdateFolder(InventoryFolderBase folder) | ||
80 | { | ||
81 | return false; | ||
82 | } | ||
83 | |||
84 | public bool MoveFolder(InventoryFolderBase folder) | ||
85 | { | ||
86 | return false; | ||
87 | } | ||
88 | |||
89 | public bool PurgeFolder(InventoryFolderBase folder) | ||
90 | { | ||
91 | return false; | ||
92 | } | ||
93 | |||
94 | public bool AddItem(InventoryItemBase item) | ||
95 | { | ||
96 | return false; | ||
97 | } | ||
98 | |||
99 | public bool UpdateItem(InventoryItemBase item) | ||
100 | { | ||
101 | return false; | ||
102 | } | ||
103 | |||
104 | public bool DeleteItem(InventoryItemBase item) | ||
105 | { | ||
106 | return false; | ||
107 | } | ||
108 | |||
109 | public InventoryItemBase QueryItem(InventoryItemBase item) | ||
110 | { | ||
111 | return null; | ||
112 | } | ||
113 | |||
114 | public InventoryFolderBase QueryFolder(InventoryFolderBase folder) | ||
115 | { | ||
116 | return null; | ||
117 | } | ||
118 | |||
119 | public bool HasInventoryForUser(UUID userID) | ||
120 | { | ||
121 | return false; | ||
122 | } | ||
123 | |||
124 | public InventoryFolderBase RequestRootFolder(UUID userID) | ||
125 | { | ||
126 | InventoryFolderBase root = new InventoryFolderBase(); | ||
127 | root.ID = UUID.Random(); | ||
128 | root.Owner = userID; | ||
129 | root.ParentID = UUID.Zero; | ||
130 | return root; | ||
131 | } | ||
132 | } | ||
133 | } | ||
diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs index c11691f..fbe0e46 100644 --- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs +++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs | |||
@@ -54,6 +54,10 @@ namespace OpenSim.Tests.Common.Setup | |||
54 | /// </summary> | 54 | /// </summary> |
55 | public class SceneSetupHelpers | 55 | public class SceneSetupHelpers |
56 | { | 56 | { |
57 | private static ISharedRegionModule m_assetService = null; | ||
58 | private static ISharedRegionModule m_inventoryService = null; | ||
59 | private static TestCommunicationsManager commsManager = null; | ||
60 | |||
57 | /// <summary> | 61 | /// <summary> |
58 | /// Set up a test scene | 62 | /// Set up a test scene |
59 | /// </summary> | 63 | /// </summary> |
@@ -63,7 +67,7 @@ namespace OpenSim.Tests.Common.Setup | |||
63 | /// <returns></returns> | 67 | /// <returns></returns> |
64 | public static TestScene SetupScene() | 68 | public static TestScene SetupScene() |
65 | { | 69 | { |
66 | return SetupScene(true); | 70 | return SetupScene(""); |
67 | } | 71 | } |
68 | 72 | ||
69 | /// <summary> | 73 | /// <summary> |
@@ -72,12 +76,17 @@ namespace OpenSim.Tests.Common.Setup | |||
72 | /// | 76 | /// |
73 | /// <param name="startServices">Start associated service threads for the scene</param> | 77 | /// <param name="startServices">Start associated service threads for the scene</param> |
74 | /// <returns></returns> | 78 | /// <returns></returns> |
75 | public static TestScene SetupScene(bool startServices) | 79 | public static TestScene SetupScene(String realServices) |
76 | { | 80 | { |
77 | return SetupScene( | 81 | return SetupScene( |
78 | "Unit test region", UUID.Random(), 1000, 1000, new TestCommunicationsManager(), startServices); | 82 | "Unit test region", UUID.Random(), 1000, 1000, new TestCommunicationsManager(), realServices); |
83 | } | ||
84 | |||
85 | public static TestScene SetupScene(TestCommunicationsManager cm, String realServices) | ||
86 | { | ||
87 | return SetupScene( | ||
88 | "Unit test region", UUID.Random(), 1000, 1000, cm, ""); | ||
79 | } | 89 | } |
80 | |||
81 | /// <summary> | 90 | /// <summary> |
82 | /// Set up a test scene | 91 | /// Set up a test scene |
83 | /// </summary> | 92 | /// </summary> |
@@ -89,28 +98,35 @@ namespace OpenSim.Tests.Common.Setup | |||
89 | /// <returns></returns> | 98 | /// <returns></returns> |
90 | public static TestScene SetupScene(string name, UUID id, uint x, uint y, TestCommunicationsManager cm) | 99 | public static TestScene SetupScene(string name, UUID id, uint x, uint y, TestCommunicationsManager cm) |
91 | { | 100 | { |
92 | return SetupScene(name, id, x, y, cm, true); | 101 | return SetupScene(name, id, x, y, cm, ""); |
93 | } | 102 | } |
94 | 103 | ||
95 | /// <summary> | 104 | /// <summary> |
96 | /// Set up a test scene | 105 | /// Set up a scene. |
97 | /// </summary> | 106 | /// </summary> |
98 | /// <param name="name">Name of the region</param> | 107 | /// <param name="name">Name of the region</param> |
99 | /// <param name="id">ID of the region</param> | 108 | /// <param name="id">ID of the region</param> |
100 | /// <param name="x">X co-ordinate of the region</param> | 109 | /// <param name="x">X co-ordinate of the region</param> |
101 | /// <param name="y">Y co-ordinate of the region</param> | 110 | /// <param name="y">Y co-ordinate of the region</param> |
102 | /// <param name="cm">This should be the same if simulating two scenes within a standalone</param> | 111 | /// <param name="cm">This should be the same if simulating two scenes within a standalone</param> |
103 | /// <param name="startServices">Start associated threads for the services used by the scene</param> | 112 | /// <param name="realServices">Starts real inventory and asset services, as opposed to mock ones, if true</param> |
104 | /// <returns></returns> | 113 | /// <returns></returns> |
105 | public static TestScene SetupScene( | 114 | public static TestScene SetupScene( |
106 | string name, UUID id, uint x, uint y, TestCommunicationsManager cm, bool startServices) | 115 | string name, UUID id, uint x, uint y, TestCommunicationsManager cm, String realServices) |
107 | { | 116 | { |
117 | bool newScene= false; | ||
118 | |||
108 | Console.WriteLine("Setting up test scene {0}", name); | 119 | Console.WriteLine("Setting up test scene {0}", name); |
120 | if (cm == null || cm != commsManager) | ||
121 | { | ||
122 | System.Console.WriteLine("Starting a brand new scene"); | ||
123 | newScene = true; | ||
124 | MainConsole.Instance = new LocalConsole("TEST PROMPT"); | ||
125 | MainServer.Instance = new BaseHttpServer(980); | ||
126 | commsManager = cm; | ||
127 | } | ||
109 | 128 | ||
110 | // We must set up a console otherwise setup of some modules may fail | 129 | // We must set up a console otherwise setup of some modules may fail |
111 | MainConsole.Instance = new LocalConsole("TEST PROMPT"); | ||
112 | |||
113 | MainServer.Instance = new BaseHttpServer(980); | ||
114 | RegionInfo regInfo = new RegionInfo(x, y, new IPEndPoint(IPAddress.Loopback, 9000), "127.0.0.1"); | 130 | RegionInfo regInfo = new RegionInfo(x, y, new IPEndPoint(IPAddress.Loopback, 9000), "127.0.0.1"); |
115 | regInfo.RegionName = name; | 131 | regInfo.RegionName = name; |
116 | regInfo.RegionID = id; | 132 | regInfo.RegionID = id; |
@@ -132,44 +148,80 @@ namespace OpenSim.Tests.Common.Setup | |||
132 | IRegionModule godsModule = new GodsModule(); | 148 | IRegionModule godsModule = new GodsModule(); |
133 | godsModule.Initialise(testScene, new IniConfigSource()); | 149 | godsModule.Initialise(testScene, new IniConfigSource()); |
134 | testScene.AddModule(godsModule.Name, godsModule); | 150 | testScene.AddModule(godsModule.Name, godsModule); |
151 | realServices = realServices.ToLower(); | ||
152 | IniConfigSource config = new IniConfigSource(); | ||
153 | if ((m_assetService == null && m_inventoryService == null) || newScene) | ||
154 | { | ||
155 | if (realServices.Contains("asset")) | ||
156 | StartAssetService(testScene, true); | ||
157 | else | ||
158 | StartAssetService(testScene, false); | ||
159 | if (realServices.Contains("inventory")) | ||
160 | StartInventoryService(testScene, true); | ||
161 | else | ||
162 | StartInventoryService(testScene, false); | ||
163 | } | ||
164 | else | ||
165 | { | ||
166 | m_assetService.AddRegion(testScene); | ||
167 | m_assetService.RegionLoaded(testScene); | ||
168 | m_inventoryService.AddRegion(testScene); | ||
169 | m_inventoryService.RegionLoaded(testScene); | ||
170 | } | ||
171 | m_inventoryService.PostInitialise(); | ||
172 | m_assetService.PostInitialise(); | ||
173 | |||
174 | testScene.CommsManager.UserService.SetInventoryService(testScene.InventoryService); | ||
135 | 175 | ||
176 | testScene.SetModuleInterfaces(); | ||
177 | |||
178 | testScene.LandChannel = new TestLandChannel(); | ||
179 | testScene.LoadWorldMap(); | ||
180 | |||
181 | PhysicsPluginManager physicsPluginManager = new PhysicsPluginManager(); | ||
182 | physicsPluginManager.LoadPluginsFromAssembly("Physics/OpenSim.Region.Physics.BasicPhysicsPlugin.dll"); | ||
183 | testScene.PhysicsScene | ||
184 | = physicsPluginManager.GetPhysicsScene("basicphysics", "ZeroMesher", configSource, "test"); | ||
185 | |||
186 | return testScene; | ||
187 | } | ||
188 | |||
189 | private static void StartAssetService(Scene testScene, bool real) | ||
190 | { | ||
136 | ISharedRegionModule assetService = new LocalAssetServicesConnector(); | 191 | ISharedRegionModule assetService = new LocalAssetServicesConnector(); |
137 | IniConfigSource config = new IniConfigSource(); | 192 | IniConfigSource config = new IniConfigSource(); |
138 | config.AddConfig("Modules"); | 193 | config.AddConfig("Modules"); |
139 | config.AddConfig("AssetService"); | 194 | config.AddConfig("AssetService"); |
140 | config.Configs["Modules"].Set("AssetServices", "LocalAssetServicesConnector"); | 195 | config.Configs["Modules"].Set("AssetServices", "LocalAssetServicesConnector"); |
141 | config.Configs["AssetService"].Set("LocalServiceModule", "OpenSim.Services.AssetService.dll:AssetService"); | 196 | if (real) |
197 | config.Configs["AssetService"].Set("LocalServiceModule", "OpenSim.Services.AssetService.dll:AssetService"); | ||
198 | else | ||
199 | config.Configs["AssetService"].Set("LocalServiceModule", "OpenSim.Tests.Common.dll:TestAssetService"); | ||
142 | config.Configs["AssetService"].Set("StorageProvider", "OpenSim.Tests.Common.dll"); | 200 | config.Configs["AssetService"].Set("StorageProvider", "OpenSim.Tests.Common.dll"); |
143 | assetService.Initialise(config); | 201 | assetService.Initialise(config); |
144 | assetService.AddRegion(testScene); | 202 | assetService.AddRegion(testScene); |
145 | assetService.RegionLoaded(testScene); | 203 | assetService.RegionLoaded(testScene); |
146 | testScene.AddRegionModule(assetService.Name, assetService); | 204 | testScene.AddRegionModule(assetService.Name, assetService); |
147 | assetService.PostInitialise(); | 205 | m_assetService = assetService; |
206 | } | ||
148 | 207 | ||
208 | private static void StartInventoryService(Scene testScene, bool real) | ||
209 | { | ||
149 | ISharedRegionModule inventoryService = new LocalInventoryServicesConnector(); | 210 | ISharedRegionModule inventoryService = new LocalInventoryServicesConnector(); |
150 | config = new IniConfigSource(); | 211 | IniConfigSource config = new IniConfigSource(); |
151 | config.AddConfig("Modules"); | 212 | config.AddConfig("Modules"); |
152 | config.AddConfig("InventoryService"); | 213 | config.AddConfig("InventoryService"); |
153 | config.Configs["Modules"].Set("InventoryServices", "LocalInventoryServicesConnector"); | 214 | config.Configs["Modules"].Set("InventoryServices", "LocalInventoryServicesConnector"); |
154 | config.Configs["InventoryService"].Set("LocalServiceModule", "OpenSim.Services.InventoryService.dll:InventoryService"); | 215 | if (real) |
216 | config.Configs["InventoryService"].Set("LocalServiceModule", "OpenSim.Services.InventoryService.dll:InventoryService"); | ||
217 | else | ||
218 | config.Configs["InventoryService"].Set("LocalServiceModule", "OpenSim.Tests.Common.dll:TestInventoryService"); | ||
155 | config.Configs["InventoryService"].Set("StorageProvider", "OpenSim.Tests.Common.dll"); | 219 | config.Configs["InventoryService"].Set("StorageProvider", "OpenSim.Tests.Common.dll"); |
156 | inventoryService.Initialise(config); | 220 | inventoryService.Initialise(config); |
157 | inventoryService.AddRegion(testScene); | 221 | inventoryService.AddRegion(testScene); |
158 | inventoryService.RegionLoaded(testScene); | 222 | inventoryService.RegionLoaded(testScene); |
159 | testScene.AddRegionModule(inventoryService.Name, inventoryService); | 223 | testScene.AddRegionModule(inventoryService.Name, inventoryService); |
160 | inventoryService.PostInitialise(); | 224 | m_inventoryService = inventoryService; |
161 | |||
162 | testScene.SetModuleInterfaces(); | ||
163 | |||
164 | testScene.LandChannel = new TestLandChannel(); | ||
165 | testScene.LoadWorldMap(); | ||
166 | |||
167 | PhysicsPluginManager physicsPluginManager = new PhysicsPluginManager(); | ||
168 | physicsPluginManager.LoadPluginsFromAssembly("Physics/OpenSim.Region.Physics.BasicPhysicsPlugin.dll"); | ||
169 | testScene.PhysicsScene | ||
170 | = physicsPluginManager.GetPhysicsScene("basicphysics", "ZeroMesher", configSource, "test"); | ||
171 | |||
172 | return testScene; | ||
173 | } | 225 | } |
174 | 226 | ||
175 | /// <summary> | 227 | /// <summary> |