aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-12-12 18:48:29 +0000
committerJustin Clarke Casey2008-12-12 18:48:29 +0000
commita7e145bdfdb994f4c171d32740790cffc3fc4ad3 (patch)
tree9eefc934ead5addb8feac898540f27a40995d288 /OpenSim/Framework
parent* Deleted old EntiyList tests, added new EntityManager tests (diff)
downloadopensim-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
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/Communications/Cache/CachedUserInfo.cs1
-rw-r--r--OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs61
2 files changed, 16 insertions, 46 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