diff options
author | Mike Mazur | 2009-02-03 05:20:26 +0000 |
---|---|---|
committer | Mike Mazur | 2009-02-03 05:20:26 +0000 |
commit | 9377c6f2b28c75a093fa554d64e0d63e6bdf2fa5 (patch) | |
tree | 8dbd671990b4d6c5a40d369b0d026df8851b3e1f /OpenSim | |
parent | - move IAssetDataPlugin from OpenSim/Framework/IAssetProvider.cs to (diff) | |
download | opensim-SC-9377c6f2b28c75a093fa554d64e0d63e6bdf2fa5.zip opensim-SC-9377c6f2b28c75a093fa554d64e0d63e6bdf2fa5.tar.gz opensim-SC-9377c6f2b28c75a093fa554d64e0d63e6bdf2fa5.tar.bz2 opensim-SC-9377c6f2b28c75a093fa554d64e0d63e6bdf2fa5.tar.xz |
- move OpenSim/Framework/IInventoryData.cs to
OpenSim/Data/IInventoryData.cs
- trim trailing whitespace
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Data/IInventoryData.cs (renamed from OpenSim/Framework/IInventoryData.cs) | 5 | ||||
-rw-r--r-- | OpenSim/Data/Tests/BasicInventoryTest.cs | 20 | ||||
-rw-r--r-- | OpenSim/Framework/Communications/InventoryServiceBase.cs | 6 | ||||
-rw-r--r-- | OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs | 111 | ||||
-rw-r--r-- | OpenSim/Tests/Common/Mock/TestCommunicationsManager.cs | 23 | ||||
-rw-r--r-- | OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs | 69 |
6 files changed, 120 insertions, 114 deletions
diff --git a/OpenSim/Framework/IInventoryData.cs b/OpenSim/Data/IInventoryData.cs index 8ea1fb3..03b1cbe 100644 --- a/OpenSim/Framework/IInventoryData.cs +++ b/OpenSim/Data/IInventoryData.cs | |||
@@ -27,8 +27,9 @@ | |||
27 | 27 | ||
28 | using System.Collections.Generic; | 28 | using System.Collections.Generic; |
29 | using OpenMetaverse; | 29 | using OpenMetaverse; |
30 | using OpenSim.Framework; | ||
30 | 31 | ||
31 | namespace OpenSim.Framework | 32 | namespace OpenSim.Data |
32 | { | 33 | { |
33 | /// <summary> | 34 | /// <summary> |
34 | /// An interface for accessing inventory data from a storage server | 35 | /// An interface for accessing inventory data from a storage server |
@@ -130,7 +131,7 @@ namespace OpenSim.Framework | |||
130 | /// </summary> | 131 | /// </summary> |
131 | /// <param name="folder">The id of the folder</param> | 132 | /// <param name="folder">The id of the folder</param> |
132 | void deleteInventoryFolder(UUID folder); | 133 | void deleteInventoryFolder(UUID folder); |
133 | 134 | ||
134 | /// <summary> | 135 | /// <summary> |
135 | /// Returns all activated gesture-items in the inventory of the specified avatar. | 136 | /// Returns all activated gesture-items in the inventory of the specified avatar. |
136 | /// </summary> | 137 | /// </summary> |
diff --git a/OpenSim/Data/Tests/BasicInventoryTest.cs b/OpenSim/Data/Tests/BasicInventoryTest.cs index ea8e4e8..2e6226f 100644 --- a/OpenSim/Data/Tests/BasicInventoryTest.cs +++ b/OpenSim/Data/Tests/BasicInventoryTest.cs | |||
@@ -94,9 +94,9 @@ namespace OpenSim.Data.Tests | |||
94 | iname1 = "Shirt"; | 94 | iname1 = "Shirt"; |
95 | iname2 = "Text Board"; | 95 | iname2 = "Text Board"; |
96 | iname3 = "No Pants Barrel"; | 96 | iname3 = "No Pants Barrel"; |
97 | 97 | ||
98 | } | 98 | } |
99 | 99 | ||
100 | [Test] | 100 | [Test] |
101 | public void T001_LoadEmpty() | 101 | public void T001_LoadEmpty() |
102 | { | 102 | { |
@@ -163,7 +163,7 @@ namespace OpenSim.Data.Tests | |||
163 | { | 163 | { |
164 | InventoryFolderBase f2 = NewFolder(folder3, folder1, owner1, name3); | 164 | InventoryFolderBase f2 = NewFolder(folder3, folder1, owner1, name3); |
165 | db.addInventoryFolder(f2); | 165 | db.addInventoryFolder(f2); |
166 | 166 | ||
167 | Assert.That(db.getInventoryFolders(zero).Count, Is.EqualTo(1)); | 167 | Assert.That(db.getInventoryFolders(zero).Count, Is.EqualTo(1)); |
168 | Assert.That(db.getInventoryFolders(folder1).Count, Is.EqualTo(2)); | 168 | Assert.That(db.getInventoryFolders(folder1).Count, Is.EqualTo(2)); |
169 | Assert.That(db.getInventoryFolders(folder2).Count, Is.EqualTo(0)); | 169 | Assert.That(db.getInventoryFolders(folder2).Count, Is.EqualTo(0)); |
@@ -171,7 +171,7 @@ namespace OpenSim.Data.Tests | |||
171 | Assert.That(db.getInventoryFolders(UUID.Random()).Count, Is.EqualTo(0)); | 171 | Assert.That(db.getInventoryFolders(UUID.Random()).Count, Is.EqualTo(0)); |
172 | 172 | ||
173 | } | 173 | } |
174 | 174 | ||
175 | [Test] | 175 | [Test] |
176 | public void T013_FolderHierarchy() | 176 | public void T013_FolderHierarchy() |
177 | { | 177 | { |
@@ -182,14 +182,14 @@ namespace OpenSim.Data.Tests | |||
182 | Assert.That(db.getFolderHierarchy(UUID.Random()).Count, Is.EqualTo(0)); | 182 | Assert.That(db.getFolderHierarchy(UUID.Random()).Count, Is.EqualTo(0)); |
183 | } | 183 | } |
184 | 184 | ||
185 | 185 | ||
186 | [Test] | 186 | [Test] |
187 | public void T014_MoveFolder() | 187 | public void T014_MoveFolder() |
188 | { | 188 | { |
189 | InventoryFolderBase f2 = db.getInventoryFolder(folder2); | 189 | InventoryFolderBase f2 = db.getInventoryFolder(folder2); |
190 | f2.ParentID = folder3; | 190 | f2.ParentID = folder3; |
191 | db.moveInventoryFolder(f2); | 191 | db.moveInventoryFolder(f2); |
192 | 192 | ||
193 | Assert.That(db.getInventoryFolders(zero).Count, Is.EqualTo(1)); | 193 | Assert.That(db.getInventoryFolders(zero).Count, Is.EqualTo(1)); |
194 | Assert.That(db.getInventoryFolders(folder1).Count, Is.EqualTo(1)); | 194 | Assert.That(db.getInventoryFolders(folder1).Count, Is.EqualTo(1)); |
195 | Assert.That(db.getInventoryFolders(folder2).Count, Is.EqualTo(0)); | 195 | Assert.That(db.getInventoryFolders(folder2).Count, Is.EqualTo(0)); |
@@ -228,7 +228,7 @@ namespace OpenSim.Data.Tests | |||
228 | db.addInventoryItem(NewItem(item3, folder3, owner1, iname3, asset3)); | 228 | db.addInventoryItem(NewItem(item3, folder3, owner1, iname3, asset3)); |
229 | Assert.That(db.getInventoryInFolder(folder3).Count, Is.EqualTo(3)); | 229 | Assert.That(db.getInventoryInFolder(folder3).Count, Is.EqualTo(3)); |
230 | } | 230 | } |
231 | 231 | ||
232 | [Test] | 232 | [Test] |
233 | public void T102_CompareItems() | 233 | public void T102_CompareItems() |
234 | { | 234 | { |
@@ -245,7 +245,7 @@ namespace OpenSim.Data.Tests | |||
245 | Assert.That(i2.AssetID, Is.EqualTo(asset2)); | 245 | Assert.That(i2.AssetID, Is.EqualTo(asset2)); |
246 | Assert.That(i3.AssetID, Is.EqualTo(asset3)); | 246 | Assert.That(i3.AssetID, Is.EqualTo(asset3)); |
247 | } | 247 | } |
248 | 248 | ||
249 | [Test] | 249 | [Test] |
250 | public void T103UpdateItem() | 250 | public void T103UpdateItem() |
251 | { | 251 | { |
@@ -257,7 +257,7 @@ namespace OpenSim.Data.Tests | |||
257 | i1.Description = niname1; | 257 | i1.Description = niname1; |
258 | i1.Owner = owner2; | 258 | i1.Owner = owner2; |
259 | db.updateInventoryItem(i1); | 259 | db.updateInventoryItem(i1); |
260 | 260 | ||
261 | i1 = db.getInventoryItem(item1); | 261 | i1 = db.getInventoryItem(item1); |
262 | Assert.That(i1.Name, Is.EqualTo(niname1)); | 262 | Assert.That(i1.Name, Is.EqualTo(niname1)); |
263 | Assert.That(i1.Description, Is.EqualTo(niname1)); | 263 | Assert.That(i1.Description, Is.EqualTo(niname1)); |
@@ -287,4 +287,4 @@ namespace OpenSim.Data.Tests | |||
287 | return f; | 287 | return f; |
288 | } | 288 | } |
289 | } | 289 | } |
290 | } \ No newline at end of file | 290 | } |
diff --git a/OpenSim/Framework/Communications/InventoryServiceBase.cs b/OpenSim/Framework/Communications/InventoryServiceBase.cs index 7a44420..ec5c493 100644 --- a/OpenSim/Framework/Communications/InventoryServiceBase.cs +++ b/OpenSim/Framework/Communications/InventoryServiceBase.cs | |||
@@ -33,6 +33,8 @@ using System.Threading; | |||
33 | using OpenMetaverse; | 33 | using OpenMetaverse; |
34 | using log4net; | 34 | using log4net; |
35 | 35 | ||
36 | using OpenSim.Data; | ||
37 | |||
36 | namespace OpenSim.Framework.Communications | 38 | namespace OpenSim.Framework.Communications |
37 | { | 39 | { |
38 | /// <summary> | 40 | /// <summary> |
@@ -50,12 +52,12 @@ namespace OpenSim.Framework.Communications | |||
50 | /// <summary> | 52 | /// <summary> |
51 | /// Add a new inventory data plugin - plugins will be requested in the order they were added. | 53 | /// Add a new inventory data plugin - plugins will be requested in the order they were added. |
52 | /// </summary> | 54 | /// </summary> |
53 | /// <param name="plugin">The plugin that will provide data</param> | 55 | /// <param name="plugin">The plugin that will provide data</param> |
54 | public void AddPlugin(IInventoryDataPlugin plugin) | 56 | public void AddPlugin(IInventoryDataPlugin plugin) |
55 | { | 57 | { |
56 | m_plugins.Add(plugin); | 58 | m_plugins.Add(plugin); |
57 | } | 59 | } |
58 | 60 | ||
59 | /// <summary> | 61 | /// <summary> |
60 | /// Adds a new inventory data plugin - plugins will be requested in the order they were loaded. | 62 | /// Adds a new inventory data plugin - plugins will be requested in the order they were loaded. |
61 | /// </summary> | 63 | /// </summary> |
diff --git a/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs b/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs index 827a03b..86d85b1 100644 --- a/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs +++ b/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs | |||
@@ -30,19 +30,20 @@ using log4net; | |||
30 | using NUnit.Framework; | 30 | using NUnit.Framework; |
31 | using NUnit.Framework.SyntaxHelpers; | 31 | using NUnit.Framework.SyntaxHelpers; |
32 | using OpenMetaverse; | 32 | using OpenMetaverse; |
33 | using OpenSim.Framework; | 33 | //using OpenSim.Framework; |
34 | using OpenSim.Framework.Communications.Cache; | 34 | using OpenSim.Framework.Communications.Cache; |
35 | using OpenSim.Region.Communications.Local; | 35 | using OpenSim.Region.Communications.Local; |
36 | using OpenSim.Tests.Common.Mock; | 36 | using OpenSim.Tests.Common.Mock; |
37 | using OpenSim.Data; | ||
37 | 38 | ||
38 | namespace OpenSim.Framework.Communications.Tests | 39 | namespace OpenSim.Framework.Communications.Tests |
39 | { | 40 | { |
40 | /// <summary> | 41 | /// <summary> |
41 | /// User profile cache service tests | 42 | /// User profile cache service tests |
42 | /// </summary> | 43 | /// </summary> |
43 | [TestFixture] | 44 | [TestFixture] |
44 | public class UserProfileCacheServiceTests | 45 | public class UserProfileCacheServiceTests |
45 | { | 46 | { |
46 | /// <summary> | 47 | /// <summary> |
47 | /// Test user details get. | 48 | /// Test user details get. |
48 | /// </summary> | 49 | /// </summary> |
@@ -51,17 +52,17 @@ namespace OpenSim.Framework.Communications.Tests | |||
51 | { | 52 | { |
52 | UUID nonExistingUserId = UUID.Parse("00000000-0000-0000-0000-000000000001"); | 53 | UUID nonExistingUserId = UUID.Parse("00000000-0000-0000-0000-000000000001"); |
53 | UUID existingUserId = UUID.Parse("00000000-0000-0000-0000-000000000002"); | 54 | UUID existingUserId = UUID.Parse("00000000-0000-0000-0000-000000000002"); |
54 | 55 | ||
55 | TestCommunicationsManager commsManager = new TestCommunicationsManager(); | 56 | TestCommunicationsManager commsManager = new TestCommunicationsManager(); |
56 | CachedUserInfo existingUserInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager, existingUserId); | 57 | CachedUserInfo existingUserInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager, existingUserId); |
57 | 58 | ||
58 | Assert.That(existingUserInfo, Is.Not.Null, "Existing user info unexpectedly not found"); | 59 | Assert.That(existingUserInfo, Is.Not.Null, "Existing user info unexpectedly not found"); |
59 | 60 | ||
60 | CachedUserInfo nonExistingUserInfo = commsManager.UserProfileCacheService.GetUserDetails(nonExistingUserId); | 61 | CachedUserInfo nonExistingUserInfo = commsManager.UserProfileCacheService.GetUserDetails(nonExistingUserId); |
61 | 62 | ||
62 | Assert.That(nonExistingUserInfo, Is.Null, "Non existing user info unexpectedly found"); | 63 | Assert.That(nonExistingUserInfo, Is.Null, "Non existing user info unexpectedly found"); |
63 | } | 64 | } |
64 | 65 | ||
65 | /// <summary> | 66 | /// <summary> |
66 | /// Test requesting inventory for a user | 67 | /// Test requesting inventory for a user |
67 | /// </summary> | 68 | /// </summary> |
@@ -69,11 +70,11 @@ namespace OpenSim.Framework.Communications.Tests | |||
69 | public void TestRequestInventoryForUser() | 70 | public void TestRequestInventoryForUser() |
70 | { | 71 | { |
71 | TestCommunicationsManager commsManager = new TestCommunicationsManager(); | 72 | TestCommunicationsManager commsManager = new TestCommunicationsManager(); |
72 | CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager); | 73 | CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager); |
73 | 74 | ||
74 | Assert.That(userInfo.HasReceivedInventory, Is.True); | 75 | Assert.That(userInfo.HasReceivedInventory, Is.True); |
75 | } | 76 | } |
76 | 77 | ||
77 | /// <summary> | 78 | /// <summary> |
78 | /// Test retrieving a child folder | 79 | /// Test retrieving a child folder |
79 | /// </summary> | 80 | /// </summary> |
@@ -82,45 +83,45 @@ namespace OpenSim.Framework.Communications.Tests | |||
82 | { | 83 | { |
83 | TestCommunicationsManager commsManager = new TestCommunicationsManager(); | 84 | TestCommunicationsManager commsManager = new TestCommunicationsManager(); |
84 | CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager); | 85 | CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager); |
85 | 86 | ||
86 | UUID folderId = UUID.Parse("00000000-0000-0000-0000-000000000011"); | 87 | UUID folderId = UUID.Parse("00000000-0000-0000-0000-000000000011"); |
87 | 88 | ||
88 | Assert.That(userInfo.RootFolder.GetChildFolder(folderId), Is.Null); | 89 | Assert.That(userInfo.RootFolder.GetChildFolder(folderId), Is.Null); |
89 | userInfo.CreateFolder("testFolder", folderId, (ushort)AssetType.Animation, userInfo.RootFolder.ID); | 90 | userInfo.CreateFolder("testFolder", folderId, (ushort)AssetType.Animation, userInfo.RootFolder.ID); |
90 | 91 | ||
91 | Assert.That(userInfo.RootFolder.GetChildFolder(folderId), Is.Not.Null); | 92 | Assert.That(userInfo.RootFolder.GetChildFolder(folderId), Is.Not.Null); |
92 | } | 93 | } |
93 | 94 | ||
94 | /// <summary> | 95 | /// <summary> |
95 | /// Test creating an inventory folder | 96 | /// Test creating an inventory folder |
96 | /// </summary> | 97 | /// </summary> |
97 | [Test] | 98 | [Test] |
98 | public void TestCreateFolder() | 99 | public void TestCreateFolder() |
99 | { | 100 | { |
100 | TestCommunicationsManager commsManager = new TestCommunicationsManager(); | 101 | TestCommunicationsManager commsManager = new TestCommunicationsManager(); |
101 | IInventoryDataPlugin inventoryDataPlugin = commsManager.InventoryDataPlugin; | 102 | IInventoryDataPlugin inventoryDataPlugin = commsManager.InventoryDataPlugin; |
102 | 103 | ||
103 | CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager); | 104 | CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager); |
104 | 105 | ||
105 | UUID folderId = UUID.Parse("00000000-0000-0000-0000-000000000010"); | 106 | UUID folderId = UUID.Parse("00000000-0000-0000-0000-000000000010"); |
106 | Assert.That(userInfo.RootFolder.ContainsChildFolder(folderId), Is.False); | 107 | Assert.That(userInfo.RootFolder.ContainsChildFolder(folderId), Is.False); |
107 | 108 | ||
108 | // 1: Try a folder create that should fail because the parent id given does not exist | 109 | // 1: Try a folder create that should fail because the parent id given does not exist |
109 | UUID missingFolderId = UUID.Random(); | 110 | UUID missingFolderId = UUID.Random(); |
110 | 111 | ||
111 | Assert.That( | 112 | Assert.That( |
112 | userInfo.CreateFolder("testFolder1", folderId, (ushort)AssetType.Animation, missingFolderId), Is.False); | 113 | userInfo.CreateFolder("testFolder1", folderId, (ushort)AssetType.Animation, missingFolderId), Is.False); |
113 | Assert.That(inventoryDataPlugin.getInventoryFolder(folderId), Is.Null); | 114 | Assert.That(inventoryDataPlugin.getInventoryFolder(folderId), Is.Null); |
114 | Assert.That(userInfo.RootFolder.ContainsChildFolder(missingFolderId), Is.False); | 115 | Assert.That(userInfo.RootFolder.ContainsChildFolder(missingFolderId), Is.False); |
115 | Assert.That(userInfo.RootFolder.FindFolder(folderId), Is.Null); | 116 | Assert.That(userInfo.RootFolder.FindFolder(folderId), Is.Null); |
116 | 117 | ||
117 | // 2: Try a folder create that should work | 118 | // 2: Try a folder create that should work |
118 | Assert.That( | 119 | Assert.That( |
119 | userInfo.CreateFolder("testFolder2", folderId, (ushort)AssetType.Animation, userInfo.RootFolder.ID), Is.True); | 120 | userInfo.CreateFolder("testFolder2", folderId, (ushort)AssetType.Animation, userInfo.RootFolder.ID), Is.True); |
120 | Assert.That(inventoryDataPlugin.getInventoryFolder(folderId), Is.Not.Null); | 121 | Assert.That(inventoryDataPlugin.getInventoryFolder(folderId), Is.Not.Null); |
121 | Assert.That(userInfo.RootFolder.ContainsChildFolder(folderId), Is.True); | 122 | Assert.That(userInfo.RootFolder.ContainsChildFolder(folderId), Is.True); |
122 | } | 123 | } |
123 | 124 | ||
124 | /// <summary> | 125 | /// <summary> |
125 | /// Test updating a folder | 126 | /// Test updating a folder |
126 | /// </summary> | 127 | /// </summary> |
@@ -129,54 +130,54 @@ namespace OpenSim.Framework.Communications.Tests | |||
129 | { | 130 | { |
130 | TestCommunicationsManager commsManager = new TestCommunicationsManager(); | 131 | TestCommunicationsManager commsManager = new TestCommunicationsManager(); |
131 | IInventoryDataPlugin inventoryDataPlugin = commsManager.InventoryDataPlugin; | 132 | IInventoryDataPlugin inventoryDataPlugin = commsManager.InventoryDataPlugin; |
132 | 133 | ||
133 | CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager); | 134 | CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager); |
134 | 135 | ||
135 | UUID folder1Id = UUID.Parse("00000000-0000-0000-0000-000000000060"); | 136 | UUID folder1Id = UUID.Parse("00000000-0000-0000-0000-000000000060"); |
136 | InventoryFolderImpl rootFolder = userInfo.RootFolder; | 137 | InventoryFolderImpl rootFolder = userInfo.RootFolder; |
137 | 138 | ||
138 | userInfo.CreateFolder("folder1", folder1Id, (ushort)AssetType.Animation, rootFolder.ID); | 139 | userInfo.CreateFolder("folder1", folder1Id, (ushort)AssetType.Animation, rootFolder.ID); |
139 | 140 | ||
140 | // 1: Test updates that don't involve moving the folder | 141 | // 1: Test updates that don't involve moving the folder |
141 | { | 142 | { |
142 | string newFolderName1 = "newFolderName1"; | 143 | string newFolderName1 = "newFolderName1"; |
143 | ushort folderType1 = (ushort)AssetType.Texture; | 144 | ushort folderType1 = (ushort)AssetType.Texture; |
144 | userInfo.UpdateFolder(newFolderName1, folder1Id, folderType1, rootFolder.ID); | 145 | userInfo.UpdateFolder(newFolderName1, folder1Id, folderType1, rootFolder.ID); |
145 | 146 | ||
146 | InventoryFolderImpl folder1 = rootFolder.GetChildFolder(folder1Id); | 147 | InventoryFolderImpl folder1 = rootFolder.GetChildFolder(folder1Id); |
147 | Assert.That(newFolderName1, Is.EqualTo(folder1.Name)); | 148 | Assert.That(newFolderName1, Is.EqualTo(folder1.Name)); |
148 | Assert.That(folderType1, Is.EqualTo((ushort)folder1.Type)); | 149 | Assert.That(folderType1, Is.EqualTo((ushort)folder1.Type)); |
149 | 150 | ||
150 | InventoryFolderBase dataFolder1 = inventoryDataPlugin.getInventoryFolder(folder1Id); | 151 | InventoryFolderBase dataFolder1 = inventoryDataPlugin.getInventoryFolder(folder1Id); |
151 | Assert.That(newFolderName1, Is.EqualTo(dataFolder1.Name)); | 152 | Assert.That(newFolderName1, Is.EqualTo(dataFolder1.Name)); |
152 | Assert.That(folderType1, Is.EqualTo((ushort)dataFolder1.Type)); | 153 | Assert.That(folderType1, Is.EqualTo((ushort)dataFolder1.Type)); |
153 | } | 154 | } |
154 | 155 | ||
155 | // 2: Test an update that also involves moving the folder | 156 | // 2: Test an update that also involves moving the folder |
156 | { | 157 | { |
157 | UUID folder2Id = UUID.Parse("00000000-0000-0000-0000-000000000061"); | 158 | UUID folder2Id = UUID.Parse("00000000-0000-0000-0000-000000000061"); |
158 | userInfo.CreateFolder("folder2", folder2Id, (ushort)AssetType.Animation, rootFolder.ID); | 159 | userInfo.CreateFolder("folder2", folder2Id, (ushort)AssetType.Animation, rootFolder.ID); |
159 | InventoryFolderImpl folder2 = rootFolder.GetChildFolder(folder2Id); | 160 | InventoryFolderImpl folder2 = rootFolder.GetChildFolder(folder2Id); |
160 | 161 | ||
161 | string newFolderName2 = "newFolderName2"; | 162 | string newFolderName2 = "newFolderName2"; |
162 | ushort folderType2 = (ushort)AssetType.Bodypart; | 163 | ushort folderType2 = (ushort)AssetType.Bodypart; |
163 | userInfo.UpdateFolder(newFolderName2, folder1Id, folderType2, folder2Id); | 164 | userInfo.UpdateFolder(newFolderName2, folder1Id, folderType2, folder2Id); |
164 | 165 | ||
165 | InventoryFolderImpl folder1 = folder2.GetChildFolder(folder1Id); | 166 | InventoryFolderImpl folder1 = folder2.GetChildFolder(folder1Id); |
166 | Assert.That(newFolderName2, Is.EqualTo(folder1.Name)); | 167 | Assert.That(newFolderName2, Is.EqualTo(folder1.Name)); |
167 | Assert.That(folderType2, Is.EqualTo((ushort)folder1.Type)); | 168 | Assert.That(folderType2, Is.EqualTo((ushort)folder1.Type)); |
168 | Assert.That(folder2Id, Is.EqualTo(folder1.ParentID)); | 169 | Assert.That(folder2Id, Is.EqualTo(folder1.ParentID)); |
169 | 170 | ||
170 | Assert.That(folder2.ContainsChildFolder(folder1Id), Is.True); | 171 | Assert.That(folder2.ContainsChildFolder(folder1Id), Is.True); |
171 | Assert.That(rootFolder.ContainsChildFolder(folder1Id), Is.False); | 172 | Assert.That(rootFolder.ContainsChildFolder(folder1Id), Is.False); |
172 | 173 | ||
173 | InventoryFolderBase dataFolder1 = inventoryDataPlugin.getInventoryFolder(folder1Id); | 174 | InventoryFolderBase dataFolder1 = inventoryDataPlugin.getInventoryFolder(folder1Id); |
174 | Assert.That(newFolderName2, Is.EqualTo(dataFolder1.Name)); | 175 | Assert.That(newFolderName2, Is.EqualTo(dataFolder1.Name)); |
175 | Assert.That(folderType2, Is.EqualTo((ushort)dataFolder1.Type)); | 176 | Assert.That(folderType2, Is.EqualTo((ushort)dataFolder1.Type)); |
176 | Assert.That(folder2Id, Is.EqualTo(dataFolder1.ParentID)); | 177 | Assert.That(folder2Id, Is.EqualTo(dataFolder1.ParentID)); |
177 | } | 178 | } |
178 | 179 | ||
179 | } | 180 | } |
180 | 181 | ||
181 | /// <summary> | 182 | /// <summary> |
182 | /// Test moving an inventory folder | 183 | /// Test moving an inventory folder |
@@ -186,32 +187,32 @@ namespace OpenSim.Framework.Communications.Tests | |||
186 | { | 187 | { |
187 | TestCommunicationsManager commsManager = new TestCommunicationsManager(); | 188 | TestCommunicationsManager commsManager = new TestCommunicationsManager(); |
188 | IInventoryDataPlugin inventoryDataPlugin = commsManager.InventoryDataPlugin; | 189 | IInventoryDataPlugin inventoryDataPlugin = commsManager.InventoryDataPlugin; |
189 | 190 | ||
190 | CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager); | 191 | CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager); |
191 | 192 | ||
192 | UUID folder1Id = UUID.Parse("00000000-0000-0000-0000-000000000020"); | 193 | UUID folder1Id = UUID.Parse("00000000-0000-0000-0000-000000000020"); |
193 | UUID folder2Id = UUID.Parse("00000000-0000-0000-0000-000000000021"); | 194 | UUID folder2Id = UUID.Parse("00000000-0000-0000-0000-000000000021"); |
194 | UUID folderToMoveId = UUID.Parse("00000000-0000-0000-0000-000000000030"); | 195 | UUID folderToMoveId = UUID.Parse("00000000-0000-0000-0000-000000000030"); |
195 | InventoryFolderImpl rootFolder = userInfo.RootFolder; | 196 | InventoryFolderImpl rootFolder = userInfo.RootFolder; |
196 | 197 | ||
197 | userInfo.CreateFolder("folder1", folder1Id, (ushort)AssetType.Animation, rootFolder.ID); | 198 | userInfo.CreateFolder("folder1", folder1Id, (ushort)AssetType.Animation, rootFolder.ID); |
198 | InventoryFolderImpl folder1 = rootFolder.GetChildFolder(folder1Id); | 199 | InventoryFolderImpl folder1 = rootFolder.GetChildFolder(folder1Id); |
199 | userInfo.CreateFolder("folder2", folder2Id, (ushort)AssetType.Animation, rootFolder.ID); | 200 | userInfo.CreateFolder("folder2", folder2Id, (ushort)AssetType.Animation, rootFolder.ID); |
200 | InventoryFolderImpl folder2 = rootFolder.GetChildFolder(folder2Id); | 201 | InventoryFolderImpl folder2 = rootFolder.GetChildFolder(folder2Id); |
201 | 202 | ||
202 | // Check folder is currently in folder1 | 203 | // Check folder is currently in folder1 |
203 | userInfo.CreateFolder("folderToMove", folderToMoveId, (ushort)AssetType.Animation, folder1Id); | 204 | userInfo.CreateFolder("folderToMove", folderToMoveId, (ushort)AssetType.Animation, folder1Id); |
204 | Assert.That(folder1.ContainsChildFolder(folderToMoveId), Is.True); | 205 | Assert.That(folder1.ContainsChildFolder(folderToMoveId), Is.True); |
205 | 206 | ||
206 | userInfo.MoveFolder(folderToMoveId, folder2Id); | 207 | userInfo.MoveFolder(folderToMoveId, folder2Id); |
207 | 208 | ||
208 | // Check folder is now in folder2 and no trace remains in folder1 | 209 | // Check folder is now in folder2 and no trace remains in folder1 |
209 | Assert.That(folder2.ContainsChildFolder(folderToMoveId), Is.True); | 210 | Assert.That(folder2.ContainsChildFolder(folderToMoveId), Is.True); |
210 | Assert.That(inventoryDataPlugin.getInventoryFolder(folderToMoveId).ParentID, Is.EqualTo(folder2Id)); | 211 | Assert.That(inventoryDataPlugin.getInventoryFolder(folderToMoveId).ParentID, Is.EqualTo(folder2Id)); |
211 | 212 | ||
212 | Assert.That(folder1.ContainsChildFolder(folderToMoveId), Is.False); | 213 | Assert.That(folder1.ContainsChildFolder(folderToMoveId), Is.False); |
213 | } | 214 | } |
214 | 215 | ||
215 | /// <summary> | 216 | /// <summary> |
216 | /// Test purging an inventory folder | 217 | /// Test purging an inventory folder |
217 | /// </summary> | 218 | /// </summary> |
@@ -219,21 +220,21 @@ namespace OpenSim.Framework.Communications.Tests | |||
219 | public void TestPurgeFolder() | 220 | public void TestPurgeFolder() |
220 | { | 221 | { |
221 | //log4net.Config.XmlConfigurator.Configure(); | 222 | //log4net.Config.XmlConfigurator.Configure(); |
222 | 223 | ||
223 | TestCommunicationsManager commsManager = new TestCommunicationsManager(); | 224 | TestCommunicationsManager commsManager = new TestCommunicationsManager(); |
224 | IInventoryDataPlugin inventoryDataPlugin = commsManager.InventoryDataPlugin; | 225 | IInventoryDataPlugin inventoryDataPlugin = commsManager.InventoryDataPlugin; |
225 | 226 | ||
226 | CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager); | 227 | CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager); |
227 | 228 | ||
228 | UUID folder1Id = UUID.Parse("00000000-0000-0000-0000-000000000070"); | 229 | UUID folder1Id = UUID.Parse("00000000-0000-0000-0000-000000000070"); |
229 | InventoryFolderImpl rootFolder = userInfo.RootFolder; | 230 | InventoryFolderImpl rootFolder = userInfo.RootFolder; |
230 | 231 | ||
231 | userInfo.CreateFolder("folder1", folder1Id, (ushort)AssetType.Animation, rootFolder.ID); | 232 | userInfo.CreateFolder("folder1", folder1Id, (ushort)AssetType.Animation, rootFolder.ID); |
232 | Assert.That(inventoryDataPlugin.getInventoryFolder(folder1Id), Is.Not.Null); | 233 | Assert.That(inventoryDataPlugin.getInventoryFolder(folder1Id), Is.Not.Null); |
233 | 234 | ||
234 | // Test purge | 235 | // Test purge |
235 | userInfo.PurgeFolder(rootFolder.ID); | 236 | userInfo.PurgeFolder(rootFolder.ID); |
236 | 237 | ||
237 | Assert.That(rootFolder.RequestListOfFolders(), Is.Empty); | 238 | Assert.That(rootFolder.RequestListOfFolders(), Is.Empty); |
238 | Assert.That(inventoryDataPlugin.getInventoryFolder(folder1Id), Is.Null); | 239 | Assert.That(inventoryDataPlugin.getInventoryFolder(folder1Id), Is.Null); |
239 | } | 240 | } |
diff --git a/OpenSim/Tests/Common/Mock/TestCommunicationsManager.cs b/OpenSim/Tests/Common/Mock/TestCommunicationsManager.cs index 1663ac1..566d8d2 100644 --- a/OpenSim/Tests/Common/Mock/TestCommunicationsManager.cs +++ b/OpenSim/Tests/Common/Mock/TestCommunicationsManager.cs | |||
@@ -30,6 +30,7 @@ using OpenSim.Framework.Communications; | |||
30 | using OpenSim.Framework.Communications.Cache; | 30 | using OpenSim.Framework.Communications.Cache; |
31 | using OpenSim.Framework.Servers; | 31 | using OpenSim.Framework.Servers; |
32 | using OpenSim.Region.Communications.Local; | 32 | using OpenSim.Region.Communications.Local; |
33 | using OpenSim.Data; | ||
33 | 34 | ||
34 | namespace OpenSim.Tests.Common.Mock | 35 | namespace OpenSim.Tests.Common.Mock |
35 | { | 36 | { |
@@ -40,36 +41,36 @@ namespace OpenSim.Tests.Common.Mock | |||
40 | get { return m_userDataPlugin; } | 41 | get { return m_userDataPlugin; } |
41 | } | 42 | } |
42 | private IUserDataPlugin m_userDataPlugin; | 43 | private IUserDataPlugin m_userDataPlugin; |
43 | 44 | ||
44 | public IInventoryDataPlugin InventoryDataPlugin | 45 | public IInventoryDataPlugin InventoryDataPlugin |
45 | { | 46 | { |
46 | get { return m_inventoryDataPlugin; } | 47 | get { return m_inventoryDataPlugin; } |
47 | } | 48 | } |
48 | private IInventoryDataPlugin m_inventoryDataPlugin; | 49 | private IInventoryDataPlugin m_inventoryDataPlugin; |
49 | 50 | ||
50 | public TestCommunicationsManager() | 51 | public TestCommunicationsManager() |
51 | : this(null) | 52 | : this(null) |
52 | { | 53 | { |
53 | } | 54 | } |
54 | 55 | ||
55 | public TestCommunicationsManager(NetworkServersInfo serversInfo) | 56 | public TestCommunicationsManager(NetworkServersInfo serversInfo) |
56 | : base(serversInfo, new BaseHttpServer(666), null, false, null) | 57 | : base(serversInfo, new BaseHttpServer(666), null, false, null) |
57 | { | 58 | { |
58 | m_userDataPlugin = new TestUserDataPlugin(); | 59 | m_userDataPlugin = new TestUserDataPlugin(); |
59 | m_inventoryDataPlugin = new TestInventoryDataPlugin(); | 60 | m_inventoryDataPlugin = new TestInventoryDataPlugin(); |
60 | 61 | ||
61 | LocalInventoryService lis = new LocalInventoryService(); | 62 | LocalInventoryService lis = new LocalInventoryService(); |
62 | lis.AddPlugin(m_inventoryDataPlugin); | 63 | lis.AddPlugin(m_inventoryDataPlugin); |
63 | m_interServiceInventoryService = lis; | 64 | m_interServiceInventoryService = lis; |
64 | AddInventoryService(lis); | 65 | AddInventoryService(lis); |
65 | 66 | ||
66 | LocalUserServices lus = new LocalUserServices(991, 992, lis); | 67 | LocalUserServices lus = new LocalUserServices(991, 992, lis); |
67 | lus.AddPlugin(m_userDataPlugin); | 68 | lus.AddPlugin(m_userDataPlugin); |
68 | m_userService = lus; | 69 | m_userService = lus; |
69 | m_userAdminService = lus; | 70 | m_userAdminService = lus; |
70 | 71 | ||
71 | LocalBackEndServices gs = new LocalBackEndServices(); | 72 | LocalBackEndServices gs = new LocalBackEndServices(); |
72 | m_gridService = gs; | 73 | m_gridService = gs; |
73 | m_interRegion = gs; | 74 | m_interRegion = gs; |
74 | } | 75 | } |
75 | } | 76 | } |
diff --git a/OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs b/OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs index 8e19aec..59d923c 100644 --- a/OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs +++ b/OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs | |||
@@ -29,6 +29,7 @@ using System; | |||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using OpenMetaverse; | 30 | using OpenMetaverse; |
31 | using OpenSim.Framework; | 31 | using OpenSim.Framework; |
32 | using OpenSim.Data; | ||
32 | 33 | ||
33 | namespace OpenSim.Tests.Common.Mock | 34 | namespace OpenSim.Tests.Common.Mock |
34 | { | 35 | { |
@@ -43,12 +44,12 @@ namespace OpenSim.Tests.Common.Mock | |||
43 | /// Known inventory folders | 44 | /// Known inventory folders |
44 | /// </value> | 45 | /// </value> |
45 | private Dictionary<UUID, InventoryFolderBase> m_folders = new Dictionary<UUID, InventoryFolderBase>(); | 46 | private Dictionary<UUID, InventoryFolderBase> m_folders = new Dictionary<UUID, InventoryFolderBase>(); |
46 | 47 | ||
47 | /// <value> | 48 | /// <value> |
48 | /// User root folders | 49 | /// User root folders |
49 | /// </value> | 50 | /// </value> |
50 | private Dictionary<UUID, InventoryFolderBase> m_rootFolders = new Dictionary<UUID, InventoryFolderBase>(); | 51 | private Dictionary<UUID, InventoryFolderBase> m_rootFolders = new Dictionary<UUID, InventoryFolderBase>(); |
51 | 52 | ||
52 | public string Version { get { return "0"; } } | 53 | public string Version { get { return "0"; } } |
53 | public string Name { get { return "TestInventoryDataPlugin"; } } | 54 | public string Name { get { return "TestInventoryDataPlugin"; } } |
54 | 55 | ||
@@ -56,10 +57,10 @@ namespace OpenSim.Tests.Common.Mock | |||
56 | public void Initialise(string connect) {} | 57 | public void Initialise(string connect) {} |
57 | public void Dispose() {} | 58 | public void Dispose() {} |
58 | 59 | ||
59 | public List<InventoryFolderBase> getFolderHierarchy(UUID parentID) | 60 | public List<InventoryFolderBase> getFolderHierarchy(UUID parentID) |
60 | { | 61 | { |
61 | List<InventoryFolderBase> folders = new List<InventoryFolderBase>(); | 62 | List<InventoryFolderBase> folders = new List<InventoryFolderBase>(); |
62 | 63 | ||
63 | foreach (InventoryFolderBase folder in m_folders.Values) | 64 | foreach (InventoryFolderBase folder in m_folders.Values) |
64 | { | 65 | { |
65 | if (folder.ParentID == parentID) | 66 | if (folder.ParentID == parentID) |
@@ -68,77 +69,77 @@ namespace OpenSim.Tests.Common.Mock | |||
68 | folders.Add(folder); | 69 | folders.Add(folder); |
69 | } | 70 | } |
70 | } | 71 | } |
71 | 72 | ||
72 | return folders; | 73 | return folders; |
73 | } | 74 | } |
74 | 75 | ||
75 | public List<InventoryItemBase> getInventoryInFolder(UUID folderID) | 76 | public List<InventoryItemBase> getInventoryInFolder(UUID folderID) |
76 | { | 77 | { |
77 | return new List<InventoryItemBase>(); | 78 | return new List<InventoryItemBase>(); |
78 | } | 79 | } |
79 | 80 | ||
80 | public List<InventoryFolderBase> getUserRootFolders(UUID user) { return null; } | 81 | public List<InventoryFolderBase> getUserRootFolders(UUID user) { return null; } |
81 | 82 | ||
82 | public InventoryFolderBase getUserRootFolder(UUID user) | 83 | public InventoryFolderBase getUserRootFolder(UUID user) |
83 | { | 84 | { |
84 | InventoryFolderBase folder = null; | 85 | InventoryFolderBase folder = null; |
85 | m_rootFolders.TryGetValue(user, out folder); | 86 | m_rootFolders.TryGetValue(user, out folder); |
86 | 87 | ||
87 | return folder; | 88 | return folder; |
88 | } | 89 | } |
89 | 90 | ||
90 | public List<InventoryFolderBase> getInventoryFolders(UUID parentID) | 91 | public List<InventoryFolderBase> getInventoryFolders(UUID parentID) |
91 | { | 92 | { |
92 | List<InventoryFolderBase> folders = new List<InventoryFolderBase>(); | 93 | List<InventoryFolderBase> folders = new List<InventoryFolderBase>(); |
93 | 94 | ||
94 | foreach (InventoryFolderBase folder in m_folders.Values) | 95 | foreach (InventoryFolderBase folder in m_folders.Values) |
95 | { | 96 | { |
96 | if (folder.ParentID == parentID) | 97 | if (folder.ParentID == parentID) |
97 | folders.Add(folder); | 98 | folders.Add(folder); |
98 | } | 99 | } |
99 | 100 | ||
100 | return folders; | 101 | return folders; |
101 | } | 102 | } |
102 | 103 | ||
103 | public InventoryItemBase getInventoryItem(UUID item) { return null; } | 104 | public InventoryItemBase getInventoryItem(UUID item) { return null; } |
104 | 105 | ||
105 | public InventoryFolderBase getInventoryFolder(UUID folderId) | 106 | public InventoryFolderBase getInventoryFolder(UUID folderId) |
106 | { | 107 | { |
107 | InventoryFolderBase folder = null; | 108 | InventoryFolderBase folder = null; |
108 | m_folders.TryGetValue(folderId, out folder); | 109 | m_folders.TryGetValue(folderId, out folder); |
109 | 110 | ||
110 | return folder; | 111 | return folder; |
111 | } | 112 | } |
112 | 113 | ||
113 | public void addInventoryItem(InventoryItemBase item) {} | 114 | public void addInventoryItem(InventoryItemBase item) {} |
114 | public void updateInventoryItem(InventoryItemBase item) {} | 115 | public void updateInventoryItem(InventoryItemBase item) {} |
115 | public void deleteInventoryItem(UUID item) {} | 116 | public void deleteInventoryItem(UUID item) {} |
116 | 117 | ||
117 | public void addInventoryFolder(InventoryFolderBase folder) | 118 | public void addInventoryFolder(InventoryFolderBase folder) |
118 | { | 119 | { |
119 | m_folders[folder.ID] = folder; | 120 | m_folders[folder.ID] = folder; |
120 | 121 | ||
121 | if (folder.ParentID == UUID.Zero) | 122 | if (folder.ParentID == UUID.Zero) |
122 | m_rootFolders[folder.Owner] = folder; | 123 | m_rootFolders[folder.Owner] = folder; |
123 | } | 124 | } |
124 | 125 | ||
125 | public void updateInventoryFolder(InventoryFolderBase folder) | 126 | public void updateInventoryFolder(InventoryFolderBase folder) |
126 | { | 127 | { |
127 | m_folders[folder.ID] = folder; | 128 | m_folders[folder.ID] = folder; |
128 | } | 129 | } |
129 | 130 | ||
130 | public void moveInventoryFolder(InventoryFolderBase folder) | 131 | public void moveInventoryFolder(InventoryFolderBase folder) |
131 | { | 132 | { |
132 | // Simple replace | 133 | // Simple replace |
133 | updateInventoryFolder(folder); | 134 | updateInventoryFolder(folder); |
134 | } | 135 | } |
135 | 136 | ||
136 | public void deleteInventoryFolder(UUID folderId) | 137 | public void deleteInventoryFolder(UUID folderId) |
137 | { | 138 | { |
138 | if (m_folders.ContainsKey(folderId)) | 139 | if (m_folders.ContainsKey(folderId)) |
139 | m_folders.Remove(folderId); | 140 | m_folders.Remove(folderId); |
140 | } | 141 | } |
141 | 142 | ||
142 | public List<InventoryItemBase> fetchActiveGestures(UUID avatarID) { return null; } | 143 | public List<InventoryItemBase> fetchActiveGestures(UUID avatarID) { return null; } |
143 | } | 144 | } |
144 | } | 145 | } |