diff options
author | Justin Clark-Casey (justincc) | 2009-09-08 17:42:07 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2009-09-08 17:42:07 +0100 |
commit | b7256f256733f1c7667edc95ec500694bbe35dab (patch) | |
tree | 7be2bc029b9c07672b757f7cc7aeb2ca4453da12 /OpenSim/Region | |
parent | refactor: change method argument name (diff) | |
download | opensim-SC-b7256f256733f1c7667edc95ec500694bbe35dab.zip opensim-SC-b7256f256733f1c7667edc95ec500694bbe35dab.tar.gz opensim-SC-b7256f256733f1c7667edc95ec500694bbe35dab.tar.bz2 opensim-SC-b7256f256733f1c7667edc95ec500694bbe35dab.tar.xz |
extend load iar test to loading into a deeply nested directory
correct bug associated with this
Diffstat (limited to 'OpenSim/Region')
3 files changed, 27 insertions, 10 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index 3250ddf..50c0f93 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs | |||
@@ -233,7 +233,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
233 | string originalArchivePath = archivePath; | 233 | string originalArchivePath = archivePath; |
234 | 234 | ||
235 | m_log.DebugFormat( | 235 | m_log.DebugFormat( |
236 | "[INVENTORY ARCHIVER]: Loading to folder {0 {1}}", rootDestFolder.Name, rootDestFolder.ID); | 236 | "[INVENTORY ARCHIVER]: Loading to folder {0} {1}", rootDestFolder.Name, rootDestFolder.ID); |
237 | 237 | ||
238 | InventoryFolderBase destFolder = null; | 238 | InventoryFolderBase destFolder = null; |
239 | 239 | ||
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs index 2eeb637..5ebf2fa 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs | |||
@@ -106,8 +106,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
106 | if (path == PATH_DELIMITER) | 106 | if (path == PATH_DELIMITER) |
107 | return startFolder; | 107 | return startFolder; |
108 | 108 | ||
109 | InventoryFolderBase foundFolder = null; | ||
110 | |||
111 | string[] components = path.Split(new string[] { PATH_DELIMITER }, 2, StringSplitOptions.None); | 109 | string[] components = path.Split(new string[] { PATH_DELIMITER }, 2, StringSplitOptions.None); |
112 | InventoryCollection contents = inventoryService.GetFolderContent(startFolder.Owner, startFolder.ID); | 110 | InventoryCollection contents = inventoryService.GetFolderContent(startFolder.Owner, startFolder.ID); |
113 | 111 | ||
@@ -116,7 +114,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
116 | if (folder.Name == components[0]) | 114 | if (folder.Name == components[0]) |
117 | { | 115 | { |
118 | if (components.Length > 1) | 116 | if (components.Length > 1) |
119 | return FindFolderByPath(inventoryService, foundFolder, components[1]); | 117 | return FindFolderByPath(inventoryService, folder, components[1]); |
120 | else | 118 | else |
121 | return folder; | 119 | return folder; |
122 | } | 120 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index 5461ea2..384a1f2 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs | |||
@@ -195,7 +195,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
195 | Assert.That(gotObject1File, Is.True, "No item1 file in archive"); | 195 | Assert.That(gotObject1File, Is.True, "No item1 file in archive"); |
196 | // Assert.That(gotObject2File, Is.True, "No object2 file in archive"); | 196 | // Assert.That(gotObject2File, Is.True, "No object2 file in archive"); |
197 | 197 | ||
198 | // TODO: Test presence of more files and contents of files. | 198 | // TODO: Test presence of more files and contents of files. |
199 | } | 199 | } |
200 | 200 | ||
201 | /// <summary> | 201 | /// <summary> |
@@ -257,24 +257,43 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
257 | CachedUserInfo userInfo | 257 | CachedUserInfo userInfo |
258 | = scene.CommsManager.UserProfileCacheService.GetUserDetails(userFirstName, userLastName); | 258 | = scene.CommsManager.UserProfileCacheService.GetUserDetails(userFirstName, userLastName); |
259 | 259 | ||
260 | InventoryItemBase foundItem | 260 | InventoryItemBase foundItem1 |
261 | = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userInfo.UserProfile.ID, itemName); | 261 | = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userInfo.UserProfile.ID, itemName); |
262 | 262 | ||
263 | Assert.That(foundItem, Is.Not.Null, "Didn't find loaded item"); | 263 | Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1"); |
264 | Assert.That( | 264 | Assert.That( |
265 | foundItem.CreatorId, Is.EqualTo(item1.CreatorId), | 265 | foundItem1.CreatorId, Is.EqualTo(item1.CreatorId), |
266 | "Loaded item non-uuid creator doesn't match original"); | 266 | "Loaded item non-uuid creator doesn't match original"); |
267 | Assert.That( | 267 | Assert.That( |
268 | foundItem.CreatorIdAsUuid, Is.EqualTo(userItemCreatorUuid), | 268 | foundItem1.CreatorIdAsUuid, Is.EqualTo(userItemCreatorUuid), |
269 | "Loaded item uuid creator doesn't match original"); | 269 | "Loaded item uuid creator doesn't match original"); |
270 | Assert.That(foundItem.Owner, Is.EqualTo(userUuid), | 270 | Assert.That(foundItem1.Owner, Is.EqualTo(userUuid), |
271 | "Loaded item owner doesn't match inventory reciever"); | 271 | "Loaded item owner doesn't match inventory reciever"); |
272 | |||
273 | // Now try loading to a root child folder | ||
274 | UserInventoryTestUtils.CreateInventoryFolder(scene.InventoryService, userInfo.UserProfile.ID, "xA"); | ||
275 | archiveReadStream = new MemoryStream(archiveReadStream.ToArray()); | ||
276 | archiverModule.DearchiveInventory(userFirstName, userLastName, "xA", archiveReadStream); | ||
277 | |||
278 | InventoryItemBase foundItem2 | ||
279 | = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userInfo.UserProfile.ID, "xA/" + itemName); | ||
280 | Assert.That(foundItem2, Is.Not.Null, "Didn't find loaded item 2"); | ||
281 | |||
282 | // Now try loading to a more deeply nested folder | ||
283 | UserInventoryTestUtils.CreateInventoryFolder(scene.InventoryService, userInfo.UserProfile.ID, "xB/xC"); | ||
284 | archiveReadStream = new MemoryStream(archiveReadStream.ToArray()); | ||
285 | archiverModule.DearchiveInventory(userFirstName, userLastName, "xB/xC", archiveReadStream); | ||
286 | |||
287 | InventoryItemBase foundItem3 | ||
288 | = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userInfo.UserProfile.ID, "xB/xC/" + itemName); | ||
289 | Assert.That(foundItem3, Is.Not.Null, "Didn't find loaded item 3"); | ||
272 | } | 290 | } |
273 | 291 | ||
274 | /// <summary> | 292 | /// <summary> |
275 | /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where | 293 | /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where |
276 | /// no account exists with the creator name | 294 | /// no account exists with the creator name |
277 | /// </summary> | 295 | /// </summary> |
296 | /// Disabled since temporary profiles have not yet been implemented. | ||
278 | //[Test] | 297 | //[Test] |
279 | public void TestLoadIarV0_1TempProfiles() | 298 | public void TestLoadIarV0_1TempProfiles() |
280 | { | 299 | { |