aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Communications/Tests
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs62
-rw-r--r--OpenSim/Framework/Communications/Tests/Cache/UserProfileTestUtils.cs3
2 files changed, 28 insertions, 37 deletions
diff --git a/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs b/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs
index e2576ef..34f5c97 100644
--- a/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs
+++ b/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs
@@ -30,39 +30,46 @@ using NUnit.Framework.SyntaxHelpers;
30using OpenMetaverse; 30using OpenMetaverse;
31using OpenSim.Data; 31using OpenSim.Data;
32using OpenSim.Framework.Communications.Cache; 32using OpenSim.Framework.Communications.Cache;
33using OpenSim.Region.Communications.Local;
33using OpenSim.Tests.Common.Mock; 34using OpenSim.Tests.Common.Mock;
34//using OpenSim.Framework;
35 35
36namespace OpenSim.Framework.Communications.Tests 36namespace OpenSim.Framework.Communications.Tests
37{ 37{
38 /// <summary>
39 /// User profile cache service tests
40 /// </summary>
41 [TestFixture] 38 [TestFixture]
42 public class UserProfileCacheServiceTests 39 public class UserProfileCacheServiceTests
43 { 40 {
44 /// <summary>
45 /// Test user details get.
46 /// </summary>
47 [Test] 41 [Test]
48 public void TestGetUserDetails() 42 public void TestGetUserDetails()
49 { 43 {
50 UUID nonExistingUserId = UUID.Parse("00000000-0000-0000-0000-000000000001"); 44 UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000002");
51 UUID existingUserId = UUID.Parse("00000000-0000-0000-0000-000000000002"); 45 string firstName = "Bill";
52 46 string lastName = "Bailey";
47 CachedUserInfo nonExistingUserInfo;
48
53 TestCommunicationsManager commsManager = new TestCommunicationsManager(); 49 TestCommunicationsManager commsManager = new TestCommunicationsManager();
54 CachedUserInfo existingUserInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager, existingUserId); 50
55 51 // Check we can't retrieve info before it exists by uuid
56 Assert.That(existingUserInfo, Is.Not.Null, "Existing user info unexpectedly not found"); 52 nonExistingUserInfo = commsManager.UserProfileCacheService.GetUserDetails(userId);
57 53 Assert.That(nonExistingUserInfo, Is.Null, "User info found by uuid before user creation");
58 CachedUserInfo nonExistingUserInfo = commsManager.UserProfileCacheService.GetUserDetails(nonExistingUserId); 54
59 55 // Check we can't retrieve info before it exists by name
60 Assert.That(nonExistingUserInfo, Is.Null, "Non existing user info unexpectedly found"); 56 nonExistingUserInfo = commsManager.UserProfileCacheService.GetUserDetails(firstName, lastName);
57 Assert.That(nonExistingUserInfo, Is.Null, "User info found by name before user creation");
58
59 LocalUserServices lus = (LocalUserServices)commsManager.UserService;
60 lus.AddUser(firstName, lastName, "troll", "bill@bailey.com", 1000, 1000, userId);
61
62 CachedUserInfo existingUserInfo;
63
64 // Check we can retrieve info by uuid
65 existingUserInfo = commsManager.UserProfileCacheService.GetUserDetails(userId);
66 Assert.That(existingUserInfo, Is.Not.Null, "User info not found by uuid");
67
68 // Check we can retrieve info by name
69 existingUserInfo = commsManager.UserProfileCacheService.GetUserDetails(firstName, lastName);
70 Assert.That(existingUserInfo, Is.Not.Null, "User info not found by name");
61 } 71 }
62 72
63 /// <summary>
64 /// Test requesting inventory for a user
65 /// </summary>
66 [Test] 73 [Test]
67 public void TestFetchInventory() 74 public void TestFetchInventory()
68 { 75 {
@@ -72,9 +79,6 @@ namespace OpenSim.Framework.Communications.Tests
72 Assert.That(userInfo.HasReceivedInventory, Is.True); 79 Assert.That(userInfo.HasReceivedInventory, Is.True);
73 } 80 }
74 81
75 /// <summary>
76 /// Test retrieving a child folder
77 /// </summary>
78 [Test] 82 [Test]
79 public void TestGetChildFolder() 83 public void TestGetChildFolder()
80 { 84 {
@@ -89,9 +93,6 @@ namespace OpenSim.Framework.Communications.Tests
89 Assert.That(userInfo.RootFolder.GetChildFolder(folderId), Is.Not.Null); 93 Assert.That(userInfo.RootFolder.GetChildFolder(folderId), Is.Not.Null);
90 } 94 }
91 95
92 /// <summary>
93 /// Test creating an inventory folder
94 /// </summary>
95 [Test] 96 [Test]
96 public void TestCreateFolder() 97 public void TestCreateFolder()
97 { 98 {
@@ -119,9 +120,6 @@ namespace OpenSim.Framework.Communications.Tests
119 Assert.That(userInfo.RootFolder.ContainsChildFolder(folderId), Is.True); 120 Assert.That(userInfo.RootFolder.ContainsChildFolder(folderId), Is.True);
120 } 121 }
121 122
122 /// <summary>
123 /// Test updating a folder
124 /// </summary>
125 [Test] 123 [Test]
126 public void TestUpdateFolder() 124 public void TestUpdateFolder()
127 { 125 {
@@ -176,9 +174,6 @@ namespace OpenSim.Framework.Communications.Tests
176 174
177 } 175 }
178 176
179 /// <summary>
180 /// Test moving an inventory folder
181 /// </summary>
182 [Test] 177 [Test]
183 public void TestMoveFolder() 178 public void TestMoveFolder()
184 { 179 {
@@ -210,9 +205,6 @@ namespace OpenSim.Framework.Communications.Tests
210 Assert.That(folder1.ContainsChildFolder(folderToMoveId), Is.False); 205 Assert.That(folder1.ContainsChildFolder(folderToMoveId), Is.False);
211 } 206 }
212 207
213 /// <summary>
214 /// Test purging an inventory folder
215 /// </summary>
216 [Test] 208 [Test]
217 public void TestPurgeFolder() 209 public void TestPurgeFolder()
218 { 210 {
diff --git a/OpenSim/Framework/Communications/Tests/Cache/UserProfileTestUtils.cs b/OpenSim/Framework/Communications/Tests/Cache/UserProfileTestUtils.cs
index 93ce916..d0f92d6 100644
--- a/OpenSim/Framework/Communications/Tests/Cache/UserProfileTestUtils.cs
+++ b/OpenSim/Framework/Communications/Tests/Cache/UserProfileTestUtils.cs
@@ -32,7 +32,7 @@ using OpenSim.Region.Communications.Local;
32namespace OpenSim.Framework.Communications.Tests 32namespace OpenSim.Framework.Communications.Tests
33{ 33{
34 /// <summary> 34 /// <summary>
35 /// Utility functions for carrying out user profile relate tests. 35 /// Utility functions for carrying out user profile related tests.
36 /// </summary> 36 /// </summary>
37 public class UserProfileTestUtils 37 public class UserProfileTestUtils
38 { 38 {
@@ -56,7 +56,6 @@ namespace OpenSim.Framework.Communications.Tests
56 public static CachedUserInfo CreateUserWithInventory(CommunicationsManager commsManager, UUID userId) 56 public static CachedUserInfo CreateUserWithInventory(CommunicationsManager commsManager, UUID userId)
57 { 57 {
58 LocalUserServices lus = (LocalUserServices)commsManager.UserService; 58 LocalUserServices lus = (LocalUserServices)commsManager.UserService;
59
60 lus.AddUser("Bill", "Bailey", "troll", "bill@bailey.com", 1000, 1000, userId); 59 lus.AddUser("Bill", "Bailey", "troll", "bill@bailey.com", 1000, 1000, userId);
61 60
62 CachedUserInfo userInfo = commsManager.UserProfileCacheService.GetUserDetails(userId); 61 CachedUserInfo userInfo = commsManager.UserProfileCacheService.GetUserDetails(userId);