From 226c082ed417f4a5f2295595e45eca2fcb1e42c9 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 11 Aug 2009 16:45:16 +0100
Subject: Establish CachedUserInfo.OnInventoryReceived event so that
region/test inventory code can be written with the async inventory fetch
---
OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs | 42 ++++++++++++++++++----
1 file changed, 36 insertions(+), 6 deletions(-)
(limited to 'OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs')
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
/// Create a test user with a standard inventory
///
///
+ ///
+ /// Callback to invoke when inventory has been loaded. This is required because
+ /// loading may be asynchronous, even on standalone
+ ///
///
- public static CachedUserInfo CreateUserWithInventory(CommunicationsManager commsManager)
+ public static CachedUserInfo CreateUserWithInventory(
+ CommunicationsManager commsManager, OnInventoryReceivedDelegate callback)
{
UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000099");
- return CreateUserWithInventory(commsManager, userId);
+ return CreateUserWithInventory(commsManager, userId, callback);
}
///
/// Create a test user with a standard inventory
///
///
- /// Explicit user id to use for user creation
+ /// User ID
+ ///
+ /// Callback to invoke when inventory has been loaded. This is required because
+ /// loading may be asynchronous, even on standalone
+ ///
///
- public static CachedUserInfo CreateUserWithInventory(CommunicationsManager commsManager, UUID userId)
+ public static CachedUserInfo CreateUserWithInventory(
+ CommunicationsManager commsManager, UUID userId, OnInventoryReceivedDelegate callback)
+ {
+ return CreateUserWithInventory(commsManager, "Bill", "Bailey", userId, callback);
+ }
+
+ ///
+ /// Create a test user with a standard inventory
+ ///
+ ///
+ /// First name of user
+ /// Last name of user
+ /// User ID
+ ///
+ /// Callback to invoke when inventory has been loaded. This is required because
+ /// loading may be asynchronous, even on standalone
+ ///
+ ///
+ public static CachedUserInfo CreateUserWithInventory(
+ CommunicationsManager commsManager, string firstName, string lastName,
+ UUID userId, OnInventoryReceivedDelegate callback)
{
LocalUserServices lus = (LocalUserServices)commsManager.UserService;
- lus.AddUser("Bill", "Bailey", "troll", "bill@bailey.com", 1000, 1000, userId);
+ lus.AddUser(firstName, lastName, "troll", "bill@bailey.com", 1000, 1000, userId);
CachedUserInfo userInfo = commsManager.UserProfileCacheService.GetUserDetails(userId);
+ userInfo.OnInventoryReceived += callback;
userInfo.FetchInventory();
return userInfo;
- }
+ }
}
}
--
cgit v1.1