* refactor: pull out common user profile test code into utility functions
parent
7a4f11b94d
commit
a7e145bdfd
|
@ -141,7 +141,6 @@ namespace OpenSim.Framework.Communications.Cache
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Recursively, in depth-first order, add all the folders we've received (stored
|
||||
/// in a dictionary indexed by parent ID) into the tree that describes user folder
|
||||
|
|
|
@ -48,20 +48,17 @@ namespace OpenSim.Framework.Communications.Tests
|
|||
[Test]
|
||||
public void TestGetUserDetails()
|
||||
{
|
||||
UUID nonExistingUserId = UUID.Parse("00000000-0000-0000-0000-000000000001");
|
||||
UUID nonExistingUserId = UUID.Parse("00000000-0000-0000-0000-000000000001");
|
||||
UUID existingUserId = UUID.Parse("00000000-0000-0000-0000-000000000002");
|
||||
|
||||
CommunicationsManager commsManager = new TestCommunicationsManager();
|
||||
LocalUserServices lus = (LocalUserServices)commsManager.UserService;
|
||||
lus.AddPlugin(new TestUserDataPlugin());
|
||||
((LocalInventoryService)commsManager.InventoryService).AddPlugin(new TestInventoryDataPlugin());
|
||||
|
||||
CachedUserInfo nonExistingUserInfo = commsManager.UserProfileCacheService.GetUserDetails(nonExistingUserId);
|
||||
Assert.That(nonExistingUserInfo, Is.Null, "Non existing user info unexpectedly found");
|
||||
CommunicationsManager commsManager = UserProfileTestUtils.SetupServices();
|
||||
CachedUserInfo existingUserInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager, existingUserId);
|
||||
|
||||
lus.AddUser("Bill", "Bailey", "troll", "bill@bailey.com", 1000, 1000, existingUserId);
|
||||
CachedUserInfo existingUserInfo = commsManager.UserProfileCacheService.GetUserDetails(existingUserId);
|
||||
Assert.That(existingUserInfo, Is.Not.Null, "Existing user info unexpectedly not found");
|
||||
Assert.That(existingUserInfo, Is.Not.Null, "Existing user info unexpectedly not found");
|
||||
|
||||
CachedUserInfo nonExistingUserInfo = commsManager.UserProfileCacheService.GetUserDetails(nonExistingUserId);
|
||||
|
||||
Assert.That(nonExistingUserInfo, Is.Null, "Non existing user info unexpectedly found");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -70,18 +67,9 @@ namespace OpenSim.Framework.Communications.Tests
|
|||
[Test]
|
||||
public void TestRequestInventoryForUser()
|
||||
{
|
||||
UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000003");
|
||||
CommunicationsManager commsManager = UserProfileTestUtils.SetupServices();
|
||||
CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager);
|
||||
|
||||
CommunicationsManager commsManager = new TestCommunicationsManager();
|
||||
LocalUserServices lus = (LocalUserServices)commsManager.UserService;
|
||||
lus.AddPlugin(new TestUserDataPlugin());
|
||||
((LocalInventoryService)commsManager.InventoryService).AddPlugin(new TestInventoryDataPlugin());
|
||||
|
||||
lus.AddUser("Bill", "Bailey", "troll", "bill@bailey.com", 1000, 1000, userId);
|
||||
|
||||
commsManager.UserProfileCacheService.RequestInventoryForUser(userId);
|
||||
|
||||
CachedUserInfo userInfo = commsManager.UserProfileCacheService.GetUserDetails(userId);
|
||||
Assert.That(userInfo.HasReceivedInventory, Is.True);
|
||||
}
|
||||
|
||||
|
@ -91,19 +79,12 @@ namespace OpenSim.Framework.Communications.Tests
|
|||
[Test]
|
||||
public void TestCreateFolder()
|
||||
{
|
||||
UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000004");
|
||||
IUserDataPlugin userDataPlugin = new TestUserDataPlugin();
|
||||
IInventoryDataPlugin inventoryDataPlugin = new TestInventoryDataPlugin();
|
||||
|
||||
CommunicationsManager commsManager = new TestCommunicationsManager();
|
||||
LocalUserServices lus = (LocalUserServices)commsManager.UserService;
|
||||
lus.AddPlugin(new TestUserDataPlugin());
|
||||
TestInventoryDataPlugin inventoryDataPlugin = new TestInventoryDataPlugin();
|
||||
((LocalInventoryService)commsManager.InventoryService).AddPlugin(inventoryDataPlugin);
|
||||
|
||||
lus.AddUser("Bill", "Bailey", "troll", "bill@bailey.com", 1000, 1000, userId);
|
||||
|
||||
commsManager.UserProfileCacheService.RequestInventoryForUser(userId);
|
||||
|
||||
CachedUserInfo userInfo = commsManager.UserProfileCacheService.GetUserDetails(userId);
|
||||
CommunicationsManager commsManager
|
||||
= UserProfileTestUtils.SetupServices(userDataPlugin, inventoryDataPlugin);
|
||||
CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager);
|
||||
|
||||
UUID folderId = UUID.Parse("00000000-0000-0000-0000-000000000010");
|
||||
Assert.That(userInfo.RootFolder.ContainsChildFolder(folderId), Is.False);
|
||||
|
@ -119,18 +100,8 @@ namespace OpenSim.Framework.Communications.Tests
|
|||
[Test]
|
||||
public void TestGetChildFolder()
|
||||
{
|
||||
UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000005");
|
||||
|
||||
CommunicationsManager commsManager = new TestCommunicationsManager();
|
||||
LocalUserServices lus = (LocalUserServices)commsManager.UserService;
|
||||
lus.AddPlugin(new TestUserDataPlugin());
|
||||
((LocalInventoryService)commsManager.InventoryService).AddPlugin(new TestInventoryDataPlugin());
|
||||
|
||||
lus.AddUser("Bill", "Bailey", "troll", "bill@bailey.com", 1000, 1000, userId);
|
||||
|
||||
commsManager.UserProfileCacheService.RequestInventoryForUser(userId);
|
||||
|
||||
CachedUserInfo userInfo = commsManager.UserProfileCacheService.GetUserDetails(userId);
|
||||
CommunicationsManager commsManager = UserProfileTestUtils.SetupServices();
|
||||
CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager);
|
||||
|
||||
UUID folderId = UUID.Parse("00000000-0000-0000-0000-000000000011");
|
||||
|
||||
|
|
|
@ -233,18 +233,21 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
/// </summary>
|
||||
public delegate void RegisterCapsEvent(UUID agentID, Caps caps);
|
||||
public event RegisterCapsEvent OnRegisterCaps;
|
||||
|
||||
/// <summary>
|
||||
/// DeregisterCapsEvent is called by Scene when the caps
|
||||
/// handler for an agent are removed.
|
||||
/// </summary>
|
||||
public delegate void DeregisterCapsEvent(UUID agentID, Caps caps);
|
||||
public event DeregisterCapsEvent OnDeregisterCaps;
|
||||
|
||||
/// <summary>
|
||||
/// ChatFromWorldEvent is called via Scene when a chat message
|
||||
/// from world comes in.
|
||||
/// </summary>
|
||||
public delegate void ChatFromWorldEvent(Object sender, OSChatMessage chat);
|
||||
public event ChatFromWorldEvent OnChatFromWorld;
|
||||
|
||||
/// <summary>
|
||||
/// ChatFromClientEvent is triggered via ChatModule (or
|
||||
/// substitutes thereof) when a chat message
|
||||
|
@ -252,6 +255,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
/// </summary>
|
||||
public delegate void ChatFromClientEvent(Object sender, OSChatMessage chat);
|
||||
public event ChatFromClientEvent OnChatFromClient;
|
||||
|
||||
/// <summary>
|
||||
/// ChatBroadcastEvent is called via Scene when a broadcast chat message
|
||||
/// from world comes in
|
||||
|
|
|
@ -76,13 +76,15 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
/// </value>
|
||||
public ILandChannel LandChannel;
|
||||
|
||||
protected EventManager m_eventManager;
|
||||
|
||||
/// <value>
|
||||
/// Manage events that occur in this scene (avatar movement, script rez, etc.). Commonly used by region modules
|
||||
/// to subscribe to scene events.
|
||||
/// </value>
|
||||
public EventManager EventManager
|
||||
{
|
||||
get { return m_eventManager; }
|
||||
}
|
||||
|
||||
protected EventManager m_eventManager;
|
||||
|
||||
protected ScenePermissions m_permissions;
|
||||
public ScenePermissions Permissions
|
||||
|
|
Loading…
Reference in New Issue