diff options
author | Justin Clarke Casey | 2008-12-12 18:48:29 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-12-12 18:48:29 +0000 |
commit | a7e145bdfdb994f4c171d32740790cffc3fc4ad3 (patch) | |
tree | 9eefc934ead5addb8feac898540f27a40995d288 | |
parent | * Deleted old EntiyList tests, added new EntityManager tests (diff) | |
download | opensim-SC-a7e145bdfdb994f4c171d32740790cffc3fc4ad3.zip opensim-SC-a7e145bdfdb994f4c171d32740790cffc3fc4ad3.tar.gz opensim-SC-a7e145bdfdb994f4c171d32740790cffc3fc4ad3.tar.bz2 opensim-SC-a7e145bdfdb994f4c171d32740790cffc3fc4ad3.tar.xz |
* refactor: pull out common user profile test code into utility functions
4 files changed, 25 insertions, 49 deletions
diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs index d597aad..b6ac6c9 100644 --- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs +++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs | |||
@@ -141,7 +141,6 @@ namespace OpenSim.Framework.Communications.Cache | |||
141 | } | 141 | } |
142 | } | 142 | } |
143 | 143 | ||
144 | |||
145 | /// <summary> | 144 | /// <summary> |
146 | /// Recursively, in depth-first order, add all the folders we've received (stored | 145 | /// Recursively, in depth-first order, add all the folders we've received (stored |
147 | /// in a dictionary indexed by parent ID) into the tree that describes user folder | 146 | /// in a dictionary indexed by parent ID) into the tree that describes user folder |
diff --git a/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs b/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs index 9c07734..6632643 100644 --- a/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs +++ b/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs | |||
@@ -48,20 +48,17 @@ namespace OpenSim.Framework.Communications.Tests | |||
48 | [Test] | 48 | [Test] |
49 | public void TestGetUserDetails() | 49 | public void TestGetUserDetails() |
50 | { | 50 | { |
51 | UUID nonExistingUserId = UUID.Parse("00000000-0000-0000-0000-000000000001"); | 51 | UUID nonExistingUserId = UUID.Parse("00000000-0000-0000-0000-000000000001"); |
52 | UUID existingUserId = UUID.Parse("00000000-0000-0000-0000-000000000002"); | 52 | UUID existingUserId = UUID.Parse("00000000-0000-0000-0000-000000000002"); |
53 | 53 | ||
54 | CommunicationsManager commsManager = new TestCommunicationsManager(); | 54 | CommunicationsManager commsManager = UserProfileTestUtils.SetupServices(); |
55 | LocalUserServices lus = (LocalUserServices)commsManager.UserService; | 55 | CachedUserInfo existingUserInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager, existingUserId); |
56 | lus.AddPlugin(new TestUserDataPlugin()); | 56 | |
57 | ((LocalInventoryService)commsManager.InventoryService).AddPlugin(new TestInventoryDataPlugin()); | 57 | Assert.That(existingUserInfo, Is.Not.Null, "Existing user info unexpectedly not found"); |
58 | 58 | ||
59 | CachedUserInfo nonExistingUserInfo = commsManager.UserProfileCacheService.GetUserDetails(nonExistingUserId); | 59 | CachedUserInfo nonExistingUserInfo = commsManager.UserProfileCacheService.GetUserDetails(nonExistingUserId); |
60 | Assert.That(nonExistingUserInfo, Is.Null, "Non existing user info unexpectedly found"); | ||
61 | 60 | ||
62 | lus.AddUser("Bill", "Bailey", "troll", "bill@bailey.com", 1000, 1000, existingUserId); | 61 | Assert.That(nonExistingUserInfo, Is.Null, "Non existing user info unexpectedly found"); |
63 | CachedUserInfo existingUserInfo = commsManager.UserProfileCacheService.GetUserDetails(existingUserId); | ||
64 | Assert.That(existingUserInfo, Is.Not.Null, "Existing user info unexpectedly not found"); | ||
65 | } | 62 | } |
66 | 63 | ||
67 | /// <summary> | 64 | /// <summary> |
@@ -70,18 +67,9 @@ namespace OpenSim.Framework.Communications.Tests | |||
70 | [Test] | 67 | [Test] |
71 | public void TestRequestInventoryForUser() | 68 | public void TestRequestInventoryForUser() |
72 | { | 69 | { |
73 | UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000003"); | 70 | CommunicationsManager commsManager = UserProfileTestUtils.SetupServices(); |
74 | 71 | CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager); | |
75 | CommunicationsManager commsManager = new TestCommunicationsManager(); | ||
76 | LocalUserServices lus = (LocalUserServices)commsManager.UserService; | ||
77 | lus.AddPlugin(new TestUserDataPlugin()); | ||
78 | ((LocalInventoryService)commsManager.InventoryService).AddPlugin(new TestInventoryDataPlugin()); | ||
79 | 72 | ||
80 | lus.AddUser("Bill", "Bailey", "troll", "bill@bailey.com", 1000, 1000, userId); | ||
81 | |||
82 | commsManager.UserProfileCacheService.RequestInventoryForUser(userId); | ||
83 | |||
84 | CachedUserInfo userInfo = commsManager.UserProfileCacheService.GetUserDetails(userId); | ||
85 | Assert.That(userInfo.HasReceivedInventory, Is.True); | 73 | Assert.That(userInfo.HasReceivedInventory, Is.True); |
86 | } | 74 | } |
87 | 75 | ||
@@ -91,19 +79,12 @@ namespace OpenSim.Framework.Communications.Tests | |||
91 | [Test] | 79 | [Test] |
92 | public void TestCreateFolder() | 80 | public void TestCreateFolder() |
93 | { | 81 | { |
94 | UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000004"); | 82 | IUserDataPlugin userDataPlugin = new TestUserDataPlugin(); |
95 | 83 | IInventoryDataPlugin inventoryDataPlugin = new TestInventoryDataPlugin(); | |
96 | CommunicationsManager commsManager = new TestCommunicationsManager(); | ||
97 | LocalUserServices lus = (LocalUserServices)commsManager.UserService; | ||
98 | lus.AddPlugin(new TestUserDataPlugin()); | ||
99 | TestInventoryDataPlugin inventoryDataPlugin = new TestInventoryDataPlugin(); | ||
100 | ((LocalInventoryService)commsManager.InventoryService).AddPlugin(inventoryDataPlugin); | ||
101 | 84 | ||
102 | lus.AddUser("Bill", "Bailey", "troll", "bill@bailey.com", 1000, 1000, userId); | 85 | CommunicationsManager commsManager |
103 | 86 | = UserProfileTestUtils.SetupServices(userDataPlugin, inventoryDataPlugin); | |
104 | commsManager.UserProfileCacheService.RequestInventoryForUser(userId); | 87 | CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager); |
105 | |||
106 | CachedUserInfo userInfo = commsManager.UserProfileCacheService.GetUserDetails(userId); | ||
107 | 88 | ||
108 | UUID folderId = UUID.Parse("00000000-0000-0000-0000-000000000010"); | 89 | UUID folderId = UUID.Parse("00000000-0000-0000-0000-000000000010"); |
109 | Assert.That(userInfo.RootFolder.ContainsChildFolder(folderId), Is.False); | 90 | Assert.That(userInfo.RootFolder.ContainsChildFolder(folderId), Is.False); |
@@ -119,18 +100,8 @@ namespace OpenSim.Framework.Communications.Tests | |||
119 | [Test] | 100 | [Test] |
120 | public void TestGetChildFolder() | 101 | public void TestGetChildFolder() |
121 | { | 102 | { |
122 | UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000005"); | 103 | CommunicationsManager commsManager = UserProfileTestUtils.SetupServices(); |
123 | 104 | CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager); | |
124 | CommunicationsManager commsManager = new TestCommunicationsManager(); | ||
125 | LocalUserServices lus = (LocalUserServices)commsManager.UserService; | ||
126 | lus.AddPlugin(new TestUserDataPlugin()); | ||
127 | ((LocalInventoryService)commsManager.InventoryService).AddPlugin(new TestInventoryDataPlugin()); | ||
128 | |||
129 | lus.AddUser("Bill", "Bailey", "troll", "bill@bailey.com", 1000, 1000, userId); | ||
130 | |||
131 | commsManager.UserProfileCacheService.RequestInventoryForUser(userId); | ||
132 | |||
133 | CachedUserInfo userInfo = commsManager.UserProfileCacheService.GetUserDetails(userId); | ||
134 | 105 | ||
135 | UUID folderId = UUID.Parse("00000000-0000-0000-0000-000000000011"); | 106 | UUID folderId = UUID.Parse("00000000-0000-0000-0000-000000000011"); |
136 | 107 | ||
diff --git a/OpenSim/Region/Environment/Scenes/EventManager.cs b/OpenSim/Region/Environment/Scenes/EventManager.cs index ad25670..b493f84 100644 --- a/OpenSim/Region/Environment/Scenes/EventManager.cs +++ b/OpenSim/Region/Environment/Scenes/EventManager.cs | |||
@@ -233,18 +233,21 @@ namespace OpenSim.Region.Environment.Scenes | |||
233 | /// </summary> | 233 | /// </summary> |
234 | public delegate void RegisterCapsEvent(UUID agentID, Caps caps); | 234 | public delegate void RegisterCapsEvent(UUID agentID, Caps caps); |
235 | public event RegisterCapsEvent OnRegisterCaps; | 235 | public event RegisterCapsEvent OnRegisterCaps; |
236 | |||
236 | /// <summary> | 237 | /// <summary> |
237 | /// DeregisterCapsEvent is called by Scene when the caps | 238 | /// DeregisterCapsEvent is called by Scene when the caps |
238 | /// handler for an agent are removed. | 239 | /// handler for an agent are removed. |
239 | /// </summary> | 240 | /// </summary> |
240 | public delegate void DeregisterCapsEvent(UUID agentID, Caps caps); | 241 | public delegate void DeregisterCapsEvent(UUID agentID, Caps caps); |
241 | public event DeregisterCapsEvent OnDeregisterCaps; | 242 | public event DeregisterCapsEvent OnDeregisterCaps; |
243 | |||
242 | /// <summary> | 244 | /// <summary> |
243 | /// ChatFromWorldEvent is called via Scene when a chat message | 245 | /// ChatFromWorldEvent is called via Scene when a chat message |
244 | /// from world comes in. | 246 | /// from world comes in. |
245 | /// </summary> | 247 | /// </summary> |
246 | public delegate void ChatFromWorldEvent(Object sender, OSChatMessage chat); | 248 | public delegate void ChatFromWorldEvent(Object sender, OSChatMessage chat); |
247 | public event ChatFromWorldEvent OnChatFromWorld; | 249 | public event ChatFromWorldEvent OnChatFromWorld; |
250 | |||
248 | /// <summary> | 251 | /// <summary> |
249 | /// ChatFromClientEvent is triggered via ChatModule (or | 252 | /// ChatFromClientEvent is triggered via ChatModule (or |
250 | /// substitutes thereof) when a chat message | 253 | /// substitutes thereof) when a chat message |
@@ -252,6 +255,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
252 | /// </summary> | 255 | /// </summary> |
253 | public delegate void ChatFromClientEvent(Object sender, OSChatMessage chat); | 256 | public delegate void ChatFromClientEvent(Object sender, OSChatMessage chat); |
254 | public event ChatFromClientEvent OnChatFromClient; | 257 | public event ChatFromClientEvent OnChatFromClient; |
258 | |||
255 | /// <summary> | 259 | /// <summary> |
256 | /// ChatBroadcastEvent is called via Scene when a broadcast chat message | 260 | /// ChatBroadcastEvent is called via Scene when a broadcast chat message |
257 | /// from world comes in | 261 | /// from world comes in |
diff --git a/OpenSim/Region/Environment/Scenes/SceneBase.cs b/OpenSim/Region/Environment/Scenes/SceneBase.cs index 805ca5d..9528a0d 100644 --- a/OpenSim/Region/Environment/Scenes/SceneBase.cs +++ b/OpenSim/Region/Environment/Scenes/SceneBase.cs | |||
@@ -76,13 +76,15 @@ namespace OpenSim.Region.Environment.Scenes | |||
76 | /// </value> | 76 | /// </value> |
77 | public ILandChannel LandChannel; | 77 | public ILandChannel LandChannel; |
78 | 78 | ||
79 | protected EventManager m_eventManager; | 79 | /// <value> |
80 | 80 | /// Manage events that occur in this scene (avatar movement, script rez, etc.). Commonly used by region modules | |
81 | /// to subscribe to scene events. | ||
82 | /// </value> | ||
81 | public EventManager EventManager | 83 | public EventManager EventManager |
82 | { | 84 | { |
83 | get { return m_eventManager; } | 85 | get { return m_eventManager; } |
84 | } | 86 | } |
85 | 87 | protected EventManager m_eventManager; | |
86 | 88 | ||
87 | protected ScenePermissions m_permissions; | 89 | protected ScenePermissions m_permissions; |
88 | public ScenePermissions Permissions | 90 | public ScenePermissions Permissions |