aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Tests/Common
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2009-08-11 16:45:16 +0100
committerJustin Clark-Casey (justincc)2009-08-11 16:45:16 +0100
commit226c082ed417f4a5f2295595e45eca2fcb1e42c9 (patch)
tree4bbe2f59176589e497a2f4fd16b3adfe3989c5cd /OpenSim/Tests/Common
parentAdded some needed comments to SceneSetupHelper (actually just retriggering pa... (diff)
downloadopensim-SC-226c082ed417f4a5f2295595e45eca2fcb1e42c9.zip
opensim-SC-226c082ed417f4a5f2295595e45eca2fcb1e42c9.tar.gz
opensim-SC-226c082ed417f4a5f2295595e45eca2fcb1e42c9.tar.bz2
opensim-SC-226c082ed417f4a5f2295595e45eca2fcb1e42c9.tar.xz
Establish CachedUserInfo.OnInventoryReceived event so that region/test inventory code can be written with the async inventory fetch
Diffstat (limited to 'OpenSim/Tests/Common')
-rw-r--r--OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs42
1 files changed, 36 insertions, 6 deletions
diff --git a/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs b/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs
index fc41166..f146a15 100644
--- a/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs
+++ b/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs
@@ -41,28 +41,58 @@ namespace OpenSim.Tests.Common.Setup
41 /// Create a test user with a standard inventory 41 /// Create a test user with a standard inventory
42 /// </summary> 42 /// </summary>
43 /// <param name="commsManager"></param> 43 /// <param name="commsManager"></param>
44 /// <param name="callback">
45 /// Callback to invoke when inventory has been loaded. This is required because
46 /// loading may be asynchronous, even on standalone
47 /// </param>
44 /// <returns></returns> 48 /// <returns></returns>
45 public static CachedUserInfo CreateUserWithInventory(CommunicationsManager commsManager) 49 public static CachedUserInfo CreateUserWithInventory(
50 CommunicationsManager commsManager, OnInventoryReceivedDelegate callback)
46 { 51 {
47 UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000099"); 52 UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000099");
48 return CreateUserWithInventory(commsManager, userId); 53 return CreateUserWithInventory(commsManager, userId, callback);
49 } 54 }
50 55
51 /// <summary> 56 /// <summary>
52 /// Create a test user with a standard inventory 57 /// Create a test user with a standard inventory
53 /// </summary> 58 /// </summary>
54 /// <param name="commsManager"></param> 59 /// <param name="commsManager"></param>
55 /// <param name="userId">Explicit user id to use for user creation</param> 60 /// <param name="userId">User ID</param>
61 /// <param name="callback">
62 /// Callback to invoke when inventory has been loaded. This is required because
63 /// loading may be asynchronous, even on standalone
64 /// </param>
56 /// <returns></returns> 65 /// <returns></returns>
57 public static CachedUserInfo CreateUserWithInventory(CommunicationsManager commsManager, UUID userId) 66 public static CachedUserInfo CreateUserWithInventory(
67 CommunicationsManager commsManager, UUID userId, OnInventoryReceivedDelegate callback)
68 {
69 return CreateUserWithInventory(commsManager, "Bill", "Bailey", userId, callback);
70 }
71
72 /// <summary>
73 /// Create a test user with a standard inventory
74 /// </summary>
75 /// <param name="commsManager"></param>
76 /// <param name="firstName">First name of user</param>
77 /// <param name="lastName">Last name of user</param>
78 /// <param name="userId">User ID</param>
79 /// <param name="callback">
80 /// Callback to invoke when inventory has been loaded. This is required because
81 /// loading may be asynchronous, even on standalone
82 /// </param>
83 /// <returns></returns>
84 public static CachedUserInfo CreateUserWithInventory(
85 CommunicationsManager commsManager, string firstName, string lastName,
86 UUID userId, OnInventoryReceivedDelegate callback)
58 { 87 {
59 LocalUserServices lus = (LocalUserServices)commsManager.UserService; 88 LocalUserServices lus = (LocalUserServices)commsManager.UserService;
60 lus.AddUser("Bill", "Bailey", "troll", "bill@bailey.com", 1000, 1000, userId); 89 lus.AddUser(firstName, lastName, "troll", "bill@bailey.com", 1000, 1000, userId);
61 90
62 CachedUserInfo userInfo = commsManager.UserProfileCacheService.GetUserDetails(userId); 91 CachedUserInfo userInfo = commsManager.UserProfileCacheService.GetUserDetails(userId);
92 userInfo.OnInventoryReceived += callback;
63 userInfo.FetchInventory(); 93 userInfo.FetchInventory();
64 94
65 return userInfo; 95 return userInfo;
66 } 96 }
67 } 97 }
68} 98}