diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/Inventory')
9 files changed, 377 insertions, 377 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index 4a06fd1..3838316 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs | |||
@@ -56,7 +56,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
56 | /// bumps here should be compatible. | 56 | /// bumps here should be compatible. |
57 | /// </summary> | 57 | /// </summary> |
58 | public static int MAX_MAJOR_VERSION = 1; | 58 | public static int MAX_MAJOR_VERSION = 1; |
59 | 59 | ||
60 | protected TarArchiveReader archive; | 60 | protected TarArchiveReader archive; |
61 | 61 | ||
62 | private UserAccount m_userInfo; | 62 | private UserAccount m_userInfo; |
@@ -66,7 +66,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
66 | /// ID of this request | 66 | /// ID of this request |
67 | /// </value> | 67 | /// </value> |
68 | protected UUID m_id; | 68 | protected UUID m_id; |
69 | 69 | ||
70 | /// <summary> | 70 | /// <summary> |
71 | /// Do we want to merge this load with existing inventory? | 71 | /// Do we want to merge this load with existing inventory? |
72 | /// </summary> | 72 | /// </summary> |
@@ -82,41 +82,41 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
82 | /// The stream from which the inventory archive will be loaded. | 82 | /// The stream from which the inventory archive will be loaded. |
83 | /// </value> | 83 | /// </value> |
84 | private Stream m_loadStream; | 84 | private Stream m_loadStream; |
85 | 85 | ||
86 | /// <summary> | 86 | /// <summary> |
87 | /// Has the control file been loaded for this archive? | 87 | /// Has the control file been loaded for this archive? |
88 | /// </summary> | 88 | /// </summary> |
89 | public bool ControlFileLoaded { get; private set; } | 89 | public bool ControlFileLoaded { get; private set; } |
90 | 90 | ||
91 | /// <summary> | 91 | /// <summary> |
92 | /// Do we want to enforce the check. IAR versions before 0.2 and 1.1 do not guarantee this order, so we can't | 92 | /// Do we want to enforce the check. IAR versions before 0.2 and 1.1 do not guarantee this order, so we can't |
93 | /// enforce. | 93 | /// enforce. |
94 | /// </summary> | 94 | /// </summary> |
95 | public bool EnforceControlFileCheck { get; private set; } | 95 | public bool EnforceControlFileCheck { get; private set; } |
96 | 96 | ||
97 | protected bool m_assetsLoaded; | 97 | protected bool m_assetsLoaded; |
98 | protected bool m_inventoryNodesLoaded; | 98 | protected bool m_inventoryNodesLoaded; |
99 | 99 | ||
100 | protected int m_successfulAssetRestores; | 100 | protected int m_successfulAssetRestores; |
101 | protected int m_failedAssetRestores; | 101 | protected int m_failedAssetRestores; |
102 | protected int m_successfulItemRestores; | 102 | protected int m_successfulItemRestores; |
103 | 103 | ||
104 | /// <summary> | 104 | /// <summary> |
105 | /// Root destination folder for the IAR load. | 105 | /// Root destination folder for the IAR load. |
106 | /// </summary> | 106 | /// </summary> |
107 | protected InventoryFolderBase m_rootDestinationFolder; | 107 | protected InventoryFolderBase m_rootDestinationFolder; |
108 | 108 | ||
109 | /// <summary> | 109 | /// <summary> |
110 | /// Inventory nodes loaded from the iar. | 110 | /// Inventory nodes loaded from the iar. |
111 | /// </summary> | 111 | /// </summary> |
112 | protected HashSet<InventoryNodeBase> m_loadedNodes = new HashSet<InventoryNodeBase>(); | 112 | protected HashSet<InventoryNodeBase> m_loadedNodes = new HashSet<InventoryNodeBase>(); |
113 | 113 | ||
114 | /// <summary> | 114 | /// <summary> |
115 | /// In order to load identically named folders, we need to keep track of the folders that we have already | 115 | /// In order to load identically named folders, we need to keep track of the folders that we have already |
116 | /// resolved. | 116 | /// resolved. |
117 | /// </summary> | 117 | /// </summary> |
118 | Dictionary <string, InventoryFolderBase> m_resolvedFolders = new Dictionary<string, InventoryFolderBase>(); | 118 | Dictionary <string, InventoryFolderBase> m_resolvedFolders = new Dictionary<string, InventoryFolderBase>(); |
119 | 119 | ||
120 | /// <summary> | 120 | /// <summary> |
121 | /// Record the creator id that should be associated with an asset. This is used to adjust asset creator ids | 121 | /// Record the creator id that should be associated with an asset. This is used to adjust asset creator ids |
122 | /// after OSP resolution (since OSP creators are only stored in the item | 122 | /// after OSP resolution (since OSP creators are only stored in the item |
@@ -163,9 +163,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
163 | m_invPath = invPath; | 163 | m_invPath = invPath; |
164 | m_loadStream = loadStream; | 164 | m_loadStream = loadStream; |
165 | m_module = module; | 165 | m_module = module; |
166 | 166 | ||
167 | // FIXME: Do not perform this check since older versions of OpenSim do save the control file after other things | 167 | // FIXME: Do not perform this check since older versions of OpenSim do save the control file after other things |
168 | // (I thought they weren't). We will need to bump the version number and perform this check on all | 168 | // (I thought they weren't). We will need to bump the version number and perform this check on all |
169 | // subsequent IAR versions only | 169 | // subsequent IAR versions only |
170 | ControlFileLoaded = true; | 170 | ControlFileLoaded = true; |
171 | } | 171 | } |
@@ -188,19 +188,19 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
188 | Exception reportedException = null; | 188 | Exception reportedException = null; |
189 | 189 | ||
190 | string filePath = "ERROR"; | 190 | string filePath = "ERROR"; |
191 | 191 | ||
192 | List<InventoryFolderBase> folderCandidates | 192 | List<InventoryFolderBase> folderCandidates |
193 | = InventoryArchiveUtils.FindFoldersByPath( | 193 | = InventoryArchiveUtils.FindFoldersByPath( |
194 | m_InventoryService, m_userInfo.PrincipalID, m_invPath); | 194 | m_InventoryService, m_userInfo.PrincipalID, m_invPath); |
195 | 195 | ||
196 | if (folderCandidates.Count == 0) | 196 | if (folderCandidates.Count == 0) |
197 | { | 197 | { |
198 | // Possibly provide an option later on to automatically create this folder if it does not exist | 198 | // Possibly provide an option later on to automatically create this folder if it does not exist |
199 | m_log.ErrorFormat("[INVENTORY ARCHIVER]: Inventory path {0} does not exist", m_invPath); | 199 | m_log.ErrorFormat("[INVENTORY ARCHIVER]: Inventory path {0} does not exist", m_invPath); |
200 | 200 | ||
201 | return m_loadedNodes; | 201 | return m_loadedNodes; |
202 | } | 202 | } |
203 | 203 | ||
204 | m_rootDestinationFolder = folderCandidates[0]; | 204 | m_rootDestinationFolder = folderCandidates[0]; |
205 | archive = new TarArchiveReader(m_loadStream); | 205 | archive = new TarArchiveReader(m_loadStream); |
206 | byte[] data; | 206 | byte[] data; |
@@ -211,7 +211,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
211 | if (filePath == ArchiveConstants.CONTROL_FILE_PATH) | 211 | if (filePath == ArchiveConstants.CONTROL_FILE_PATH) |
212 | { | 212 | { |
213 | LoadControlFile(filePath, data); | 213 | LoadControlFile(filePath, data); |
214 | } | 214 | } |
215 | else if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH)) | 215 | else if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH)) |
216 | { | 216 | { |
217 | LoadAssetFile(filePath, data); | 217 | LoadAssetFile(filePath, data); |
@@ -221,17 +221,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
221 | LoadInventoryFile(filePath, entryType, data); | 221 | LoadInventoryFile(filePath, entryType, data); |
222 | } | 222 | } |
223 | } | 223 | } |
224 | 224 | ||
225 | archive.Close(); | 225 | archive.Close(); |
226 | 226 | ||
227 | m_log.DebugFormat( | 227 | m_log.DebugFormat( |
228 | "[INVENTORY ARCHIVER]: Successfully loaded {0} assets with {1} failures", | 228 | "[INVENTORY ARCHIVER]: Successfully loaded {0} assets with {1} failures", |
229 | m_successfulAssetRestores, m_failedAssetRestores); | 229 | m_successfulAssetRestores, m_failedAssetRestores); |
230 | 230 | ||
231 | //Alicia: When this is called by LibraryModule or Tests, m_module will be null as event is not required | 231 | //Alicia: When this is called by LibraryModule or Tests, m_module will be null as event is not required |
232 | if(m_module != null) | 232 | if(m_module != null) |
233 | m_module.TriggerInventoryArchiveLoaded(m_id, true, m_userInfo, m_invPath, m_loadStream, reportedException, m_successfulItemRestores); | 233 | m_module.TriggerInventoryArchiveLoaded(m_id, true, m_userInfo, m_invPath, m_loadStream, reportedException, m_successfulItemRestores); |
234 | 234 | ||
235 | return m_loadedNodes; | 235 | return m_loadedNodes; |
236 | } | 236 | } |
237 | catch(Exception Ex) | 237 | catch(Exception Ex) |
@@ -268,8 +268,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
268 | /// </param> | 268 | /// </param> |
269 | /// <returns>The last user inventory folder created or found for the archive path</returns> | 269 | /// <returns>The last user inventory folder created or found for the archive path</returns> |
270 | public InventoryFolderBase ReplicateArchivePathToUserInventory( | 270 | public InventoryFolderBase ReplicateArchivePathToUserInventory( |
271 | string iarPath, | 271 | string iarPath, |
272 | InventoryFolderBase rootDestFolder, | 272 | InventoryFolderBase rootDestFolder, |
273 | Dictionary <string, InventoryFolderBase> resolvedFolders, | 273 | Dictionary <string, InventoryFolderBase> resolvedFolders, |
274 | HashSet<InventoryNodeBase> loadedNodes) | 274 | HashSet<InventoryNodeBase> loadedNodes) |
275 | { | 275 | { |
@@ -277,27 +277,27 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
277 | 277 | ||
278 | // m_log.DebugFormat( | 278 | // m_log.DebugFormat( |
279 | // "[INVENTORY ARCHIVER]: Loading folder {0} {1}", rootDestFolder.Name, rootDestFolder.ID); | 279 | // "[INVENTORY ARCHIVER]: Loading folder {0} {1}", rootDestFolder.Name, rootDestFolder.ID); |
280 | 280 | ||
281 | InventoryFolderBase destFolder | 281 | InventoryFolderBase destFolder |
282 | = ResolveDestinationFolder(rootDestFolder, ref iarPathExisting, resolvedFolders); | 282 | = ResolveDestinationFolder(rootDestFolder, ref iarPathExisting, resolvedFolders); |
283 | 283 | ||
284 | // m_log.DebugFormat( | 284 | // m_log.DebugFormat( |
285 | // "[INVENTORY ARCHIVER]: originalArchivePath [{0}], section already loaded [{1}]", | 285 | // "[INVENTORY ARCHIVER]: originalArchivePath [{0}], section already loaded [{1}]", |
286 | // iarPath, iarPathExisting); | 286 | // iarPath, iarPathExisting); |
287 | 287 | ||
288 | string iarPathToCreate = iarPath.Substring(iarPathExisting.Length); | 288 | string iarPathToCreate = iarPath.Substring(iarPathExisting.Length); |
289 | CreateFoldersForPath(destFolder, iarPathExisting, iarPathToCreate, resolvedFolders, loadedNodes); | 289 | CreateFoldersForPath(destFolder, iarPathExisting, iarPathToCreate, resolvedFolders, loadedNodes); |
290 | 290 | ||
291 | return destFolder; | 291 | return destFolder; |
292 | } | 292 | } |
293 | 293 | ||
294 | /// <summary> | 294 | /// <summary> |
295 | /// Resolve a destination folder | 295 | /// Resolve a destination folder |
296 | /// </summary> | 296 | /// </summary> |
297 | /// | 297 | /// |
298 | /// We require here a root destination folder (usually the root of the user's inventory) and the archive | 298 | /// We require here a root destination folder (usually the root of the user's inventory) and the archive |
299 | /// path. We also pass in a list of previously resolved folders in case we've found this one previously. | 299 | /// path. We also pass in a list of previously resolved folders in case we've found this one previously. |
300 | /// | 300 | /// |
301 | /// <param name="archivePath"> | 301 | /// <param name="archivePath"> |
302 | /// The item archive path to resolve. The portion of the path passed back is that | 302 | /// The item archive path to resolve. The portion of the path passed back is that |
303 | /// which corresponds to the resolved desintation folder. | 303 | /// which corresponds to the resolved desintation folder. |
@@ -321,7 +321,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
321 | while (archivePath.Length > 0) | 321 | while (archivePath.Length > 0) |
322 | { | 322 | { |
323 | // m_log.DebugFormat("[INVENTORY ARCHIVER]: Trying to resolve destination folder {0}", archivePath); | 323 | // m_log.DebugFormat("[INVENTORY ARCHIVER]: Trying to resolve destination folder {0}", archivePath); |
324 | 324 | ||
325 | if (resolvedFolders.ContainsKey(archivePath)) | 325 | if (resolvedFolders.ContainsKey(archivePath)) |
326 | { | 326 | { |
327 | // m_log.DebugFormat( | 327 | // m_log.DebugFormat( |
@@ -332,13 +332,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
332 | { | 332 | { |
333 | if (m_merge) | 333 | if (m_merge) |
334 | { | 334 | { |
335 | // TODO: Using m_invPath is totally wrong - what we need to do is strip the uuid from the | 335 | // TODO: Using m_invPath is totally wrong - what we need to do is strip the uuid from the |
336 | // iar name and try to find that instead. | 336 | // iar name and try to find that instead. |
337 | string plainPath = ArchiveConstants.ExtractPlainPathFromIarPath(archivePath); | 337 | string plainPath = ArchiveConstants.ExtractPlainPathFromIarPath(archivePath); |
338 | List<InventoryFolderBase> folderCandidates | 338 | List<InventoryFolderBase> folderCandidates |
339 | = InventoryArchiveUtils.FindFoldersByPath( | 339 | = InventoryArchiveUtils.FindFoldersByPath( |
340 | m_InventoryService, m_userInfo.PrincipalID, plainPath); | 340 | m_InventoryService, m_userInfo.PrincipalID, plainPath); |
341 | 341 | ||
342 | if (folderCandidates.Count != 0) | 342 | if (folderCandidates.Count != 0) |
343 | { | 343 | { |
344 | InventoryFolderBase destFolder = folderCandidates[0]; | 344 | InventoryFolderBase destFolder = folderCandidates[0]; |
@@ -346,7 +346,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
346 | return destFolder; | 346 | return destFolder; |
347 | } | 347 | } |
348 | } | 348 | } |
349 | 349 | ||
350 | // Don't include the last slash so find the penultimate one | 350 | // Don't include the last slash so find the penultimate one |
351 | int penultimateSlashIndex = archivePath.LastIndexOf("/", archivePath.Length - 2); | 351 | int penultimateSlashIndex = archivePath.LastIndexOf("/", archivePath.Length - 2); |
352 | 352 | ||
@@ -365,10 +365,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
365 | } | 365 | } |
366 | } | 366 | } |
367 | } | 367 | } |
368 | 368 | ||
369 | return rootDestFolder; | 369 | return rootDestFolder; |
370 | } | 370 | } |
371 | 371 | ||
372 | /// <summary> | 372 | /// <summary> |
373 | /// Create a set of folders for the given path. | 373 | /// Create a set of folders for the given path. |
374 | /// </summary> | 374 | /// </summary> |
@@ -388,10 +388,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
388 | /// Track the inventory nodes created. | 388 | /// Track the inventory nodes created. |
389 | /// </param> | 389 | /// </param> |
390 | protected void CreateFoldersForPath( | 390 | protected void CreateFoldersForPath( |
391 | InventoryFolderBase destFolder, | 391 | InventoryFolderBase destFolder, |
392 | string iarPathExisting, | 392 | string iarPathExisting, |
393 | string iarPathToReplicate, | 393 | string iarPathToReplicate, |
394 | Dictionary <string, InventoryFolderBase> resolvedFolders, | 394 | Dictionary <string, InventoryFolderBase> resolvedFolders, |
395 | HashSet<InventoryNodeBase> loadedNodes) | 395 | HashSet<InventoryNodeBase> loadedNodes) |
396 | { | 396 | { |
397 | string[] rawDirsToCreate = iarPathToReplicate.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries); | 397 | string[] rawDirsToCreate = iarPathToReplicate.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries); |
@@ -402,7 +402,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
402 | 402 | ||
403 | if (!rawDirsToCreate[i].Contains(ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR)) | 403 | if (!rawDirsToCreate[i].Contains(ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR)) |
404 | continue; | 404 | continue; |
405 | 405 | ||
406 | int identicalNameIdentifierIndex | 406 | int identicalNameIdentifierIndex |
407 | = rawDirsToCreate[i].LastIndexOf( | 407 | = rawDirsToCreate[i].LastIndexOf( |
408 | ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR); | 408 | ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR); |
@@ -412,7 +412,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
412 | newFolderName = InventoryArchiveUtils.UnescapeArchivePath(newFolderName); | 412 | newFolderName = InventoryArchiveUtils.UnescapeArchivePath(newFolderName); |
413 | UUID newFolderId = UUID.Random(); | 413 | UUID newFolderId = UUID.Random(); |
414 | 414 | ||
415 | destFolder | 415 | destFolder |
416 | = new InventoryFolderBase( | 416 | = new InventoryFolderBase( |
417 | newFolderId, newFolderName, m_userInfo.PrincipalID, | 417 | newFolderId, newFolderName, m_userInfo.PrincipalID, |
418 | (short)FolderType.None, destFolder.ID, 1); | 418 | (short)FolderType.None, destFolder.ID, 1); |
@@ -427,7 +427,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
427 | loadedNodes.Add(destFolder); | 427 | loadedNodes.Add(destFolder); |
428 | } | 428 | } |
429 | } | 429 | } |
430 | 430 | ||
431 | /// <summary> | 431 | /// <summary> |
432 | /// Load an item from the archive | 432 | /// Load an item from the archive |
433 | /// </summary> | 433 | /// </summary> |
@@ -438,7 +438,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
438 | protected InventoryItemBase LoadItem(byte[] data, InventoryFolderBase loadFolder) | 438 | protected InventoryItemBase LoadItem(byte[] data, InventoryFolderBase loadFolder) |
439 | { | 439 | { |
440 | InventoryItemBase item = UserInventoryItemSerializer.Deserialize(data); | 440 | InventoryItemBase item = UserInventoryItemSerializer.Deserialize(data); |
441 | 441 | ||
442 | // Don't use the item ID that's in the file | 442 | // Don't use the item ID that's in the file |
443 | item.ID = UUID.Random(); | 443 | item.ID = UUID.Random(); |
444 | 444 | ||
@@ -446,7 +446,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
446 | if (UUID.Zero != ospResolvedId) // The user exists in this grid | 446 | if (UUID.Zero != ospResolvedId) // The user exists in this grid |
447 | { | 447 | { |
448 | // m_log.DebugFormat("[INVENTORY ARCHIVER]: Found creator {0} via OSPA resolution", ospResolvedId); | 448 | // m_log.DebugFormat("[INVENTORY ARCHIVER]: Found creator {0} via OSPA resolution", ospResolvedId); |
449 | 449 | ||
450 | // item.CreatorIdAsUuid = ospResolvedId; | 450 | // item.CreatorIdAsUuid = ospResolvedId; |
451 | 451 | ||
452 | // Don't preserve the OSPA in the creator id (which actually gets persisted to the | 452 | // Don't preserve the OSPA in the creator id (which actually gets persisted to the |
@@ -474,7 +474,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
474 | 474 | ||
475 | if (!m_InventoryService.AddItem(item)) | 475 | if (!m_InventoryService.AddItem(item)) |
476 | m_log.WarnFormat("[INVENTORY ARCHIVER]: Unable to save item {0} in folder {1}", item.Name, item.Folder); | 476 | m_log.WarnFormat("[INVENTORY ARCHIVER]: Unable to save item {0} in folder {1}", item.Name, item.Folder); |
477 | 477 | ||
478 | return item; | 478 | return item; |
479 | } | 479 | } |
480 | 480 | ||
@@ -519,7 +519,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
519 | data = SceneObjectSerializer.ModifySerializedObject(assetId, data, | 519 | data = SceneObjectSerializer.ModifySerializedObject(assetId, data, |
520 | sog => { | 520 | sog => { |
521 | bool modified = false; | 521 | bool modified = false; |
522 | 522 | ||
523 | foreach (SceneObjectPart sop in sog.Parts) | 523 | foreach (SceneObjectPart sop in sog.Parts) |
524 | { | 524 | { |
525 | if (string.IsNullOrEmpty(sop.CreatorData)) | 525 | if (string.IsNullOrEmpty(sop.CreatorData)) |
@@ -528,10 +528,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
528 | modified = true; | 528 | modified = true; |
529 | } | 529 | } |
530 | } | 530 | } |
531 | 531 | ||
532 | return modified; | 532 | return modified; |
533 | }); | 533 | }); |
534 | 534 | ||
535 | if (data == null) | 535 | if (data == null) |
536 | return false; | 536 | return false; |
537 | } | 537 | } |
@@ -568,7 +568,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
568 | int majorVersion = int.Parse(archiveElement.Attribute("major_version").Value); | 568 | int majorVersion = int.Parse(archiveElement.Attribute("major_version").Value); |
569 | int minorVersion = int.Parse(archiveElement.Attribute("minor_version").Value); | 569 | int minorVersion = int.Parse(archiveElement.Attribute("minor_version").Value); |
570 | string version = string.Format("{0}.{1}", majorVersion, minorVersion); | 570 | string version = string.Format("{0}.{1}", majorVersion, minorVersion); |
571 | 571 | ||
572 | if (majorVersion > MAX_MAJOR_VERSION) | 572 | if (majorVersion > MAX_MAJOR_VERSION) |
573 | { | 573 | { |
574 | throw new Exception( | 574 | throw new Exception( |
@@ -576,38 +576,38 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
576 | "The IAR you are trying to load has major version number of {0} but this version of OpenSim can only load IARs with major version number {1} and below", | 576 | "The IAR you are trying to load has major version number of {0} but this version of OpenSim can only load IARs with major version number {1} and below", |
577 | majorVersion, MAX_MAJOR_VERSION)); | 577 | majorVersion, MAX_MAJOR_VERSION)); |
578 | } | 578 | } |
579 | 579 | ||
580 | ControlFileLoaded = true; | 580 | ControlFileLoaded = true; |
581 | m_log.InfoFormat("[INVENTORY ARCHIVER]: Loading IAR with version {0}", version); | 581 | m_log.InfoFormat("[INVENTORY ARCHIVER]: Loading IAR with version {0}", version); |
582 | } | 582 | } |
583 | 583 | ||
584 | /// <summary> | 584 | /// <summary> |
585 | /// Load inventory file | 585 | /// Load inventory file |
586 | /// </summary> | 586 | /// </summary> |
587 | /// <param name="path"></param> | 587 | /// <param name="path"></param> |
588 | /// <param name="entryType"></param> | 588 | /// <param name="entryType"></param> |
589 | /// <param name="data"></param> | 589 | /// <param name="data"></param> |
590 | protected void LoadInventoryFile(string path, TarArchiveReader.TarEntryType entryType, byte[] data) | 590 | protected void LoadInventoryFile(string path, TarArchiveReader.TarEntryType entryType, byte[] data) |
591 | { | 591 | { |
592 | if (!ControlFileLoaded) | 592 | if (!ControlFileLoaded) |
593 | throw new Exception( | 593 | throw new Exception( |
594 | string.Format( | 594 | string.Format( |
595 | "The IAR you are trying to load does not list {0} before {1}. Aborting load", | 595 | "The IAR you are trying to load does not list {0} before {1}. Aborting load", |
596 | ArchiveConstants.CONTROL_FILE_PATH, ArchiveConstants.INVENTORY_PATH)); | 596 | ArchiveConstants.CONTROL_FILE_PATH, ArchiveConstants.INVENTORY_PATH)); |
597 | 597 | ||
598 | if (m_assetsLoaded) | 598 | if (m_assetsLoaded) |
599 | throw new Exception( | 599 | throw new Exception( |
600 | string.Format( | 600 | string.Format( |
601 | "The IAR you are trying to load does not list all {0} before {1}. Aborting load", | 601 | "The IAR you are trying to load does not list all {0} before {1}. Aborting load", |
602 | ArchiveConstants.INVENTORY_PATH, ArchiveConstants.ASSETS_PATH)); | 602 | ArchiveConstants.INVENTORY_PATH, ArchiveConstants.ASSETS_PATH)); |
603 | 603 | ||
604 | path = path.Substring(ArchiveConstants.INVENTORY_PATH.Length); | 604 | path = path.Substring(ArchiveConstants.INVENTORY_PATH.Length); |
605 | 605 | ||
606 | // Trim off the file portion if we aren't already dealing with a directory path | 606 | // Trim off the file portion if we aren't already dealing with a directory path |
607 | if (TarArchiveReader.TarEntryType.TYPE_DIRECTORY != entryType) | 607 | if (TarArchiveReader.TarEntryType.TYPE_DIRECTORY != entryType) |
608 | path = path.Remove(path.LastIndexOf("/") + 1); | 608 | path = path.Remove(path.LastIndexOf("/") + 1); |
609 | 609 | ||
610 | InventoryFolderBase foundFolder | 610 | InventoryFolderBase foundFolder |
611 | = ReplicateArchivePathToUserInventory( | 611 | = ReplicateArchivePathToUserInventory( |
612 | path, m_rootDestinationFolder, m_resolvedFolders, m_loadedNodes); | 612 | path, m_rootDestinationFolder, m_resolvedFolders, m_loadedNodes); |
613 | 613 | ||
@@ -618,17 +618,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
618 | if (item != null) | 618 | if (item != null) |
619 | { | 619 | { |
620 | m_successfulItemRestores++; | 620 | m_successfulItemRestores++; |
621 | 621 | ||
622 | // If we aren't loading the folder containing the item then well need to update the | 622 | // If we aren't loading the folder containing the item then well need to update the |
623 | // viewer separately for that item. | 623 | // viewer separately for that item. |
624 | if (!m_loadedNodes.Contains(foundFolder)) | 624 | if (!m_loadedNodes.Contains(foundFolder)) |
625 | m_loadedNodes.Add(item); | 625 | m_loadedNodes.Add(item); |
626 | } | 626 | } |
627 | } | 627 | } |
628 | 628 | ||
629 | m_inventoryNodesLoaded = true; | 629 | m_inventoryNodesLoaded = true; |
630 | } | 630 | } |
631 | 631 | ||
632 | /// <summary> | 632 | /// <summary> |
633 | /// Load asset file | 633 | /// Load asset file |
634 | /// </summary> | 634 | /// </summary> |
@@ -639,15 +639,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
639 | if (!ControlFileLoaded) | 639 | if (!ControlFileLoaded) |
640 | throw new Exception( | 640 | throw new Exception( |
641 | string.Format( | 641 | string.Format( |
642 | "The IAR you are trying to load does not list {0} before {1}. Aborting load", | 642 | "The IAR you are trying to load does not list {0} before {1}. Aborting load", |
643 | ArchiveConstants.CONTROL_FILE_PATH, ArchiveConstants.ASSETS_PATH)); | 643 | ArchiveConstants.CONTROL_FILE_PATH, ArchiveConstants.ASSETS_PATH)); |
644 | 644 | ||
645 | if (!m_inventoryNodesLoaded) | 645 | if (!m_inventoryNodesLoaded) |
646 | throw new Exception( | 646 | throw new Exception( |
647 | string.Format( | 647 | string.Format( |
648 | "The IAR you are trying to load does not list all {0} before {1}. Aborting load", | 648 | "The IAR you are trying to load does not list all {0} before {1}. Aborting load", |
649 | ArchiveConstants.INVENTORY_PATH, ArchiveConstants.ASSETS_PATH)); | 649 | ArchiveConstants.INVENTORY_PATH, ArchiveConstants.ASSETS_PATH)); |
650 | 650 | ||
651 | if (LoadAsset(path, data)) | 651 | if (LoadAsset(path, data)) |
652 | m_successfulAssetRestores++; | 652 | m_successfulAssetRestores++; |
653 | else | 653 | else |
@@ -655,10 +655,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
655 | 655 | ||
656 | if ((m_successfulAssetRestores) % 50 == 0) | 656 | if ((m_successfulAssetRestores) % 50 == 0) |
657 | m_log.DebugFormat( | 657 | m_log.DebugFormat( |
658 | "[INVENTORY ARCHIVER]: Loaded {0} assets...", | 658 | "[INVENTORY ARCHIVER]: Loaded {0} assets...", |
659 | m_successfulAssetRestores); | 659 | m_successfulAssetRestores); |
660 | 660 | ||
661 | m_assetsLoaded = true; | 661 | m_assetsLoaded = true; |
662 | } | 662 | } |
663 | } | 663 | } |
664 | } | 664 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs index dbaf2aa..b66aad5 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs | |||
@@ -69,7 +69,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
69 | /// The path to the required folder. | 69 | /// The path to the required folder. |
70 | /// It this is empty or consists only of the PATH_DELIMTER then this folder itself is returned. | 70 | /// It this is empty or consists only of the PATH_DELIMTER then this folder itself is returned. |
71 | /// </param> | 71 | /// </param> |
72 | /// <returns>The folder found. Please note that if there are multiple folders with the same name then an | 72 | /// <returns>The folder found. Please note that if there are multiple folders with the same name then an |
73 | /// unspecified one will be returned. If no such folder eixsts then null is returned</returns> | 73 | /// unspecified one will be returned. If no such folder eixsts then null is returned</returns> |
74 | public static InventoryFolderBase FindFolderByPath( | 74 | public static InventoryFolderBase FindFolderByPath( |
75 | IInventoryService inventoryService, UUID userId, string path) | 75 | IInventoryService inventoryService, UUID userId, string path) |
@@ -102,7 +102,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
102 | /// The path to the required folder. | 102 | /// The path to the required folder. |
103 | /// It this is empty or consists only of the PATH_DELIMTER then this folder itself is returned. | 103 | /// It this is empty or consists only of the PATH_DELIMTER then this folder itself is returned. |
104 | /// </param> | 104 | /// </param> |
105 | /// <returns>The folder found. Please note that if there are multiple folders with the same name then an | 105 | /// <returns>The folder found. Please note that if there are multiple folders with the same name then an |
106 | /// unspecified one will be returned. If no such folder eixsts then null is returned</returns> | 106 | /// unspecified one will be returned. If no such folder eixsts then null is returned</returns> |
107 | public static InventoryFolderBase FindFolderByPath( | 107 | public static InventoryFolderBase FindFolderByPath( |
108 | IInventoryService inventoryService, InventoryFolderBase startFolder, string path) | 108 | IInventoryService inventoryService, InventoryFolderBase startFolder, string path) |
@@ -149,7 +149,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
149 | 149 | ||
150 | return FindFoldersByPath(inventoryService, rootFolder, path); | 150 | return FindFoldersByPath(inventoryService, rootFolder, path); |
151 | } | 151 | } |
152 | 152 | ||
153 | /// <summary> | 153 | /// <summary> |
154 | /// Find a set of folders given a PATH_DELIMITER delimited path starting from this folder | 154 | /// Find a set of folders given a PATH_DELIMITER delimited path starting from this folder |
155 | /// </summary> | 155 | /// </summary> |
@@ -175,7 +175,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
175 | IInventoryService inventoryService, InventoryFolderBase startFolder, string path) | 175 | IInventoryService inventoryService, InventoryFolderBase startFolder, string path) |
176 | { | 176 | { |
177 | List<InventoryFolderBase> foundFolders = new List<InventoryFolderBase>(); | 177 | List<InventoryFolderBase> foundFolders = new List<InventoryFolderBase>(); |
178 | 178 | ||
179 | if (path == string.Empty) | 179 | if (path == string.Empty) |
180 | { | 180 | { |
181 | foundFolders.Add(startFolder); | 181 | foundFolders.Add(startFolder); |
@@ -189,17 +189,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
189 | foundFolders.Add(startFolder); | 189 | foundFolders.Add(startFolder); |
190 | return foundFolders; | 190 | return foundFolders; |
191 | } | 191 | } |
192 | 192 | ||
193 | // If the path isn't just / then trim any starting extraneous slashes | 193 | // If the path isn't just / then trim any starting extraneous slashes |
194 | path = path.TrimStart(new char[] { PATH_DELIMITER }); | 194 | path = path.TrimStart(new char[] { PATH_DELIMITER }); |
195 | 195 | ||
196 | // m_log.DebugFormat("[INVENTORY ARCHIVE UTILS]: Adjusted path in FindFolderByPath() is [{0}]", path); | 196 | // m_log.DebugFormat("[INVENTORY ARCHIVE UTILS]: Adjusted path in FindFolderByPath() is [{0}]", path); |
197 | 197 | ||
198 | string[] components = SplitEscapedPath(path); | 198 | string[] components = SplitEscapedPath(path); |
199 | components[0] = UnescapePath(components[0]); | 199 | components[0] = UnescapePath(components[0]); |
200 | 200 | ||
201 | //string[] components = path.Split(new string[] { PATH_DELIMITER.ToString() }, 2, StringSplitOptions.None); | 201 | //string[] components = path.Split(new string[] { PATH_DELIMITER.ToString() }, 2, StringSplitOptions.None); |
202 | 202 | ||
203 | InventoryCollection contents = inventoryService.GetFolderContent(startFolder.Owner, startFolder.ID); | 203 | InventoryCollection contents = inventoryService.GetFolderContent(startFolder.Owner, startFolder.ID); |
204 | 204 | ||
205 | // m_log.DebugFormat( | 205 | // m_log.DebugFormat( |
@@ -230,7 +230,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
230 | /// | 230 | /// |
231 | /// FIXME: Delimitors which occur in names themselves are not currently escapable. | 231 | /// FIXME: Delimitors which occur in names themselves are not currently escapable. |
232 | /// </remarks> | 232 | /// </remarks> |
233 | /// | 233 | /// |
234 | /// <param name="inventoryService"> | 234 | /// <param name="inventoryService"> |
235 | /// Inventory service to query | 235 | /// Inventory service to query |
236 | /// </param> | 236 | /// </param> |
@@ -301,7 +301,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
301 | /// | 301 | /// |
302 | /// FIXME: Delimitors which occur in names themselves are not currently escapable. | 302 | /// FIXME: Delimitors which occur in names themselves are not currently escapable. |
303 | /// </remarks> | 303 | /// </remarks> |
304 | /// | 304 | /// |
305 | /// <param name="inventoryService">Inventory service to query</param> | 305 | /// <param name="inventoryService">Inventory service to query</param> |
306 | /// <param name="startFolder">The folder from which the path starts</param> | 306 | /// <param name="startFolder">The folder from which the path starts</param> |
307 | /// <param name="path">The path to the required item.</param> | 307 | /// <param name="path">The path to the required item.</param> |
@@ -313,10 +313,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
313 | 313 | ||
314 | // If the path isn't just / then trim any starting extraneous slashes | 314 | // If the path isn't just / then trim any starting extraneous slashes |
315 | path = path.TrimStart(new char[] { PATH_DELIMITER }); | 315 | path = path.TrimStart(new char[] { PATH_DELIMITER }); |
316 | 316 | ||
317 | string[] components = SplitEscapedPath(path); | 317 | string[] components = SplitEscapedPath(path); |
318 | components[0] = UnescapePath(components[0]); | 318 | components[0] = UnescapePath(components[0]); |
319 | 319 | ||
320 | //string[] components = path.Split(new string[] { PATH_DELIMITER }, 2, StringSplitOptions.None); | 320 | //string[] components = path.Split(new string[] { PATH_DELIMITER }, 2, StringSplitOptions.None); |
321 | 321 | ||
322 | if (components.Length == 1) | 322 | if (components.Length == 1) |
@@ -324,15 +324,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
324 | // m_log.DebugFormat( | 324 | // m_log.DebugFormat( |
325 | // "FOUND SINGLE COMPONENT [{0}]. Looking for this in [{1}] {2}", | 325 | // "FOUND SINGLE COMPONENT [{0}]. Looking for this in [{1}] {2}", |
326 | // components[0], startFolder.Name, startFolder.ID); | 326 | // components[0], startFolder.Name, startFolder.ID); |
327 | 327 | ||
328 | List<InventoryItemBase> items = inventoryService.GetFolderItems(startFolder.Owner, startFolder.ID); | 328 | List<InventoryItemBase> items = inventoryService.GetFolderItems(startFolder.Owner, startFolder.ID); |
329 | 329 | ||
330 | // m_log.DebugFormat("[INVENTORY ARCHIVE UTILS]: Found {0} items in FindItemByPath()", items.Count); | 330 | // m_log.DebugFormat("[INVENTORY ARCHIVE UTILS]: Found {0} items in FindItemByPath()", items.Count); |
331 | 331 | ||
332 | foreach (InventoryItemBase item in items) | 332 | foreach (InventoryItemBase item in items) |
333 | { | 333 | { |
334 | // m_log.DebugFormat("[INVENTORY ARCHIVE UTILS]: Inspecting item {0} {1}", item.Name, item.ID); | 334 | // m_log.DebugFormat("[INVENTORY ARCHIVE UTILS]: Inspecting item {0} {1}", item.Name, item.ID); |
335 | 335 | ||
336 | if (item.Name == components[0]) | 336 | if (item.Name == components[0]) |
337 | foundItems.Add(item); | 337 | foundItems.Add(item); |
338 | } | 338 | } |
@@ -342,7 +342,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
342 | // m_log.DebugFormat("FOUND COMPONENTS [{0}] and [{1}]", components[0], components[1]); | 342 | // m_log.DebugFormat("FOUND COMPONENTS [{0}] and [{1}]", components[0], components[1]); |
343 | 343 | ||
344 | InventoryCollection contents = inventoryService.GetFolderContent(startFolder.Owner, startFolder.ID); | 344 | InventoryCollection contents = inventoryService.GetFolderContent(startFolder.Owner, startFolder.ID); |
345 | 345 | ||
346 | foreach (InventoryFolderBase folder in contents.Folders) | 346 | foreach (InventoryFolderBase folder in contents.Folders) |
347 | { | 347 | { |
348 | if (folder.Name == components[0]) | 348 | if (folder.Name == components[0]) |
@@ -365,9 +365,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
365 | public static string[] SplitEscapedPath(string path) | 365 | public static string[] SplitEscapedPath(string path) |
366 | { | 366 | { |
367 | // m_log.DebugFormat("SPLITTING PATH {0}", path); | 367 | // m_log.DebugFormat("SPLITTING PATH {0}", path); |
368 | 368 | ||
369 | bool singleEscapeChar = false; | 369 | bool singleEscapeChar = false; |
370 | 370 | ||
371 | for (int i = 0; i < path.Length; i++) | 371 | for (int i = 0; i < path.Length; i++) |
372 | { | 372 | { |
373 | if (path[i] == ESCAPE_CHARACTER && !singleEscapeChar) | 373 | if (path[i] == ESCAPE_CHARACTER && !singleEscapeChar) |
@@ -395,7 +395,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
395 | public static string UnescapePath(string path) | 395 | public static string UnescapePath(string path) |
396 | { | 396 | { |
397 | // m_log.DebugFormat("ESCAPING PATH {0}", path); | 397 | // m_log.DebugFormat("ESCAPING PATH {0}", path); |
398 | 398 | ||
399 | StringBuilder sb = new StringBuilder(); | 399 | StringBuilder sb = new StringBuilder(); |
400 | 400 | ||
401 | bool singleEscapeChar = false; | 401 | bool singleEscapeChar = false; |
@@ -418,7 +418,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
418 | } | 418 | } |
419 | 419 | ||
420 | // m_log.DebugFormat("ESCAPED PATH TO {0}", sb); | 420 | // m_log.DebugFormat("ESCAPED PATH TO {0}", sb); |
421 | 421 | ||
422 | return sb.ToString(); | 422 | return sb.ToString(); |
423 | } | 423 | } |
424 | 424 | ||
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs index 8847414..be59eb5 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs | |||
@@ -172,7 +172,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
172 | 172 | ||
173 | public string Name { get { return "Inventory Archiver Module"; } } | 173 | public string Name { get { return "Inventory Archiver Module"; } } |
174 | 174 | ||
175 | #endregion | 175 | #endregion |
176 | 176 | ||
177 | /// <summary> | 177 | /// <summary> |
178 | /// Trigger the inventory archive saved event. | 178 | /// Trigger the inventory archive saved event. |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadPathTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadPathTests.cs index c2e645f..f559c2e 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadPathTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadPathTests.cs | |||
@@ -56,23 +56,23 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
56 | { | 56 | { |
57 | TestHelpers.InMethod(); | 57 | TestHelpers.InMethod(); |
58 | // log4net.Config.XmlConfigurator.Configure(); | 58 | // log4net.Config.XmlConfigurator.Configure(); |
59 | 59 | ||
60 | SerialiserModule serialiserModule = new SerialiserModule(); | 60 | SerialiserModule serialiserModule = new SerialiserModule(); |
61 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(); | 61 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(); |
62 | 62 | ||
63 | // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene | 63 | // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene |
64 | Scene scene = new SceneHelpers().SetupScene(); | 64 | Scene scene = new SceneHelpers().SetupScene(); |
65 | 65 | ||
66 | SceneHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); | 66 | SceneHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); |
67 | 67 | ||
68 | UserAccountHelpers.CreateUserWithInventory(scene, m_uaMT, "meowfood"); | 68 | UserAccountHelpers.CreateUserWithInventory(scene, m_uaMT, "meowfood"); |
69 | UserAccountHelpers.CreateUserWithInventory(scene, m_uaLL1, "hampshire"); | 69 | UserAccountHelpers.CreateUserWithInventory(scene, m_uaLL1, "hampshire"); |
70 | 70 | ||
71 | archiverModule.DearchiveInventory(UUID.Random(), m_uaMT.FirstName, m_uaMT.LastName, "/", "meowfood", m_iarStream); | 71 | archiverModule.DearchiveInventory(UUID.Random(), m_uaMT.FirstName, m_uaMT.LastName, "/", "meowfood", m_iarStream); |
72 | InventoryItemBase foundItem1 | 72 | InventoryItemBase foundItem1 |
73 | = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_uaMT.PrincipalID, m_item1Name); | 73 | = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_uaMT.PrincipalID, m_item1Name); |
74 | 74 | ||
75 | Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1"); | 75 | Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1"); |
76 | 76 | ||
77 | // Now try loading to a root child folder | 77 | // Now try loading to a root child folder |
78 | UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, m_uaMT.PrincipalID, "xA", false); | 78 | UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, m_uaMT.PrincipalID, "xA", false); |
@@ -90,9 +90,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
90 | 90 | ||
91 | InventoryItemBase foundItem3 | 91 | InventoryItemBase foundItem3 |
92 | = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_uaMT.PrincipalID, "xB/xC/" + m_item1Name); | 92 | = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_uaMT.PrincipalID, "xB/xC/" + m_item1Name); |
93 | Assert.That(foundItem3, Is.Not.Null, "Didn't find loaded item 3"); | 93 | Assert.That(foundItem3, Is.Not.Null, "Didn't find loaded item 3"); |
94 | } | 94 | } |
95 | 95 | ||
96 | /// <summary> | 96 | /// <summary> |
97 | /// Test that things work when the load path specified starts with a slash | 97 | /// Test that things work when the load path specified starts with a slash |
98 | /// </summary> | 98 | /// </summary> |
@@ -101,22 +101,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
101 | { | 101 | { |
102 | TestHelpers.InMethod(); | 102 | TestHelpers.InMethod(); |
103 | // log4net.Config.XmlConfigurator.Configure(); | 103 | // log4net.Config.XmlConfigurator.Configure(); |
104 | 104 | ||
105 | SerialiserModule serialiserModule = new SerialiserModule(); | 105 | SerialiserModule serialiserModule = new SerialiserModule(); |
106 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(); | 106 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(); |
107 | Scene scene = new SceneHelpers().SetupScene(); | 107 | Scene scene = new SceneHelpers().SetupScene(); |
108 | SceneHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); | 108 | SceneHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); |
109 | 109 | ||
110 | UserAccountHelpers.CreateUserWithInventory(scene, m_uaMT, "password"); | 110 | UserAccountHelpers.CreateUserWithInventory(scene, m_uaMT, "password"); |
111 | archiverModule.DearchiveInventory(UUID.Random(), m_uaMT.FirstName, m_uaMT.LastName, "/Objects", "password", m_iarStream); | 111 | archiverModule.DearchiveInventory(UUID.Random(), m_uaMT.FirstName, m_uaMT.LastName, "/Objects", "password", m_iarStream); |
112 | 112 | ||
113 | InventoryItemBase foundItem1 | 113 | InventoryItemBase foundItem1 |
114 | = InventoryArchiveUtils.FindItemByPath( | 114 | = InventoryArchiveUtils.FindItemByPath( |
115 | scene.InventoryService, m_uaMT.PrincipalID, "/Objects/" + m_item1Name); | 115 | scene.InventoryService, m_uaMT.PrincipalID, "/Objects/" + m_item1Name); |
116 | 116 | ||
117 | Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1 in TestLoadIarFolderStartsWithSlash()"); | 117 | Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1 in TestLoadIarFolderStartsWithSlash()"); |
118 | } | 118 | } |
119 | 119 | ||
120 | [Test] | 120 | [Test] |
121 | public void TestLoadIarPathWithEscapedChars() | 121 | public void TestLoadIarPathWithEscapedChars() |
122 | { | 122 | { |
@@ -137,7 +137,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
137 | string userLastName = "Stirrup"; | 137 | string userLastName = "Stirrup"; |
138 | UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020"); | 138 | UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020"); |
139 | UserAccountHelpers.CreateUserWithInventory(scene, userFirstName, userLastName, userId, "meowfood"); | 139 | UserAccountHelpers.CreateUserWithInventory(scene, userFirstName, userLastName, userId, "meowfood"); |
140 | 140 | ||
141 | // Create asset | 141 | // Create asset |
142 | SceneObjectGroup object1; | 142 | SceneObjectGroup object1; |
143 | SceneObjectPart part1; | 143 | SceneObjectPart part1; |
@@ -168,7 +168,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
168 | item1.Name = itemName; | 168 | item1.Name = itemName; |
169 | item1.AssetID = asset1.FullID; | 169 | item1.AssetID = asset1.FullID; |
170 | item1.ID = item1Id; | 170 | item1.ID = item1Id; |
171 | InventoryFolderBase objsFolder | 171 | InventoryFolderBase objsFolder |
172 | = InventoryArchiveUtils.FindFoldersByPath(scene.InventoryService, userId, "Objects")[0]; | 172 | = InventoryArchiveUtils.FindFoldersByPath(scene.InventoryService, userId, "Objects")[0]; |
173 | item1.Folder = objsFolder.ID; | 173 | item1.Folder = objsFolder.ID; |
174 | scene.AddInventoryItem(item1); | 174 | scene.AddInventoryItem(item1); |
@@ -189,16 +189,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
189 | InventoryItemBase foundItem1 | 189 | InventoryItemBase foundItem1 |
190 | = InventoryArchiveUtils.FindItemByPath( | 190 | = InventoryArchiveUtils.FindItemByPath( |
191 | scene.InventoryService, userId, "Scripts/Objects/" + humanEscapedItemName); | 191 | scene.InventoryService, userId, "Scripts/Objects/" + humanEscapedItemName); |
192 | 192 | ||
193 | Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1"); | 193 | Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1"); |
194 | // Assert.That( | 194 | // Assert.That( |
195 | // foundItem1.CreatorId, Is.EqualTo(userUuid), | 195 | // foundItem1.CreatorId, Is.EqualTo(userUuid), |
196 | // "Loaded item non-uuid creator doesn't match that of the loading user"); | 196 | // "Loaded item non-uuid creator doesn't match that of the loading user"); |
197 | Assert.That( | 197 | Assert.That( |
198 | foundItem1.Name, Is.EqualTo(itemName), | 198 | foundItem1.Name, Is.EqualTo(itemName), |
199 | "Loaded item name doesn't match saved name"); | 199 | "Loaded item name doesn't match saved name"); |
200 | } | 200 | } |
201 | 201 | ||
202 | /// <summary> | 202 | /// <summary> |
203 | /// Test replication of an archive path to the user's inventory. | 203 | /// Test replication of an archive path to the user's inventory. |
204 | /// </summary> | 204 | /// </summary> |
@@ -207,21 +207,21 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
207 | { | 207 | { |
208 | TestHelpers.InMethod(); | 208 | TestHelpers.InMethod(); |
209 | // log4net.Config.XmlConfigurator.Configure(); | 209 | // log4net.Config.XmlConfigurator.Configure(); |
210 | 210 | ||
211 | Scene scene = new SceneHelpers().SetupScene(); | 211 | Scene scene = new SceneHelpers().SetupScene(); |
212 | UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene); | 212 | UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene); |
213 | 213 | ||
214 | Dictionary <string, InventoryFolderBase> foldersCreated = new Dictionary<string, InventoryFolderBase>(); | 214 | Dictionary <string, InventoryFolderBase> foldersCreated = new Dictionary<string, InventoryFolderBase>(); |
215 | HashSet<InventoryNodeBase> nodesLoaded = new HashSet<InventoryNodeBase>(); | 215 | HashSet<InventoryNodeBase> nodesLoaded = new HashSet<InventoryNodeBase>(); |
216 | 216 | ||
217 | string folder1Name = "1"; | 217 | string folder1Name = "1"; |
218 | string folder2aName = "2a"; | 218 | string folder2aName = "2a"; |
219 | string folder2bName = "2b"; | 219 | string folder2bName = "2b"; |
220 | 220 | ||
221 | string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1Name, UUID.Random()); | 221 | string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1Name, UUID.Random()); |
222 | string folder2aArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2aName, UUID.Random()); | 222 | string folder2aArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2aName, UUID.Random()); |
223 | string folder2bArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2bName, UUID.Random()); | 223 | string folder2bArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2bName, UUID.Random()); |
224 | 224 | ||
225 | string iarPath1 = string.Join("", new string[] { folder1ArchiveName, folder2aArchiveName }); | 225 | string iarPath1 = string.Join("", new string[] { folder1ArchiveName, folder2aArchiveName }); |
226 | string iarPath2 = string.Join("", new string[] { folder1ArchiveName, folder2bArchiveName }); | 226 | string iarPath2 = string.Join("", new string[] { folder1ArchiveName, folder2bArchiveName }); |
227 | 227 | ||
@@ -229,42 +229,42 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
229 | // Test replication of path1 | 229 | // Test replication of path1 |
230 | new InventoryArchiveReadRequest(UUID.Random(), null, scene.InventoryService, scene.AssetService, scene.UserAccountService, ua1, null, (Stream)null, false) | 230 | new InventoryArchiveReadRequest(UUID.Random(), null, scene.InventoryService, scene.AssetService, scene.UserAccountService, ua1, null, (Stream)null, false) |
231 | .ReplicateArchivePathToUserInventory( | 231 | .ReplicateArchivePathToUserInventory( |
232 | iarPath1, scene.InventoryService.GetRootFolder(ua1.PrincipalID), | 232 | iarPath1, scene.InventoryService.GetRootFolder(ua1.PrincipalID), |
233 | foldersCreated, nodesLoaded); | 233 | foldersCreated, nodesLoaded); |
234 | 234 | ||
235 | List<InventoryFolderBase> folder1Candidates | 235 | List<InventoryFolderBase> folder1Candidates |
236 | = InventoryArchiveUtils.FindFoldersByPath(scene.InventoryService, ua1.PrincipalID, folder1Name); | 236 | = InventoryArchiveUtils.FindFoldersByPath(scene.InventoryService, ua1.PrincipalID, folder1Name); |
237 | Assert.That(folder1Candidates.Count, Is.EqualTo(1)); | 237 | Assert.That(folder1Candidates.Count, Is.EqualTo(1)); |
238 | 238 | ||
239 | InventoryFolderBase folder1 = folder1Candidates[0]; | 239 | InventoryFolderBase folder1 = folder1Candidates[0]; |
240 | List<InventoryFolderBase> folder2aCandidates | 240 | List<InventoryFolderBase> folder2aCandidates |
241 | = InventoryArchiveUtils.FindFoldersByPath(scene.InventoryService, folder1, folder2aName); | 241 | = InventoryArchiveUtils.FindFoldersByPath(scene.InventoryService, folder1, folder2aName); |
242 | Assert.That(folder2aCandidates.Count, Is.EqualTo(1)); | 242 | Assert.That(folder2aCandidates.Count, Is.EqualTo(1)); |
243 | } | 243 | } |
244 | 244 | ||
245 | { | 245 | { |
246 | // Test replication of path2 | 246 | // Test replication of path2 |
247 | new InventoryArchiveReadRequest(UUID.Random(), null, scene.InventoryService, scene.AssetService, scene.UserAccountService, ua1, null, (Stream)null, false) | 247 | new InventoryArchiveReadRequest(UUID.Random(), null, scene.InventoryService, scene.AssetService, scene.UserAccountService, ua1, null, (Stream)null, false) |
248 | .ReplicateArchivePathToUserInventory( | 248 | .ReplicateArchivePathToUserInventory( |
249 | iarPath2, scene.InventoryService.GetRootFolder(ua1.PrincipalID), | 249 | iarPath2, scene.InventoryService.GetRootFolder(ua1.PrincipalID), |
250 | foldersCreated, nodesLoaded); | 250 | foldersCreated, nodesLoaded); |
251 | 251 | ||
252 | List<InventoryFolderBase> folder1Candidates | 252 | List<InventoryFolderBase> folder1Candidates |
253 | = InventoryArchiveUtils.FindFoldersByPath(scene.InventoryService, ua1.PrincipalID, folder1Name); | 253 | = InventoryArchiveUtils.FindFoldersByPath(scene.InventoryService, ua1.PrincipalID, folder1Name); |
254 | Assert.That(folder1Candidates.Count, Is.EqualTo(1)); | 254 | Assert.That(folder1Candidates.Count, Is.EqualTo(1)); |
255 | 255 | ||
256 | InventoryFolderBase folder1 = folder1Candidates[0]; | 256 | InventoryFolderBase folder1 = folder1Candidates[0]; |
257 | 257 | ||
258 | List<InventoryFolderBase> folder2aCandidates | 258 | List<InventoryFolderBase> folder2aCandidates |
259 | = InventoryArchiveUtils.FindFoldersByPath(scene.InventoryService, folder1, folder2aName); | 259 | = InventoryArchiveUtils.FindFoldersByPath(scene.InventoryService, folder1, folder2aName); |
260 | Assert.That(folder2aCandidates.Count, Is.EqualTo(1)); | 260 | Assert.That(folder2aCandidates.Count, Is.EqualTo(1)); |
261 | 261 | ||
262 | List<InventoryFolderBase> folder2bCandidates | 262 | List<InventoryFolderBase> folder2bCandidates |
263 | = InventoryArchiveUtils.FindFoldersByPath(scene.InventoryService, folder1, folder2bName); | 263 | = InventoryArchiveUtils.FindFoldersByPath(scene.InventoryService, folder1, folder2bName); |
264 | Assert.That(folder2bCandidates.Count, Is.EqualTo(1)); | 264 | Assert.That(folder2bCandidates.Count, Is.EqualTo(1)); |
265 | } | 265 | } |
266 | } | 266 | } |
267 | 267 | ||
268 | /// <summary> | 268 | /// <summary> |
269 | /// Test replication of a partly existing archive path to the user's inventory. This should create | 269 | /// Test replication of a partly existing archive path to the user's inventory. This should create |
270 | /// a duplicate path without the merge option. | 270 | /// a duplicate path without the merge option. |
@@ -274,31 +274,31 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
274 | { | 274 | { |
275 | TestHelpers.InMethod(); | 275 | TestHelpers.InMethod(); |
276 | //log4net.Config.XmlConfigurator.Configure(); | 276 | //log4net.Config.XmlConfigurator.Configure(); |
277 | 277 | ||
278 | Scene scene = new SceneHelpers().SetupScene(); | 278 | Scene scene = new SceneHelpers().SetupScene(); |
279 | UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene); | 279 | UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene); |
280 | 280 | ||
281 | string folder1ExistingName = "a"; | 281 | string folder1ExistingName = "a"; |
282 | string folder2Name = "b"; | 282 | string folder2Name = "b"; |
283 | 283 | ||
284 | InventoryFolderBase folder1 | 284 | InventoryFolderBase folder1 |
285 | = UserInventoryHelpers.CreateInventoryFolder( | 285 | = UserInventoryHelpers.CreateInventoryFolder( |
286 | scene.InventoryService, ua1.PrincipalID, folder1ExistingName, false); | 286 | scene.InventoryService, ua1.PrincipalID, folder1ExistingName, false); |
287 | 287 | ||
288 | string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1ExistingName, UUID.Random()); | 288 | string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1ExistingName, UUID.Random()); |
289 | string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random()); | 289 | string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random()); |
290 | 290 | ||
291 | string itemArchivePath = string.Join("", new string[] { folder1ArchiveName, folder2ArchiveName }); | 291 | string itemArchivePath = string.Join("", new string[] { folder1ArchiveName, folder2ArchiveName }); |
292 | 292 | ||
293 | new InventoryArchiveReadRequest(UUID.Random(), null, scene.InventoryService, scene.AssetService, scene.UserAccountService, ua1, null, (Stream)null, false) | 293 | new InventoryArchiveReadRequest(UUID.Random(), null, scene.InventoryService, scene.AssetService, scene.UserAccountService, ua1, null, (Stream)null, false) |
294 | .ReplicateArchivePathToUserInventory( | 294 | .ReplicateArchivePathToUserInventory( |
295 | itemArchivePath, scene.InventoryService.GetRootFolder(ua1.PrincipalID), | 295 | itemArchivePath, scene.InventoryService.GetRootFolder(ua1.PrincipalID), |
296 | new Dictionary<string, InventoryFolderBase>(), new HashSet<InventoryNodeBase>()); | 296 | new Dictionary<string, InventoryFolderBase>(), new HashSet<InventoryNodeBase>()); |
297 | 297 | ||
298 | List<InventoryFolderBase> folder1PostCandidates | 298 | List<InventoryFolderBase> folder1PostCandidates |
299 | = InventoryArchiveUtils.FindFoldersByPath(scene.InventoryService, ua1.PrincipalID, folder1ExistingName); | 299 | = InventoryArchiveUtils.FindFoldersByPath(scene.InventoryService, ua1.PrincipalID, folder1ExistingName); |
300 | Assert.That(folder1PostCandidates.Count, Is.EqualTo(2)); | 300 | Assert.That(folder1PostCandidates.Count, Is.EqualTo(2)); |
301 | 301 | ||
302 | // FIXME: Temporarily, we're going to do something messy to make sure we pick up the created folder. | 302 | // FIXME: Temporarily, we're going to do something messy to make sure we pick up the created folder. |
303 | InventoryFolderBase folder1Post = null; | 303 | InventoryFolderBase folder1Post = null; |
304 | foreach (InventoryFolderBase folder in folder1PostCandidates) | 304 | foreach (InventoryFolderBase folder in folder1PostCandidates) |
@@ -311,11 +311,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
311 | } | 311 | } |
312 | // Assert.That(folder1Post.ID, Is.EqualTo(folder1.ID)); | 312 | // Assert.That(folder1Post.ID, Is.EqualTo(folder1.ID)); |
313 | 313 | ||
314 | List<InventoryFolderBase> folder2PostCandidates | 314 | List<InventoryFolderBase> folder2PostCandidates |
315 | = InventoryArchiveUtils.FindFoldersByPath(scene.InventoryService, folder1Post, "b"); | 315 | = InventoryArchiveUtils.FindFoldersByPath(scene.InventoryService, folder1Post, "b"); |
316 | Assert.That(folder2PostCandidates.Count, Is.EqualTo(1)); | 316 | Assert.That(folder2PostCandidates.Count, Is.EqualTo(1)); |
317 | } | 317 | } |
318 | 318 | ||
319 | /// <summary> | 319 | /// <summary> |
320 | /// Test replication of a partly existing archive path to the user's inventory. This should create | 320 | /// Test replication of a partly existing archive path to the user's inventory. This should create |
321 | /// a merged path. | 321 | /// a merged path. |
@@ -325,33 +325,33 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
325 | { | 325 | { |
326 | TestHelpers.InMethod(); | 326 | TestHelpers.InMethod(); |
327 | // log4net.Config.XmlConfigurator.Configure(); | 327 | // log4net.Config.XmlConfigurator.Configure(); |
328 | 328 | ||
329 | Scene scene = new SceneHelpers().SetupScene(); | 329 | Scene scene = new SceneHelpers().SetupScene(); |
330 | UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene); | 330 | UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene); |
331 | 331 | ||
332 | string folder1ExistingName = "a"; | 332 | string folder1ExistingName = "a"; |
333 | string folder2Name = "b"; | 333 | string folder2Name = "b"; |
334 | 334 | ||
335 | InventoryFolderBase folder1 | 335 | InventoryFolderBase folder1 |
336 | = UserInventoryHelpers.CreateInventoryFolder( | 336 | = UserInventoryHelpers.CreateInventoryFolder( |
337 | scene.InventoryService, ua1.PrincipalID, folder1ExistingName, false); | 337 | scene.InventoryService, ua1.PrincipalID, folder1ExistingName, false); |
338 | 338 | ||
339 | string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1ExistingName, UUID.Random()); | 339 | string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1ExistingName, UUID.Random()); |
340 | string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random()); | 340 | string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random()); |
341 | 341 | ||
342 | string itemArchivePath = string.Join("", new string[] { folder1ArchiveName, folder2ArchiveName }); | 342 | string itemArchivePath = string.Join("", new string[] { folder1ArchiveName, folder2ArchiveName }); |
343 | 343 | ||
344 | new InventoryArchiveReadRequest(UUID.Random(), null, scene.InventoryService, scene.AssetService, scene.UserAccountService, ua1, folder1ExistingName, (Stream)null, true) | 344 | new InventoryArchiveReadRequest(UUID.Random(), null, scene.InventoryService, scene.AssetService, scene.UserAccountService, ua1, folder1ExistingName, (Stream)null, true) |
345 | .ReplicateArchivePathToUserInventory( | 345 | .ReplicateArchivePathToUserInventory( |
346 | itemArchivePath, scene.InventoryService.GetRootFolder(ua1.PrincipalID), | 346 | itemArchivePath, scene.InventoryService.GetRootFolder(ua1.PrincipalID), |
347 | new Dictionary<string, InventoryFolderBase>(), new HashSet<InventoryNodeBase>()); | 347 | new Dictionary<string, InventoryFolderBase>(), new HashSet<InventoryNodeBase>()); |
348 | 348 | ||
349 | List<InventoryFolderBase> folder1PostCandidates | 349 | List<InventoryFolderBase> folder1PostCandidates |
350 | = InventoryArchiveUtils.FindFoldersByPath(scene.InventoryService, ua1.PrincipalID, folder1ExistingName); | 350 | = InventoryArchiveUtils.FindFoldersByPath(scene.InventoryService, ua1.PrincipalID, folder1ExistingName); |
351 | Assert.That(folder1PostCandidates.Count, Is.EqualTo(1)); | 351 | Assert.That(folder1PostCandidates.Count, Is.EqualTo(1)); |
352 | Assert.That(folder1PostCandidates[0].ID, Is.EqualTo(folder1.ID)); | 352 | Assert.That(folder1PostCandidates[0].ID, Is.EqualTo(folder1.ID)); |
353 | 353 | ||
354 | List<InventoryFolderBase> folder2PostCandidates | 354 | List<InventoryFolderBase> folder2PostCandidates |
355 | = InventoryArchiveUtils.FindFoldersByPath(scene.InventoryService, folder1PostCandidates[0], "b"); | 355 | = InventoryArchiveUtils.FindFoldersByPath(scene.InventoryService, folder1PostCandidates[0], "b"); |
356 | Assert.That(folder2PostCandidates.Count, Is.EqualTo(1)); | 356 | Assert.That(folder2PostCandidates.Count, Is.EqualTo(1)); |
357 | } | 357 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadTests.cs index 57b4f80..d0bdc91 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadTests.cs | |||
@@ -47,7 +47,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
47 | { | 47 | { |
48 | [TestFixture] | 48 | [TestFixture] |
49 | public class InventoryArchiveLoadTests : InventoryArchiveTestCase | 49 | public class InventoryArchiveLoadTests : InventoryArchiveTestCase |
50 | { | 50 | { |
51 | protected TestScene m_scene; | 51 | protected TestScene m_scene; |
52 | protected InventoryArchiverModule m_archiverModule; | 52 | protected InventoryArchiverModule m_archiverModule; |
53 | 53 | ||
@@ -55,12 +55,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
55 | public override void SetUp() | 55 | public override void SetUp() |
56 | { | 56 | { |
57 | base.SetUp(); | 57 | base.SetUp(); |
58 | 58 | ||
59 | SerialiserModule serialiserModule = new SerialiserModule(); | 59 | SerialiserModule serialiserModule = new SerialiserModule(); |
60 | m_archiverModule = new InventoryArchiverModule(); | 60 | m_archiverModule = new InventoryArchiverModule(); |
61 | 61 | ||
62 | m_scene = new SceneHelpers().SetupScene(); | 62 | m_scene = new SceneHelpers().SetupScene(); |
63 | SceneHelpers.SetupSceneModules(m_scene, serialiserModule, m_archiverModule); | 63 | SceneHelpers.SetupSceneModules(m_scene, serialiserModule, m_archiverModule); |
64 | } | 64 | } |
65 | 65 | ||
66 | [Test] | 66 | [Test] |
@@ -68,35 +68,35 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
68 | { | 68 | { |
69 | TestHelpers.InMethod(); | 69 | TestHelpers.InMethod(); |
70 | // TestHelpers.EnableLogging(); | 70 | // TestHelpers.EnableLogging(); |
71 | 71 | ||
72 | UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaLL1, "password"); | 72 | UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaLL1, "password"); |
73 | m_archiverModule.DearchiveInventory(UUID.Random(), m_uaLL1.FirstName, m_uaLL1.LastName, "/", "password", m_iarStream); | 73 | m_archiverModule.DearchiveInventory(UUID.Random(), m_uaLL1.FirstName, m_uaLL1.LastName, "/", "password", m_iarStream); |
74 | 74 | ||
75 | InventoryItemBase coaItem | 75 | InventoryItemBase coaItem |
76 | = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_uaLL1.PrincipalID, m_coaItemName); | 76 | = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_uaLL1.PrincipalID, m_coaItemName); |
77 | 77 | ||
78 | Assert.That(coaItem, Is.Not.Null, "Didn't find loaded item 1"); | 78 | Assert.That(coaItem, Is.Not.Null, "Didn't find loaded item 1"); |
79 | 79 | ||
80 | string assetXml = AssetHelpers.ReadAssetAsString(m_scene.AssetService, coaItem.AssetID); | 80 | string assetXml = AssetHelpers.ReadAssetAsString(m_scene.AssetService, coaItem.AssetID); |
81 | 81 | ||
82 | CoalescedSceneObjects coa; | 82 | CoalescedSceneObjects coa; |
83 | bool readResult = CoalescedSceneObjectsSerializer.TryFromXml(assetXml, out coa); | 83 | bool readResult = CoalescedSceneObjectsSerializer.TryFromXml(assetXml, out coa); |
84 | 84 | ||
85 | Assert.That(readResult, Is.True); | 85 | Assert.That(readResult, Is.True); |
86 | Assert.That(coa.Count, Is.EqualTo(2)); | 86 | Assert.That(coa.Count, Is.EqualTo(2)); |
87 | 87 | ||
88 | List<SceneObjectGroup> coaObjects = coa.Objects; | 88 | List<SceneObjectGroup> coaObjects = coa.Objects; |
89 | Assert.That(coaObjects[0].UUID, Is.EqualTo(UUID.Parse("00000000-0000-0000-0000-000000000120"))); | 89 | Assert.That(coaObjects[0].UUID, Is.EqualTo(UUID.Parse("00000000-0000-0000-0000-000000000120"))); |
90 | Assert.That(coaObjects[0].AbsolutePosition, Is.EqualTo(new Vector3(15, 30, 45))); | 90 | Assert.That(coaObjects[0].AbsolutePosition, Is.EqualTo(new Vector3(15, 30, 45))); |
91 | 91 | ||
92 | Assert.That(coaObjects[1].UUID, Is.EqualTo(UUID.Parse("00000000-0000-0000-0000-000000000140"))); | 92 | Assert.That(coaObjects[1].UUID, Is.EqualTo(UUID.Parse("00000000-0000-0000-0000-000000000140"))); |
93 | Assert.That(coaObjects[1].AbsolutePosition, Is.EqualTo(new Vector3(25, 50, 75))); | 93 | Assert.That(coaObjects[1].AbsolutePosition, Is.EqualTo(new Vector3(25, 50, 75))); |
94 | } | 94 | } |
95 | 95 | ||
96 | /// <summary> | 96 | /// <summary> |
97 | /// Test case where a creator account exists for the creator UUID embedded in item metadata and serialized | 97 | /// Test case where a creator account exists for the creator UUID embedded in item metadata and serialized |
98 | /// objects. | 98 | /// objects. |
99 | /// </summary> | 99 | /// </summary> |
100 | [Test] | 100 | [Test] |
101 | public void TestLoadIarCreatorAccountPresent() | 101 | public void TestLoadIarCreatorAccountPresent() |
102 | { | 102 | { |
@@ -105,26 +105,26 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
105 | 105 | ||
106 | UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaLL1, "meowfood"); | 106 | UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaLL1, "meowfood"); |
107 | 107 | ||
108 | m_archiverModule.DearchiveInventory(UUID.Random(), m_uaLL1.FirstName, m_uaLL1.LastName, "/", "meowfood", m_iarStream); | 108 | m_archiverModule.DearchiveInventory(UUID.Random(), m_uaLL1.FirstName, m_uaLL1.LastName, "/", "meowfood", m_iarStream); |
109 | InventoryItemBase foundItem1 | 109 | InventoryItemBase foundItem1 |
110 | = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_uaLL1.PrincipalID, m_item1Name); | 110 | = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_uaLL1.PrincipalID, m_item1Name); |
111 | 111 | ||
112 | Assert.That( | 112 | Assert.That( |
113 | foundItem1.CreatorId, Is.EqualTo(m_uaLL1.PrincipalID.ToString()), | 113 | foundItem1.CreatorId, Is.EqualTo(m_uaLL1.PrincipalID.ToString()), |
114 | "Loaded item non-uuid creator doesn't match original"); | 114 | "Loaded item non-uuid creator doesn't match original"); |
115 | Assert.That( | 115 | Assert.That( |
116 | foundItem1.CreatorIdAsUuid, Is.EqualTo(m_uaLL1.PrincipalID), | 116 | foundItem1.CreatorIdAsUuid, Is.EqualTo(m_uaLL1.PrincipalID), |
117 | "Loaded item uuid creator doesn't match original"); | 117 | "Loaded item uuid creator doesn't match original"); |
118 | Assert.That(foundItem1.Owner, Is.EqualTo(m_uaLL1.PrincipalID), | 118 | Assert.That(foundItem1.Owner, Is.EqualTo(m_uaLL1.PrincipalID), |
119 | "Loaded item owner doesn't match inventory reciever"); | 119 | "Loaded item owner doesn't match inventory reciever"); |
120 | 120 | ||
121 | AssetBase asset1 = m_scene.AssetService.Get(foundItem1.AssetID.ToString()); | 121 | AssetBase asset1 = m_scene.AssetService.Get(foundItem1.AssetID.ToString()); |
122 | string xmlData = Utils.BytesToString(asset1.Data); | 122 | string xmlData = Utils.BytesToString(asset1.Data); |
123 | SceneObjectGroup sog1 = SceneObjectSerializer.FromOriginalXmlFormat(xmlData); | 123 | SceneObjectGroup sog1 = SceneObjectSerializer.FromOriginalXmlFormat(xmlData); |
124 | 124 | ||
125 | Assert.That(sog1.RootPart.CreatorID, Is.EqualTo(m_uaLL1.PrincipalID)); | 125 | Assert.That(sog1.RootPart.CreatorID, Is.EqualTo(m_uaLL1.PrincipalID)); |
126 | } | 126 | } |
127 | 127 | ||
128 | // /// <summary> | 128 | // /// <summary> |
129 | // /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where | 129 | // /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where |
130 | // /// an account exists with the same name as the creator, though not the same id. | 130 | // /// an account exists with the same name as the creator, though not the same id. |
@@ -137,24 +137,24 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
137 | // | 137 | // |
138 | // UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaMT, "meowfood"); | 138 | // UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaMT, "meowfood"); |
139 | // UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaLL2, "hampshire"); | 139 | // UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaLL2, "hampshire"); |
140 | // | 140 | // |
141 | // m_archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "/", "meowfood", m_iarStream); | 141 | // m_archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "/", "meowfood", m_iarStream); |
142 | // InventoryItemBase foundItem1 | 142 | // InventoryItemBase foundItem1 |
143 | // = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_uaMT.PrincipalID, m_item1Name); | 143 | // = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_uaMT.PrincipalID, m_item1Name); |
144 | // | 144 | // |
145 | // Assert.That( | 145 | // Assert.That( |
146 | // foundItem1.CreatorId, Is.EqualTo(m_uaLL2.PrincipalID.ToString()), | 146 | // foundItem1.CreatorId, Is.EqualTo(m_uaLL2.PrincipalID.ToString()), |
147 | // "Loaded item non-uuid creator doesn't match original"); | 147 | // "Loaded item non-uuid creator doesn't match original"); |
148 | // Assert.That( | 148 | // Assert.That( |
149 | // foundItem1.CreatorIdAsUuid, Is.EqualTo(m_uaLL2.PrincipalID), | 149 | // foundItem1.CreatorIdAsUuid, Is.EqualTo(m_uaLL2.PrincipalID), |
150 | // "Loaded item uuid creator doesn't match original"); | 150 | // "Loaded item uuid creator doesn't match original"); |
151 | // Assert.That(foundItem1.Owner, Is.EqualTo(m_uaMT.PrincipalID), | 151 | // Assert.That(foundItem1.Owner, Is.EqualTo(m_uaMT.PrincipalID), |
152 | // "Loaded item owner doesn't match inventory reciever"); | 152 | // "Loaded item owner doesn't match inventory reciever"); |
153 | // | 153 | // |
154 | // AssetBase asset1 = m_scene.AssetService.Get(foundItem1.AssetID.ToString()); | 154 | // AssetBase asset1 = m_scene.AssetService.Get(foundItem1.AssetID.ToString()); |
155 | // string xmlData = Utils.BytesToString(asset1.Data); | 155 | // string xmlData = Utils.BytesToString(asset1.Data); |
156 | // SceneObjectGroup sog1 = SceneObjectSerializer.FromOriginalXmlFormat(xmlData); | 156 | // SceneObjectGroup sog1 = SceneObjectSerializer.FromOriginalXmlFormat(xmlData); |
157 | // | 157 | // |
158 | // Assert.That(sog1.RootPart.CreatorID, Is.EqualTo(m_uaLL2.PrincipalID)); | 158 | // Assert.That(sog1.RootPart.CreatorID, Is.EqualTo(m_uaLL2.PrincipalID)); |
159 | // } | 159 | // } |
160 | 160 | ||
@@ -167,26 +167,26 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
167 | { | 167 | { |
168 | TestHelpers.InMethod(); | 168 | TestHelpers.InMethod(); |
169 | // log4net.Config.XmlConfigurator.Configure(); | 169 | // log4net.Config.XmlConfigurator.Configure(); |
170 | 170 | ||
171 | UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaMT, "password"); | 171 | UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaMT, "password"); |
172 | m_archiverModule.DearchiveInventory(UUID.Random(), m_uaMT.FirstName, m_uaMT.LastName, "/", "password", m_iarStream); | 172 | m_archiverModule.DearchiveInventory(UUID.Random(), m_uaMT.FirstName, m_uaMT.LastName, "/", "password", m_iarStream); |
173 | 173 | ||
174 | InventoryItemBase foundItem1 | 174 | InventoryItemBase foundItem1 |
175 | = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_uaMT.PrincipalID, m_item1Name); | 175 | = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_uaMT.PrincipalID, m_item1Name); |
176 | 176 | ||
177 | Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1"); | 177 | Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1"); |
178 | Assert.That( | 178 | Assert.That( |
179 | foundItem1.CreatorId, Is.EqualTo(m_uaMT.PrincipalID.ToString()), | 179 | foundItem1.CreatorId, Is.EqualTo(m_uaMT.PrincipalID.ToString()), |
180 | "Loaded item non-uuid creator doesn't match that of the loading user"); | 180 | "Loaded item non-uuid creator doesn't match that of the loading user"); |
181 | Assert.That( | 181 | Assert.That( |
182 | foundItem1.CreatorIdAsUuid, Is.EqualTo(m_uaMT.PrincipalID), | 182 | foundItem1.CreatorIdAsUuid, Is.EqualTo(m_uaMT.PrincipalID), |
183 | "Loaded item uuid creator doesn't match that of the loading user"); | 183 | "Loaded item uuid creator doesn't match that of the loading user"); |
184 | 184 | ||
185 | AssetBase asset1 = m_scene.AssetService.Get(foundItem1.AssetID.ToString()); | 185 | AssetBase asset1 = m_scene.AssetService.Get(foundItem1.AssetID.ToString()); |
186 | string xmlData = Utils.BytesToString(asset1.Data); | 186 | string xmlData = Utils.BytesToString(asset1.Data); |
187 | SceneObjectGroup sog1 = SceneObjectSerializer.FromOriginalXmlFormat(xmlData); | 187 | SceneObjectGroup sog1 = SceneObjectSerializer.FromOriginalXmlFormat(xmlData); |
188 | 188 | ||
189 | Assert.That(sog1.RootPart.CreatorID, Is.EqualTo(m_uaMT.PrincipalID)); | 189 | Assert.That(sog1.RootPart.CreatorID, Is.EqualTo(m_uaMT.PrincipalID)); |
190 | } | 190 | } |
191 | } | 191 | } |
192 | } \ No newline at end of file | 192 | } \ No newline at end of file |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveSaveTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveSaveTests.cs index 7265405..bd112b4 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveSaveTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveSaveTests.cs | |||
@@ -50,19 +50,19 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
50 | { | 50 | { |
51 | protected TestScene m_scene; | 51 | protected TestScene m_scene; |
52 | protected InventoryArchiverModule m_archiverModule; | 52 | protected InventoryArchiverModule m_archiverModule; |
53 | 53 | ||
54 | [SetUp] | 54 | [SetUp] |
55 | public override void SetUp() | 55 | public override void SetUp() |
56 | { | 56 | { |
57 | base.SetUp(); | 57 | base.SetUp(); |
58 | 58 | ||
59 | SerialiserModule serialiserModule = new SerialiserModule(); | 59 | SerialiserModule serialiserModule = new SerialiserModule(); |
60 | m_archiverModule = new InventoryArchiverModule(); | 60 | m_archiverModule = new InventoryArchiverModule(); |
61 | 61 | ||
62 | m_scene = new SceneHelpers().SetupScene(); | 62 | m_scene = new SceneHelpers().SetupScene(); |
63 | SceneHelpers.SetupSceneModules(m_scene, serialiserModule, m_archiverModule); | 63 | SceneHelpers.SetupSceneModules(m_scene, serialiserModule, m_archiverModule); |
64 | } | 64 | } |
65 | 65 | ||
66 | /// <summary> | 66 | /// <summary> |
67 | /// Test that the IAR has the required files in the right order. | 67 | /// Test that the IAR has the required files in the right order. |
68 | /// </summary> | 68 | /// </summary> |
@@ -73,20 +73,20 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
73 | public void TestOrder() | 73 | public void TestOrder() |
74 | { | 74 | { |
75 | TestHelpers.InMethod(); | 75 | TestHelpers.InMethod(); |
76 | // log4net.Config.XmlConfigurator.Configure(); | 76 | // log4net.Config.XmlConfigurator.Configure(); |
77 | 77 | ||
78 | MemoryStream archiveReadStream = new MemoryStream(m_iarStreamBytes); | 78 | MemoryStream archiveReadStream = new MemoryStream(m_iarStreamBytes); |
79 | TarArchiveReader tar = new TarArchiveReader(archiveReadStream); | 79 | TarArchiveReader tar = new TarArchiveReader(archiveReadStream); |
80 | string filePath; | 80 | string filePath; |
81 | TarArchiveReader.TarEntryType tarEntryType; | 81 | TarArchiveReader.TarEntryType tarEntryType; |
82 | 82 | ||
83 | byte[] data = tar.ReadEntry(out filePath, out tarEntryType); | 83 | byte[] data = tar.ReadEntry(out filePath, out tarEntryType); |
84 | Assert.That(filePath, Is.EqualTo(ArchiveConstants.CONTROL_FILE_PATH)); | 84 | Assert.That(filePath, Is.EqualTo(ArchiveConstants.CONTROL_FILE_PATH)); |
85 | 85 | ||
86 | InventoryArchiveReadRequest iarr | 86 | InventoryArchiveReadRequest iarr |
87 | = new InventoryArchiveReadRequest(UUID.Random(), null, null, null, null, null, null, (Stream)null, false); | 87 | = new InventoryArchiveReadRequest(UUID.Random(), null, null, null, null, null, null, (Stream)null, false); |
88 | iarr.LoadControlFile(filePath, data); | 88 | iarr.LoadControlFile(filePath, data); |
89 | 89 | ||
90 | Assert.That(iarr.ControlFileLoaded, Is.True); | 90 | Assert.That(iarr.ControlFileLoaded, Is.True); |
91 | } | 91 | } |
92 | 92 | ||
@@ -119,22 +119,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
119 | // InventoryArchiveUtils. | 119 | // InventoryArchiveUtils. |
120 | bool gotObjectsFolder = false; | 120 | bool gotObjectsFolder = false; |
121 | 121 | ||
122 | string objectsFolderName | 122 | string objectsFolderName |
123 | = string.Format( | 123 | = string.Format( |
124 | "{0}{1}", | 124 | "{0}{1}", |
125 | ArchiveConstants.INVENTORY_PATH, | 125 | ArchiveConstants.INVENTORY_PATH, |
126 | InventoryArchiveWriteRequest.CreateArchiveFolderName( | 126 | InventoryArchiveWriteRequest.CreateArchiveFolderName( |
127 | UserInventoryHelpers.GetInventoryFolder(m_scene.InventoryService, userId, "Objects"))); | 127 | UserInventoryHelpers.GetInventoryFolder(m_scene.InventoryService, userId, "Objects"))); |
128 | 128 | ||
129 | string filePath; | 129 | string filePath; |
130 | TarArchiveReader.TarEntryType tarEntryType; | 130 | TarArchiveReader.TarEntryType tarEntryType; |
131 | 131 | ||
132 | while (tar.ReadEntry(out filePath, out tarEntryType) != null) | 132 | while (tar.ReadEntry(out filePath, out tarEntryType) != null) |
133 | { | 133 | { |
134 | // Console.WriteLine("Got {0}", filePath); | 134 | // Console.WriteLine("Got {0}", filePath); |
135 | 135 | ||
136 | // Lazily, we only bother to look for the system objects folder created when we call CreateUserWithInventory() | 136 | // Lazily, we only bother to look for the system objects folder created when we call CreateUserWithInventory() |
137 | // XXX: But really we need to stop all that stuff being created in tests or check for such folders | 137 | // XXX: But really we need to stop all that stuff being created in tests or check for such folders |
138 | // more thoroughly | 138 | // more thoroughly |
139 | if (filePath == objectsFolderName) | 139 | if (filePath == objectsFolderName) |
140 | gotObjectsFolder = true; | 140 | gotObjectsFolder = true; |
@@ -157,19 +157,19 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
157 | UserAccountHelpers.CreateUserWithInventory(m_scene, userFirstName, userLastName, userId, userPassword); | 157 | UserAccountHelpers.CreateUserWithInventory(m_scene, userFirstName, userLastName, userId, userPassword); |
158 | 158 | ||
159 | // Create base folder | 159 | // Create base folder |
160 | InventoryFolderBase f1 | 160 | InventoryFolderBase f1 |
161 | = UserInventoryHelpers.CreateInventoryFolder(m_scene.InventoryService, userId, "f1", true); | 161 | = UserInventoryHelpers.CreateInventoryFolder(m_scene.InventoryService, userId, "f1", true); |
162 | 162 | ||
163 | // Create item1 | 163 | // Create item1 |
164 | SceneObjectGroup so1 = SceneHelpers.CreateSceneObject(1, userId, "My Little Dog Object", 0x5); | 164 | SceneObjectGroup so1 = SceneHelpers.CreateSceneObject(1, userId, "My Little Dog Object", 0x5); |
165 | InventoryItemBase i1 = UserInventoryHelpers.AddInventoryItem(m_scene, so1, 0x50, 0x60, "f1"); | 165 | InventoryItemBase i1 = UserInventoryHelpers.AddInventoryItem(m_scene, so1, 0x50, 0x60, "f1"); |
166 | 166 | ||
167 | // Create embedded folder | 167 | // Create embedded folder |
168 | InventoryFolderBase f1_1 | 168 | InventoryFolderBase f1_1 |
169 | = UserInventoryHelpers.CreateInventoryFolder(m_scene.InventoryService, userId, "f1/f1.1", true); | 169 | = UserInventoryHelpers.CreateInventoryFolder(m_scene.InventoryService, userId, "f1/f1.1", true); |
170 | 170 | ||
171 | // Create embedded item | 171 | // Create embedded item |
172 | SceneObjectGroup so1_1 = SceneHelpers.CreateSceneObject(1, userId, "My Little Cat Object", 0x6); | 172 | SceneObjectGroup so1_1 = SceneHelpers.CreateSceneObject(1, userId, "My Little Cat Object", 0x6); |
173 | InventoryItemBase i2 = UserInventoryHelpers.AddInventoryItem(m_scene, so1_1, 0x500, 0x600, "f1/f1.1"); | 173 | InventoryItemBase i2 = UserInventoryHelpers.AddInventoryItem(m_scene, so1_1, 0x500, 0x600, "f1/f1.1"); |
174 | 174 | ||
175 | MemoryStream archiveWriteStream = new MemoryStream(); | 175 | MemoryStream archiveWriteStream = new MemoryStream(); |
@@ -188,18 +188,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
188 | // InventoryArchiveUtils. | 188 | // InventoryArchiveUtils. |
189 | bool gotf1 = false, gotf1_1 = false, gotso1 = false, gotso2 = false; | 189 | bool gotf1 = false, gotf1_1 = false, gotso1 = false, gotso2 = false; |
190 | 190 | ||
191 | string f1FileName | 191 | string f1FileName |
192 | = string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, InventoryArchiveWriteRequest.CreateArchiveFolderName(f1)); | 192 | = string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, InventoryArchiveWriteRequest.CreateArchiveFolderName(f1)); |
193 | string f1_1FileName | 193 | string f1_1FileName |
194 | = string.Format("{0}{1}", f1FileName, InventoryArchiveWriteRequest.CreateArchiveFolderName(f1_1)); | 194 | = string.Format("{0}{1}", f1FileName, InventoryArchiveWriteRequest.CreateArchiveFolderName(f1_1)); |
195 | string so1FileName | 195 | string so1FileName |
196 | = string.Format("{0}{1}", f1FileName, InventoryArchiveWriteRequest.CreateArchiveItemName(i1)); | 196 | = string.Format("{0}{1}", f1FileName, InventoryArchiveWriteRequest.CreateArchiveItemName(i1)); |
197 | string so2FileName | 197 | string so2FileName |
198 | = string.Format("{0}{1}", f1_1FileName, InventoryArchiveWriteRequest.CreateArchiveItemName(i2)); | 198 | = string.Format("{0}{1}", f1_1FileName, InventoryArchiveWriteRequest.CreateArchiveItemName(i2)); |
199 | 199 | ||
200 | string filePath; | 200 | string filePath; |
201 | TarArchiveReader.TarEntryType tarEntryType; | 201 | TarArchiveReader.TarEntryType tarEntryType; |
202 | 202 | ||
203 | while (tar.ReadEntry(out filePath, out tarEntryType) != null) | 203 | while (tar.ReadEntry(out filePath, out tarEntryType) != null) |
204 | { | 204 | { |
205 | // Console.WriteLine("Got {0}", filePath); | 205 | // Console.WriteLine("Got {0}", filePath); |
@@ -222,7 +222,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
222 | 222 | ||
223 | // TODO: Test presence of more files and contents of files. | 223 | // TODO: Test presence of more files and contents of files. |
224 | } | 224 | } |
225 | 225 | ||
226 | /// <summary> | 226 | /// <summary> |
227 | /// Test saving a single inventory item to an IAR | 227 | /// Test saving a single inventory item to an IAR |
228 | /// (subject to change since there is no fixed format yet). | 228 | /// (subject to change since there is no fixed format yet). |
@@ -239,10 +239,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
239 | string userPassword = "troll"; | 239 | string userPassword = "troll"; |
240 | UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020"); | 240 | UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020"); |
241 | UserAccountHelpers.CreateUserWithInventory(m_scene, userFirstName, userLastName, userId, userPassword); | 241 | UserAccountHelpers.CreateUserWithInventory(m_scene, userFirstName, userLastName, userId, userPassword); |
242 | 242 | ||
243 | // Create asset | 243 | // Create asset |
244 | UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040"); | 244 | UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040"); |
245 | SceneObjectGroup object1 = SceneHelpers.CreateSceneObject(1, ownerId, "My Little Dog Object", 0x50); | 245 | SceneObjectGroup object1 = SceneHelpers.CreateSceneObject(1, ownerId, "My Little Dog Object", 0x50); |
246 | 246 | ||
247 | UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060"); | 247 | UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060"); |
248 | AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1); | 248 | AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1); |
@@ -255,7 +255,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
255 | item1.Name = item1Name; | 255 | item1.Name = item1Name; |
256 | item1.AssetID = asset1.FullID; | 256 | item1.AssetID = asset1.FullID; |
257 | item1.ID = item1Id; | 257 | item1.ID = item1Id; |
258 | InventoryFolderBase objsFolder | 258 | InventoryFolderBase objsFolder |
259 | = InventoryArchiveUtils.FindFoldersByPath(m_scene.InventoryService, userId, "Objects")[0]; | 259 | = InventoryArchiveUtils.FindFoldersByPath(m_scene.InventoryService, userId, "Objects")[0]; |
260 | item1.Folder = objsFolder.ID; | 260 | item1.Folder = objsFolder.ID; |
261 | m_scene.AddInventoryItem(item1); | 261 | m_scene.AddInventoryItem(item1); |
@@ -285,7 +285,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
285 | TarArchiveReader.TarEntryType tarEntryType; | 285 | TarArchiveReader.TarEntryType tarEntryType; |
286 | 286 | ||
287 | // Console.WriteLine("Reading archive"); | 287 | // Console.WriteLine("Reading archive"); |
288 | 288 | ||
289 | while (tar.ReadEntry(out filePath, out tarEntryType) != null) | 289 | while (tar.ReadEntry(out filePath, out tarEntryType) != null) |
290 | { | 290 | { |
291 | Console.WriteLine("Got {0}", filePath); | 291 | Console.WriteLine("Got {0}", filePath); |
@@ -294,7 +294,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
294 | // { | 294 | // { |
295 | // gotControlFile = true; | 295 | // gotControlFile = true; |
296 | // } | 296 | // } |
297 | 297 | ||
298 | if (filePath.StartsWith(ArchiveConstants.INVENTORY_PATH) && filePath.EndsWith(".xml")) | 298 | if (filePath.StartsWith(ArchiveConstants.INVENTORY_PATH) && filePath.EndsWith(".xml")) |
299 | { | 299 | { |
300 | // string fileName = filePath.Remove(0, "Objects/".Length); | 300 | // string fileName = filePath.Remove(0, "Objects/".Length); |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs index 519c697..0b65829 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs | |||
@@ -49,35 +49,35 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
49 | public class InventoryArchiveTestCase : OpenSimTestCase | 49 | public class InventoryArchiveTestCase : OpenSimTestCase |
50 | { | 50 | { |
51 | protected ManualResetEvent mre = new ManualResetEvent(false); | 51 | protected ManualResetEvent mre = new ManualResetEvent(false); |
52 | 52 | ||
53 | /// <summary> | 53 | /// <summary> |
54 | /// A raw array of bytes that we'll use to create an IAR memory stream suitable for isolated use in each test. | 54 | /// A raw array of bytes that we'll use to create an IAR memory stream suitable for isolated use in each test. |
55 | /// </summary> | 55 | /// </summary> |
56 | protected byte[] m_iarStreamBytes; | 56 | protected byte[] m_iarStreamBytes; |
57 | 57 | ||
58 | /// <summary> | 58 | /// <summary> |
59 | /// Stream of data representing a common IAR for load tests. | 59 | /// Stream of data representing a common IAR for load tests. |
60 | /// </summary> | 60 | /// </summary> |
61 | protected MemoryStream m_iarStream; | 61 | protected MemoryStream m_iarStream; |
62 | 62 | ||
63 | protected UserAccount m_uaMT | 63 | protected UserAccount m_uaMT |
64 | = new UserAccount { | 64 | = new UserAccount { |
65 | PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000555"), | 65 | PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000555"), |
66 | FirstName = "Mr", | 66 | FirstName = "Mr", |
67 | LastName = "Tiddles" }; | 67 | LastName = "Tiddles" }; |
68 | 68 | ||
69 | protected UserAccount m_uaLL1 | 69 | protected UserAccount m_uaLL1 |
70 | = new UserAccount { | 70 | = new UserAccount { |
71 | PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000666"), | 71 | PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000666"), |
72 | FirstName = "Lord", | 72 | FirstName = "Lord", |
73 | LastName = "Lucan" }; | 73 | LastName = "Lucan" }; |
74 | 74 | ||
75 | protected UserAccount m_uaLL2 | 75 | protected UserAccount m_uaLL2 |
76 | = new UserAccount { | 76 | = new UserAccount { |
77 | PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000777"), | 77 | PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000777"), |
78 | FirstName = "Lord", | 78 | FirstName = "Lord", |
79 | LastName = "Lucan" }; | 79 | LastName = "Lucan" }; |
80 | 80 | ||
81 | protected string m_item1Name = "Ray Gun Item"; | 81 | protected string m_item1Name = "Ray Gun Item"; |
82 | protected string m_coaItemName = "Coalesced Item"; | 82 | protected string m_coaItemName = "Coalesced Item"; |
83 | 83 | ||
@@ -105,72 +105,72 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
105 | base.SetUp(); | 105 | base.SetUp(); |
106 | m_iarStream = new MemoryStream(m_iarStreamBytes); | 106 | m_iarStream = new MemoryStream(m_iarStreamBytes); |
107 | } | 107 | } |
108 | 108 | ||
109 | protected void ConstructDefaultIarBytesForTestLoad() | 109 | protected void ConstructDefaultIarBytesForTestLoad() |
110 | { | 110 | { |
111 | // log4net.Config.XmlConfigurator.Configure(); | 111 | // log4net.Config.XmlConfigurator.Configure(); |
112 | 112 | ||
113 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(); | 113 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(); |
114 | Scene scene = new SceneHelpers().SetupScene(); | 114 | Scene scene = new SceneHelpers().SetupScene(); |
115 | SceneHelpers.SetupSceneModules(scene, archiverModule); | 115 | SceneHelpers.SetupSceneModules(scene, archiverModule); |
116 | 116 | ||
117 | UserAccountHelpers.CreateUserWithInventory(scene, m_uaLL1, "hampshire"); | 117 | UserAccountHelpers.CreateUserWithInventory(scene, m_uaLL1, "hampshire"); |
118 | 118 | ||
119 | MemoryStream archiveWriteStream = new MemoryStream(); | 119 | MemoryStream archiveWriteStream = new MemoryStream(); |
120 | 120 | ||
121 | // Create scene object asset | 121 | // Create scene object asset |
122 | UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040"); | 122 | UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040"); |
123 | SceneObjectGroup object1 = SceneHelpers.CreateSceneObject(1, ownerId, "Ray Gun Object", 0x50); | 123 | SceneObjectGroup object1 = SceneHelpers.CreateSceneObject(1, ownerId, "Ray Gun Object", 0x50); |
124 | 124 | ||
125 | UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060"); | 125 | UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060"); |
126 | AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1); | 126 | AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1); |
127 | scene.AssetService.Store(asset1); | 127 | scene.AssetService.Store(asset1); |
128 | 128 | ||
129 | // Create scene object item | 129 | // Create scene object item |
130 | InventoryItemBase item1 = new InventoryItemBase(); | 130 | InventoryItemBase item1 = new InventoryItemBase(); |
131 | item1.Name = m_item1Name; | 131 | item1.Name = m_item1Name; |
132 | item1.ID = UUID.Parse("00000000-0000-0000-0000-000000000020"); | 132 | item1.ID = UUID.Parse("00000000-0000-0000-0000-000000000020"); |
133 | item1.AssetID = asset1.FullID; | 133 | item1.AssetID = asset1.FullID; |
134 | item1.GroupID = UUID.Random(); | 134 | item1.GroupID = UUID.Random(); |
135 | item1.CreatorId = m_uaLL1.PrincipalID.ToString(); | 135 | item1.CreatorId = m_uaLL1.PrincipalID.ToString(); |
136 | item1.Owner = m_uaLL1.PrincipalID; | 136 | item1.Owner = m_uaLL1.PrincipalID; |
137 | item1.Folder = scene.InventoryService.GetRootFolder(m_uaLL1.PrincipalID).ID; | 137 | item1.Folder = scene.InventoryService.GetRootFolder(m_uaLL1.PrincipalID).ID; |
138 | scene.AddInventoryItem(item1); | 138 | scene.AddInventoryItem(item1); |
139 | 139 | ||
140 | // Create coalesced objects asset | 140 | // Create coalesced objects asset |
141 | SceneObjectGroup cobj1 = SceneHelpers.CreateSceneObject(1, m_uaLL1.PrincipalID, "Object1", 0x120); | 141 | SceneObjectGroup cobj1 = SceneHelpers.CreateSceneObject(1, m_uaLL1.PrincipalID, "Object1", 0x120); |
142 | cobj1.AbsolutePosition = new Vector3(15, 30, 45); | 142 | cobj1.AbsolutePosition = new Vector3(15, 30, 45); |
143 | 143 | ||
144 | SceneObjectGroup cobj2 = SceneHelpers.CreateSceneObject(1, m_uaLL1.PrincipalID, "Object2", 0x140); | 144 | SceneObjectGroup cobj2 = SceneHelpers.CreateSceneObject(1, m_uaLL1.PrincipalID, "Object2", 0x140); |
145 | cobj2.AbsolutePosition = new Vector3(25, 50, 75); | 145 | cobj2.AbsolutePosition = new Vector3(25, 50, 75); |
146 | 146 | ||
147 | CoalescedSceneObjects coa = new CoalescedSceneObjects(m_uaLL1.PrincipalID, cobj1, cobj2); | 147 | CoalescedSceneObjects coa = new CoalescedSceneObjects(m_uaLL1.PrincipalID, cobj1, cobj2); |
148 | 148 | ||
149 | AssetBase coaAsset = AssetHelpers.CreateAsset(0x160, coa); | 149 | AssetBase coaAsset = AssetHelpers.CreateAsset(0x160, coa); |
150 | scene.AssetService.Store(coaAsset); | 150 | scene.AssetService.Store(coaAsset); |
151 | 151 | ||
152 | // Create coalesced objects inventory item | 152 | // Create coalesced objects inventory item |
153 | InventoryItemBase coaItem = new InventoryItemBase(); | 153 | InventoryItemBase coaItem = new InventoryItemBase(); |
154 | coaItem.Name = m_coaItemName; | 154 | coaItem.Name = m_coaItemName; |
155 | coaItem.ID = UUID.Parse("00000000-0000-0000-0000-000000000180"); | 155 | coaItem.ID = UUID.Parse("00000000-0000-0000-0000-000000000180"); |
156 | coaItem.AssetID = coaAsset.FullID; | 156 | coaItem.AssetID = coaAsset.FullID; |
157 | coaItem.GroupID = UUID.Random(); | 157 | coaItem.GroupID = UUID.Random(); |
158 | coaItem.CreatorId = m_uaLL1.PrincipalID.ToString(); | 158 | coaItem.CreatorId = m_uaLL1.PrincipalID.ToString(); |
159 | coaItem.Owner = m_uaLL1.PrincipalID; | 159 | coaItem.Owner = m_uaLL1.PrincipalID; |
160 | coaItem.Folder = scene.InventoryService.GetRootFolder(m_uaLL1.PrincipalID).ID; | 160 | coaItem.Folder = scene.InventoryService.GetRootFolder(m_uaLL1.PrincipalID).ID; |
161 | scene.AddInventoryItem(coaItem); | 161 | scene.AddInventoryItem(coaItem); |
162 | 162 | ||
163 | archiverModule.ArchiveInventory( | 163 | archiverModule.ArchiveInventory( |
164 | UUID.Random(), m_uaLL1.FirstName, m_uaLL1.LastName, "/*", "hampshire", archiveWriteStream); | 164 | UUID.Random(), m_uaLL1.FirstName, m_uaLL1.LastName, "/*", "hampshire", archiveWriteStream); |
165 | 165 | ||
166 | m_iarStreamBytes = archiveWriteStream.ToArray(); | 166 | m_iarStreamBytes = archiveWriteStream.ToArray(); |
167 | } | 167 | } |
168 | 168 | ||
169 | protected void SaveCompleted( | 169 | protected void SaveCompleted( |
170 | UUID id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream, | 170 | UUID id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream, |
171 | Exception reportedException, int SaveCount, int FilterCount) | 171 | Exception reportedException, int SaveCount, int FilterCount) |
172 | { | 172 | { |
173 | mre.Set(); | 173 | mre.Set(); |
174 | } | 174 | } |
175 | } | 175 | } |
176 | } \ No newline at end of file | 176 | } \ No newline at end of file |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs index 46da5a9..5d7f25c 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs | |||
@@ -149,10 +149,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
149 | private void OnInstantMessage(IClientAPI client, GridInstantMessage im) | 149 | private void OnInstantMessage(IClientAPI client, GridInstantMessage im) |
150 | { | 150 | { |
151 | // m_log.DebugFormat( | 151 | // m_log.DebugFormat( |
152 | // "[INVENTORY TRANSFER]: {0} IM type received from client {1}. From={2} ({3}), To={4}", | 152 | // "[INVENTORY TRANSFER]: {0} IM type received from client {1}. From={2} ({3}), To={4}", |
153 | // (InstantMessageDialog)im.dialog, client.Name, | 153 | // (InstantMessageDialog)im.dialog, client.Name, |
154 | // im.fromAgentID, im.fromAgentName, im.toAgentID); | 154 | // im.fromAgentID, im.fromAgentName, im.toAgentID); |
155 | 155 | ||
156 | Scene scene = FindClientScene(client.AgentId); | 156 | Scene scene = FindClientScene(client.AgentId); |
157 | 157 | ||
158 | if (scene == null) // Something seriously wrong here. | 158 | if (scene == null) // Something seriously wrong here. |
@@ -164,31 +164,31 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
164 | 164 | ||
165 | if (im.binaryBucket.Length < 17) // Invalid | 165 | if (im.binaryBucket.Length < 17) // Invalid |
166 | return; | 166 | return; |
167 | 167 | ||
168 | UUID recipientID = new UUID(im.toAgentID); | 168 | UUID recipientID = new UUID(im.toAgentID); |
169 | ScenePresence user = scene.GetScenePresence(recipientID); | 169 | ScenePresence user = scene.GetScenePresence(recipientID); |
170 | UUID copyID; | 170 | UUID copyID; |
171 | 171 | ||
172 | // First byte is the asset type | 172 | // First byte is the asset type |
173 | AssetType assetType = (AssetType)im.binaryBucket[0]; | 173 | AssetType assetType = (AssetType)im.binaryBucket[0]; |
174 | 174 | ||
175 | if (AssetType.Folder == assetType) | 175 | if (AssetType.Folder == assetType) |
176 | { | 176 | { |
177 | UUID folderID = new UUID(im.binaryBucket, 1); | 177 | UUID folderID = new UUID(im.binaryBucket, 1); |
178 | 178 | ||
179 | m_log.DebugFormat( | 179 | m_log.DebugFormat( |
180 | "[INVENTORY TRANSFER]: Inserting original folder {0} into agent {1}'s inventory", | 180 | "[INVENTORY TRANSFER]: Inserting original folder {0} into agent {1}'s inventory", |
181 | folderID, new UUID(im.toAgentID)); | 181 | folderID, new UUID(im.toAgentID)); |
182 | 182 | ||
183 | InventoryFolderBase folderCopy | 183 | InventoryFolderBase folderCopy |
184 | = scene.GiveInventoryFolder(client, recipientID, client.AgentId, folderID, UUID.Zero); | 184 | = scene.GiveInventoryFolder(client, recipientID, client.AgentId, folderID, UUID.Zero); |
185 | 185 | ||
186 | if (folderCopy == null) | 186 | if (folderCopy == null) |
187 | { | 187 | { |
188 | client.SendAgentAlertMessage("Can't find folder to give. Nothing given.", false); | 188 | client.SendAgentAlertMessage("Can't find folder to give. Nothing given.", false); |
189 | return; | 189 | return; |
190 | } | 190 | } |
191 | 191 | ||
192 | // The outgoing binary bucket should contain only the byte which signals an asset folder is | 192 | // The outgoing binary bucket should contain only the byte which signals an asset folder is |
193 | // being copied and the following bytes for the copied folder's UUID | 193 | // being copied and the following bytes for the copied folder's UUID |
194 | copyID = folderCopy.ID; | 194 | copyID = folderCopy.ID; |
@@ -196,7 +196,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
196 | im.binaryBucket = new byte[1 + copyIDBytes.Length]; | 196 | im.binaryBucket = new byte[1 + copyIDBytes.Length]; |
197 | im.binaryBucket[0] = (byte)AssetType.Folder; | 197 | im.binaryBucket[0] = (byte)AssetType.Folder; |
198 | Array.Copy(copyIDBytes, 0, im.binaryBucket, 1, copyIDBytes.Length); | 198 | Array.Copy(copyIDBytes, 0, im.binaryBucket, 1, copyIDBytes.Length); |
199 | 199 | ||
200 | if (user != null) | 200 | if (user != null) |
201 | user.ControllingClient.SendBulkUpdateInventory(folderCopy); | 201 | user.ControllingClient.SendBulkUpdateInventory(folderCopy); |
202 | 202 | ||
@@ -225,10 +225,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
225 | client.SendAgentAlertMessage(message, false); | 225 | client.SendAgentAlertMessage(message, false); |
226 | return; | 226 | return; |
227 | } | 227 | } |
228 | 228 | ||
229 | copyID = itemCopy.ID; | 229 | copyID = itemCopy.ID; |
230 | Array.Copy(copyID.GetBytes(), 0, im.binaryBucket, 1, 16); | 230 | Array.Copy(copyID.GetBytes(), 0, im.binaryBucket, 1, 16); |
231 | 231 | ||
232 | if (user != null) | 232 | if (user != null) |
233 | user.ControllingClient.SendBulkUpdateInventory(itemCopy); | 233 | user.ControllingClient.SendBulkUpdateInventory(itemCopy); |
234 | 234 | ||
@@ -253,7 +253,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
253 | else | 253 | else |
254 | { | 254 | { |
255 | if (m_TransferModule != null) | 255 | if (m_TransferModule != null) |
256 | m_TransferModule.SendInstantMessage(im, delegate(bool success) | 256 | m_TransferModule.SendInstantMessage(im, delegate(bool success) |
257 | { | 257 | { |
258 | if (!success) | 258 | if (!success) |
259 | client.SendAlertMessage("User not online. Inventory has been saved"); | 259 | client.SendAlertMessage("User not online. Inventory has been saved"); |
@@ -308,8 +308,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
308 | } | 308 | } |
309 | 309 | ||
310 | // XXX: This code was placed here to try and accomodate RLV which moves given folders named #RLV/~<name> | 310 | // XXX: This code was placed here to try and accomodate RLV which moves given folders named #RLV/~<name> |
311 | // to the requested folder, which in this case is #RLV. However, it is the viewer that appears to be | 311 | // to the requested folder, which in this case is #RLV. However, it is the viewer that appears to be |
312 | // response from renaming the #RLV/~example folder to ~example. For some reason this is not yet | 312 | // response from renaming the #RLV/~example folder to ~example. For some reason this is not yet |
313 | // happening, possibly because we are not sending the correct inventory update messages with the correct | 313 | // happening, possibly because we are not sending the correct inventory update messages with the correct |
314 | // transaction IDs | 314 | // transaction IDs |
315 | else if (im.dialog == (byte) InstantMessageDialog.TaskInventoryAccepted) | 315 | else if (im.dialog == (byte) InstantMessageDialog.TaskInventoryAccepted) |
@@ -380,7 +380,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
380 | InventoryItemBase item = invService.GetItem(client.AgentId, inventoryID); | 380 | InventoryItemBase item = invService.GetItem(client.AgentId, inventoryID); |
381 | InventoryFolderBase folder = null; | 381 | InventoryFolderBase folder = null; |
382 | UUID? previousParentFolderID = null; | 382 | UUID? previousParentFolderID = null; |
383 | 383 | ||
384 | if (item != null && trashFolder != null) | 384 | if (item != null && trashFolder != null) |
385 | { | 385 | { |
386 | previousParentFolderID = item.Folder; | 386 | previousParentFolderID = item.Folder; |
@@ -404,18 +404,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
404 | client.SendBulkUpdateInventory(folder); | 404 | client.SendBulkUpdateInventory(folder); |
405 | } | 405 | } |
406 | } | 406 | } |
407 | 407 | ||
408 | if ((null == item && null == folder) | null == trashFolder) | 408 | if ((null == item && null == folder) | null == trashFolder) |
409 | { | 409 | { |
410 | string reason = String.Empty; | 410 | string reason = String.Empty; |
411 | 411 | ||
412 | if (trashFolder == null) | 412 | if (trashFolder == null) |
413 | reason += " Trash folder not found."; | 413 | reason += " Trash folder not found."; |
414 | if (item == null) | 414 | if (item == null) |
415 | reason += " Item not found."; | 415 | reason += " Item not found."; |
416 | if (folder == null) | 416 | if (folder == null) |
417 | reason += " Folder not found."; | 417 | reason += " Folder not found."; |
418 | 418 | ||
419 | client.SendAgentAlertMessage("Unable to delete "+ | 419 | client.SendAgentAlertMessage("Unable to delete "+ |
420 | "received inventory" + reason, false); | 420 | "received inventory" + reason, false); |
421 | } | 421 | } |
@@ -471,12 +471,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
471 | { | 471 | { |
472 | if (im.binaryBucket.Length < 17) // Invalid | 472 | if (im.binaryBucket.Length < 17) // Invalid |
473 | return; | 473 | return; |
474 | 474 | ||
475 | UUID recipientID = new UUID(im.toAgentID); | 475 | UUID recipientID = new UUID(im.toAgentID); |
476 | 476 | ||
477 | // First byte is the asset type | 477 | // First byte is the asset type |
478 | AssetType assetType = (AssetType)im.binaryBucket[0]; | 478 | AssetType assetType = (AssetType)im.binaryBucket[0]; |
479 | 479 | ||
480 | if (AssetType.Folder == assetType) | 480 | if (AssetType.Folder == assetType) |
481 | { | 481 | { |
482 | UUID folderID = new UUID(im.binaryBucket, 1); | 482 | UUID folderID = new UUID(im.binaryBucket, 1); |
@@ -505,12 +505,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
505 | { | 505 | { |
506 | if (im.binaryBucket.Length < 1) // Invalid | 506 | if (im.binaryBucket.Length < 1) // Invalid |
507 | return; | 507 | return; |
508 | 508 | ||
509 | UUID recipientID = new UUID(im.toAgentID); | 509 | UUID recipientID = new UUID(im.toAgentID); |
510 | 510 | ||
511 | // Bucket is the asset type | 511 | // Bucket is the asset type |
512 | AssetType assetType = (AssetType)im.binaryBucket[0]; | 512 | AssetType assetType = (AssetType)im.binaryBucket[0]; |
513 | 513 | ||
514 | if (AssetType.Folder == assetType) | 514 | if (AssetType.Folder == assetType) |
515 | { | 515 | { |
516 | UUID folderID = new UUID(im.imSessionID); | 516 | UUID folderID = new UUID(im.imSessionID); |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/Tests/InventoryTransferModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/Tests/InventoryTransferModuleTests.cs index 7ddc396..82ed091 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/Tests/InventoryTransferModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/Tests/InventoryTransferModuleTests.cs | |||
@@ -44,9 +44,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer.Tests | |||
44 | { | 44 | { |
45 | [TestFixture] | 45 | [TestFixture] |
46 | public class InventoryTransferModuleTests : OpenSimTestCase | 46 | public class InventoryTransferModuleTests : OpenSimTestCase |
47 | { | 47 | { |
48 | protected TestScene m_scene; | 48 | protected TestScene m_scene; |
49 | 49 | ||
50 | [SetUp] | 50 | [SetUp] |
51 | public override void SetUp() | 51 | public override void SetUp() |
52 | { | 52 | { |
@@ -56,9 +56,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer.Tests | |||
56 | config.AddConfig("Messaging"); | 56 | config.AddConfig("Messaging"); |
57 | config.Configs["Messaging"].Set("InventoryTransferModule", "InventoryTransferModule"); | 57 | config.Configs["Messaging"].Set("InventoryTransferModule", "InventoryTransferModule"); |
58 | 58 | ||
59 | m_scene = new SceneHelpers().SetupScene(); | 59 | m_scene = new SceneHelpers().SetupScene(); |
60 | SceneHelpers.SetupSceneModules(m_scene, config, new InventoryTransferModule()); | 60 | SceneHelpers.SetupSceneModules(m_scene, config, new InventoryTransferModule()); |
61 | } | 61 | } |
62 | 62 | ||
63 | [Test] | 63 | [Test] |
64 | public void TestAcceptGivenItem() | 64 | public void TestAcceptGivenItem() |
@@ -69,9 +69,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer.Tests | |||
69 | UUID itemId = TestHelpers.ParseTail(0x100); | 69 | UUID itemId = TestHelpers.ParseTail(0x100); |
70 | UUID assetId = TestHelpers.ParseTail(0x200); | 70 | UUID assetId = TestHelpers.ParseTail(0x200); |
71 | 71 | ||
72 | UserAccount ua1 | 72 | UserAccount ua1 |
73 | = UserAccountHelpers.CreateUserWithInventory(m_scene, "User", "One", TestHelpers.ParseTail(0x1), "pw"); | 73 | = UserAccountHelpers.CreateUserWithInventory(m_scene, "User", "One", TestHelpers.ParseTail(0x1), "pw"); |
74 | UserAccount ua2 | 74 | UserAccount ua2 |
75 | = UserAccountHelpers.CreateUserWithInventory(m_scene, "User", "Two", TestHelpers.ParseTail(0x2), "pw"); | 75 | = UserAccountHelpers.CreateUserWithInventory(m_scene, "User", "Two", TestHelpers.ParseTail(0x2), "pw"); |
76 | 76 | ||
77 | ScenePresence giverSp = SceneHelpers.AddScenePresence(m_scene, ua1); | 77 | ScenePresence giverSp = SceneHelpers.AddScenePresence(m_scene, ua1); |
@@ -81,7 +81,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer.Tests | |||
81 | TestClient receiverClient = (TestClient)receiverSp.ControllingClient; | 81 | TestClient receiverClient = (TestClient)receiverSp.ControllingClient; |
82 | 82 | ||
83 | // Create the object to test give | 83 | // Create the object to test give |
84 | InventoryItemBase originalItem | 84 | InventoryItemBase originalItem |
85 | = UserInventoryHelpers.CreateInventoryItem( | 85 | = UserInventoryHelpers.CreateInventoryItem( |
86 | m_scene, "givenObj", itemId, assetId, giverSp.UUID, InventoryType.Object); | 86 | m_scene, "givenObj", itemId, assetId, giverSp.UUID, InventoryType.Object); |
87 | 87 | ||
@@ -89,35 +89,35 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer.Tests | |||
89 | byte[] itemIdBytes = itemId.GetBytes(); | 89 | byte[] itemIdBytes = itemId.GetBytes(); |
90 | Array.Copy(itemIdBytes, 0, giveImBinaryBucket, 1, itemIdBytes.Length); | 90 | Array.Copy(itemIdBytes, 0, giveImBinaryBucket, 1, itemIdBytes.Length); |
91 | 91 | ||
92 | GridInstantMessage giveIm | 92 | GridInstantMessage giveIm |
93 | = new GridInstantMessage( | 93 | = new GridInstantMessage( |
94 | m_scene, | 94 | m_scene, |
95 | giverSp.UUID, | 95 | giverSp.UUID, |
96 | giverSp.Name, | 96 | giverSp.Name, |
97 | receiverSp.UUID, | 97 | receiverSp.UUID, |
98 | (byte)InstantMessageDialog.InventoryOffered, | 98 | (byte)InstantMessageDialog.InventoryOffered, |
99 | false, | 99 | false, |
100 | "inventory offered msg", | 100 | "inventory offered msg", |
101 | initialSessionId, | 101 | initialSessionId, |
102 | false, | 102 | false, |
103 | Vector3.Zero, | 103 | Vector3.Zero, |
104 | giveImBinaryBucket, | 104 | giveImBinaryBucket, |
105 | true); | 105 | true); |
106 | 106 | ||
107 | giverClient.HandleImprovedInstantMessage(giveIm); | 107 | giverClient.HandleImprovedInstantMessage(giveIm); |
108 | 108 | ||
109 | // These details might not all be correct. | 109 | // These details might not all be correct. |
110 | GridInstantMessage acceptIm | 110 | GridInstantMessage acceptIm |
111 | = new GridInstantMessage( | 111 | = new GridInstantMessage( |
112 | m_scene, | 112 | m_scene, |
113 | receiverSp.UUID, | 113 | receiverSp.UUID, |
114 | receiverSp.Name, | 114 | receiverSp.Name, |
115 | giverSp.UUID, | 115 | giverSp.UUID, |
116 | (byte)InstantMessageDialog.InventoryAccepted, | 116 | (byte)InstantMessageDialog.InventoryAccepted, |
117 | false, | 117 | false, |
118 | "inventory accepted msg", | 118 | "inventory accepted msg", |
119 | initialSessionId, | 119 | initialSessionId, |
120 | false, | 120 | false, |
121 | Vector3.Zero, | 121 | Vector3.Zero, |
122 | null, | 122 | null, |
123 | true); | 123 | true); |
@@ -133,7 +133,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer.Tests | |||
133 | Assert.That(originalItemAfterGive.ID, Is.EqualTo(originalItem.ID)); | 133 | Assert.That(originalItemAfterGive.ID, Is.EqualTo(originalItem.ID)); |
134 | 134 | ||
135 | // Test for item successfully making it into the receiver's inventory | 135 | // Test for item successfully making it into the receiver's inventory |
136 | InventoryItemBase receivedItem | 136 | InventoryItemBase receivedItem |
137 | = UserInventoryHelpers.GetInventoryItem(m_scene.InventoryService, receiverSp.UUID, "Objects/givenObj"); | 137 | = UserInventoryHelpers.GetInventoryItem(m_scene.InventoryService, receiverSp.UUID, "Objects/givenObj"); |
138 | 138 | ||
139 | Assert.That(receivedItem, Is.Not.Null); | 139 | Assert.That(receivedItem, Is.Not.Null); |
@@ -148,7 +148,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer.Tests | |||
148 | Assert.That(originalItemAfterDelete, Is.Not.Null); | 148 | Assert.That(originalItemAfterDelete, Is.Not.Null); |
149 | 149 | ||
150 | // TODO: Test scenario where giver deletes their item first. | 150 | // TODO: Test scenario where giver deletes their item first. |
151 | } | 151 | } |
152 | 152 | ||
153 | /// <summary> | 153 | /// <summary> |
154 | /// Test user rejection of a given item. | 154 | /// Test user rejection of a given item. |
@@ -165,9 +165,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer.Tests | |||
165 | UUID itemId = TestHelpers.ParseTail(0x100); | 165 | UUID itemId = TestHelpers.ParseTail(0x100); |
166 | UUID assetId = TestHelpers.ParseTail(0x200); | 166 | UUID assetId = TestHelpers.ParseTail(0x200); |
167 | 167 | ||
168 | UserAccount ua1 | 168 | UserAccount ua1 |
169 | = UserAccountHelpers.CreateUserWithInventory(m_scene, "User", "One", TestHelpers.ParseTail(0x1), "pw"); | 169 | = UserAccountHelpers.CreateUserWithInventory(m_scene, "User", "One", TestHelpers.ParseTail(0x1), "pw"); |
170 | UserAccount ua2 | 170 | UserAccount ua2 |
171 | = UserAccountHelpers.CreateUserWithInventory(m_scene, "User", "Two", TestHelpers.ParseTail(0x2), "pw"); | 171 | = UserAccountHelpers.CreateUserWithInventory(m_scene, "User", "Two", TestHelpers.ParseTail(0x2), "pw"); |
172 | 172 | ||
173 | ScenePresence giverSp = SceneHelpers.AddScenePresence(m_scene, ua1); | 173 | ScenePresence giverSp = SceneHelpers.AddScenePresence(m_scene, ua1); |
@@ -177,7 +177,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer.Tests | |||
177 | TestClient receiverClient = (TestClient)receiverSp.ControllingClient; | 177 | TestClient receiverClient = (TestClient)receiverSp.ControllingClient; |
178 | 178 | ||
179 | // Create the object to test give | 179 | // Create the object to test give |
180 | InventoryItemBase originalItem | 180 | InventoryItemBase originalItem |
181 | = UserInventoryHelpers.CreateInventoryItem( | 181 | = UserInventoryHelpers.CreateInventoryItem( |
182 | m_scene, "givenObj", itemId, assetId, giverSp.UUID, InventoryType.Object); | 182 | m_scene, "givenObj", itemId, assetId, giverSp.UUID, InventoryType.Object); |
183 | 183 | ||
@@ -188,36 +188,36 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer.Tests | |||
188 | byte[] itemIdBytes = itemId.GetBytes(); | 188 | byte[] itemIdBytes = itemId.GetBytes(); |
189 | Array.Copy(itemIdBytes, 0, giveImBinaryBucket, 1, itemIdBytes.Length); | 189 | Array.Copy(itemIdBytes, 0, giveImBinaryBucket, 1, itemIdBytes.Length); |
190 | 190 | ||
191 | GridInstantMessage giveIm | 191 | GridInstantMessage giveIm |
192 | = new GridInstantMessage( | 192 | = new GridInstantMessage( |
193 | m_scene, | 193 | m_scene, |
194 | giverSp.UUID, | 194 | giverSp.UUID, |
195 | giverSp.Name, | 195 | giverSp.Name, |
196 | receiverSp.UUID, | 196 | receiverSp.UUID, |
197 | (byte)InstantMessageDialog.InventoryOffered, | 197 | (byte)InstantMessageDialog.InventoryOffered, |
198 | false, | 198 | false, |
199 | "inventory offered msg", | 199 | "inventory offered msg", |
200 | initialSessionId, | 200 | initialSessionId, |
201 | false, | 201 | false, |
202 | Vector3.Zero, | 202 | Vector3.Zero, |
203 | giveImBinaryBucket, | 203 | giveImBinaryBucket, |
204 | true); | 204 | true); |
205 | 205 | ||
206 | giverClient.HandleImprovedInstantMessage(giveIm); | 206 | giverClient.HandleImprovedInstantMessage(giveIm); |
207 | 207 | ||
208 | // These details might not all be correct. | 208 | // These details might not all be correct. |
209 | // Session ID is now the created item ID (!) | 209 | // Session ID is now the created item ID (!) |
210 | GridInstantMessage rejectIm | 210 | GridInstantMessage rejectIm |
211 | = new GridInstantMessage( | 211 | = new GridInstantMessage( |
212 | m_scene, | 212 | m_scene, |
213 | receiverSp.UUID, | 213 | receiverSp.UUID, |
214 | receiverSp.Name, | 214 | receiverSp.Name, |
215 | giverSp.UUID, | 215 | giverSp.UUID, |
216 | (byte)InstantMessageDialog.InventoryDeclined, | 216 | (byte)InstantMessageDialog.InventoryDeclined, |
217 | false, | 217 | false, |
218 | "inventory declined msg", | 218 | "inventory declined msg", |
219 | new UUID(receivedIm.imSessionID), | 219 | new UUID(receivedIm.imSessionID), |
220 | false, | 220 | false, |
221 | Vector3.Zero, | 221 | Vector3.Zero, |
222 | null, | 222 | null, |
223 | true); | 223 | true); |
@@ -233,7 +233,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer.Tests | |||
233 | Assert.That(originalItemAfterGive.ID, Is.EqualTo(originalItem.ID)); | 233 | Assert.That(originalItemAfterGive.ID, Is.EqualTo(originalItem.ID)); |
234 | 234 | ||
235 | // Test for item successfully making it into the receiver's inventory | 235 | // Test for item successfully making it into the receiver's inventory |
236 | InventoryItemBase receivedItem | 236 | InventoryItemBase receivedItem |
237 | = UserInventoryHelpers.GetInventoryItem(m_scene.InventoryService, receiverSp.UUID, "Trash/givenObj"); | 237 | = UserInventoryHelpers.GetInventoryItem(m_scene.InventoryService, receiverSp.UUID, "Trash/givenObj"); |
238 | 238 | ||
239 | InventoryFolderBase trashFolder | 239 | InventoryFolderBase trashFolder |
@@ -250,7 +250,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer.Tests | |||
250 | = UserInventoryHelpers.GetInventoryItem(m_scene.InventoryService, giverSp.UUID, "Objects/givenObj"); | 250 | = UserInventoryHelpers.GetInventoryItem(m_scene.InventoryService, giverSp.UUID, "Objects/givenObj"); |
251 | 251 | ||
252 | Assert.That(originalItemAfterDelete, Is.Not.Null); | 252 | Assert.That(originalItemAfterDelete, Is.Not.Null); |
253 | } | 253 | } |
254 | 254 | ||
255 | [Test] | 255 | [Test] |
256 | public void TestAcceptGivenFolder() | 256 | public void TestAcceptGivenFolder() |
@@ -261,9 +261,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer.Tests | |||
261 | UUID initialSessionId = TestHelpers.ParseTail(0x10); | 261 | UUID initialSessionId = TestHelpers.ParseTail(0x10); |
262 | UUID folderId = TestHelpers.ParseTail(0x100); | 262 | UUID folderId = TestHelpers.ParseTail(0x100); |
263 | 263 | ||
264 | UserAccount ua1 | 264 | UserAccount ua1 |
265 | = UserAccountHelpers.CreateUserWithInventory(m_scene, "User", "One", TestHelpers.ParseTail(0x1), "pw"); | 265 | = UserAccountHelpers.CreateUserWithInventory(m_scene, "User", "One", TestHelpers.ParseTail(0x1), "pw"); |
266 | UserAccount ua2 | 266 | UserAccount ua2 |
267 | = UserAccountHelpers.CreateUserWithInventory(m_scene, "User", "Two", TestHelpers.ParseTail(0x2), "pw"); | 267 | = UserAccountHelpers.CreateUserWithInventory(m_scene, "User", "Two", TestHelpers.ParseTail(0x2), "pw"); |
268 | 268 | ||
269 | ScenePresence giverSp = SceneHelpers.AddScenePresence(m_scene, ua1); | 269 | ScenePresence giverSp = SceneHelpers.AddScenePresence(m_scene, ua1); |
@@ -272,7 +272,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer.Tests | |||
272 | ScenePresence receiverSp = SceneHelpers.AddScenePresence(m_scene, ua2); | 272 | ScenePresence receiverSp = SceneHelpers.AddScenePresence(m_scene, ua2); |
273 | TestClient receiverClient = (TestClient)receiverSp.ControllingClient; | 273 | TestClient receiverClient = (TestClient)receiverSp.ControllingClient; |
274 | 274 | ||
275 | InventoryFolderBase originalFolder | 275 | InventoryFolderBase originalFolder |
276 | = UserInventoryHelpers.CreateInventoryFolder( | 276 | = UserInventoryHelpers.CreateInventoryFolder( |
277 | m_scene.InventoryService, giverSp.UUID, folderId, "f1", true); | 277 | m_scene.InventoryService, giverSp.UUID, folderId, "f1", true); |
278 | 278 | ||
@@ -281,35 +281,35 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer.Tests | |||
281 | byte[] itemIdBytes = folderId.GetBytes(); | 281 | byte[] itemIdBytes = folderId.GetBytes(); |
282 | Array.Copy(itemIdBytes, 0, giveImBinaryBucket, 1, itemIdBytes.Length); | 282 | Array.Copy(itemIdBytes, 0, giveImBinaryBucket, 1, itemIdBytes.Length); |
283 | 283 | ||
284 | GridInstantMessage giveIm | 284 | GridInstantMessage giveIm |
285 | = new GridInstantMessage( | 285 | = new GridInstantMessage( |
286 | m_scene, | 286 | m_scene, |
287 | giverSp.UUID, | 287 | giverSp.UUID, |
288 | giverSp.Name, | 288 | giverSp.Name, |
289 | receiverSp.UUID, | 289 | receiverSp.UUID, |
290 | (byte)InstantMessageDialog.InventoryOffered, | 290 | (byte)InstantMessageDialog.InventoryOffered, |
291 | false, | 291 | false, |
292 | "inventory offered msg", | 292 | "inventory offered msg", |
293 | initialSessionId, | 293 | initialSessionId, |
294 | false, | 294 | false, |
295 | Vector3.Zero, | 295 | Vector3.Zero, |
296 | giveImBinaryBucket, | 296 | giveImBinaryBucket, |
297 | true); | 297 | true); |
298 | 298 | ||
299 | giverClient.HandleImprovedInstantMessage(giveIm); | 299 | giverClient.HandleImprovedInstantMessage(giveIm); |
300 | 300 | ||
301 | // These details might not all be correct. | 301 | // These details might not all be correct. |
302 | GridInstantMessage acceptIm | 302 | GridInstantMessage acceptIm |
303 | = new GridInstantMessage( | 303 | = new GridInstantMessage( |
304 | m_scene, | 304 | m_scene, |
305 | receiverSp.UUID, | 305 | receiverSp.UUID, |
306 | receiverSp.Name, | 306 | receiverSp.Name, |
307 | giverSp.UUID, | 307 | giverSp.UUID, |
308 | (byte)InstantMessageDialog.InventoryAccepted, | 308 | (byte)InstantMessageDialog.InventoryAccepted, |
309 | false, | 309 | false, |
310 | "inventory accepted msg", | 310 | "inventory accepted msg", |
311 | initialSessionId, | 311 | initialSessionId, |
312 | false, | 312 | false, |
313 | Vector3.Zero, | 313 | Vector3.Zero, |
314 | null, | 314 | null, |
315 | true); | 315 | true); |
@@ -325,7 +325,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer.Tests | |||
325 | Assert.That(originalFolderAfterGive.ID, Is.EqualTo(originalFolder.ID)); | 325 | Assert.That(originalFolderAfterGive.ID, Is.EqualTo(originalFolder.ID)); |
326 | 326 | ||
327 | // Test for item successfully making it into the receiver's inventory | 327 | // Test for item successfully making it into the receiver's inventory |
328 | InventoryFolderBase receivedFolder | 328 | InventoryFolderBase receivedFolder |
329 | = UserInventoryHelpers.GetInventoryFolder(m_scene.InventoryService, receiverSp.UUID, "f1"); | 329 | = UserInventoryHelpers.GetInventoryFolder(m_scene.InventoryService, receiverSp.UUID, "f1"); |
330 | 330 | ||
331 | Assert.That(receivedFolder, Is.Not.Null); | 331 | Assert.That(receivedFolder, Is.Not.Null); |
@@ -340,7 +340,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer.Tests | |||
340 | Assert.That(originalFolderAfterDelete, Is.Not.Null); | 340 | Assert.That(originalFolderAfterDelete, Is.Not.Null); |
341 | 341 | ||
342 | // TODO: Test scenario where giver deletes their item first. | 342 | // TODO: Test scenario where giver deletes their item first. |
343 | } | 343 | } |
344 | 344 | ||
345 | /// <summary> | 345 | /// <summary> |
346 | /// Test user rejection of a given item. | 346 | /// Test user rejection of a given item. |
@@ -357,9 +357,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer.Tests | |||
357 | UUID initialSessionId = TestHelpers.ParseTail(0x10); | 357 | UUID initialSessionId = TestHelpers.ParseTail(0x10); |
358 | UUID folderId = TestHelpers.ParseTail(0x100); | 358 | UUID folderId = TestHelpers.ParseTail(0x100); |
359 | 359 | ||
360 | UserAccount ua1 | 360 | UserAccount ua1 |
361 | = UserAccountHelpers.CreateUserWithInventory(m_scene, "User", "One", TestHelpers.ParseTail(0x1), "pw"); | 361 | = UserAccountHelpers.CreateUserWithInventory(m_scene, "User", "One", TestHelpers.ParseTail(0x1), "pw"); |
362 | UserAccount ua2 | 362 | UserAccount ua2 |
363 | = UserAccountHelpers.CreateUserWithInventory(m_scene, "User", "Two", TestHelpers.ParseTail(0x2), "pw"); | 363 | = UserAccountHelpers.CreateUserWithInventory(m_scene, "User", "Two", TestHelpers.ParseTail(0x2), "pw"); |
364 | 364 | ||
365 | ScenePresence giverSp = SceneHelpers.AddScenePresence(m_scene, ua1); | 365 | ScenePresence giverSp = SceneHelpers.AddScenePresence(m_scene, ua1); |
@@ -369,7 +369,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer.Tests | |||
369 | TestClient receiverClient = (TestClient)receiverSp.ControllingClient; | 369 | TestClient receiverClient = (TestClient)receiverSp.ControllingClient; |
370 | 370 | ||
371 | // Create the folder to test give | 371 | // Create the folder to test give |
372 | InventoryFolderBase originalFolder | 372 | InventoryFolderBase originalFolder |
373 | = UserInventoryHelpers.CreateInventoryFolder( | 373 | = UserInventoryHelpers.CreateInventoryFolder( |
374 | m_scene.InventoryService, giverSp.UUID, folderId, "f1", true); | 374 | m_scene.InventoryService, giverSp.UUID, folderId, "f1", true); |
375 | 375 | ||
@@ -381,36 +381,36 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer.Tests | |||
381 | byte[] itemIdBytes = folderId.GetBytes(); | 381 | byte[] itemIdBytes = folderId.GetBytes(); |
382 | Array.Copy(itemIdBytes, 0, giveImBinaryBucket, 1, itemIdBytes.Length); | 382 | Array.Copy(itemIdBytes, 0, giveImBinaryBucket, 1, itemIdBytes.Length); |
383 | 383 | ||
384 | GridInstantMessage giveIm | 384 | GridInstantMessage giveIm |
385 | = new GridInstantMessage( | 385 | = new GridInstantMessage( |
386 | m_scene, | 386 | m_scene, |
387 | giverSp.UUID, | 387 | giverSp.UUID, |
388 | giverSp.Name, | 388 | giverSp.Name, |
389 | receiverSp.UUID, | 389 | receiverSp.UUID, |
390 | (byte)InstantMessageDialog.InventoryOffered, | 390 | (byte)InstantMessageDialog.InventoryOffered, |
391 | false, | 391 | false, |
392 | "inventory offered msg", | 392 | "inventory offered msg", |
393 | initialSessionId, | 393 | initialSessionId, |
394 | false, | 394 | false, |
395 | Vector3.Zero, | 395 | Vector3.Zero, |
396 | giveImBinaryBucket, | 396 | giveImBinaryBucket, |
397 | true); | 397 | true); |
398 | 398 | ||
399 | giverClient.HandleImprovedInstantMessage(giveIm); | 399 | giverClient.HandleImprovedInstantMessage(giveIm); |
400 | 400 | ||
401 | // These details might not all be correct. | 401 | // These details might not all be correct. |
402 | // Session ID is now the created item ID (!) | 402 | // Session ID is now the created item ID (!) |
403 | GridInstantMessage rejectIm | 403 | GridInstantMessage rejectIm |
404 | = new GridInstantMessage( | 404 | = new GridInstantMessage( |
405 | m_scene, | 405 | m_scene, |
406 | receiverSp.UUID, | 406 | receiverSp.UUID, |
407 | receiverSp.Name, | 407 | receiverSp.Name, |
408 | giverSp.UUID, | 408 | giverSp.UUID, |
409 | (byte)InstantMessageDialog.InventoryDeclined, | 409 | (byte)InstantMessageDialog.InventoryDeclined, |
410 | false, | 410 | false, |
411 | "inventory declined msg", | 411 | "inventory declined msg", |
412 | new UUID(receivedIm.imSessionID), | 412 | new UUID(receivedIm.imSessionID), |
413 | false, | 413 | false, |
414 | Vector3.Zero, | 414 | Vector3.Zero, |
415 | null, | 415 | null, |
416 | true); | 416 | true); |
@@ -426,7 +426,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer.Tests | |||
426 | Assert.That(originalFolderAfterGive.ID, Is.EqualTo(originalFolder.ID)); | 426 | Assert.That(originalFolderAfterGive.ID, Is.EqualTo(originalFolder.ID)); |
427 | 427 | ||
428 | // Test for folder successfully making it into the receiver's inventory | 428 | // Test for folder successfully making it into the receiver's inventory |
429 | InventoryFolderBase receivedFolder | 429 | InventoryFolderBase receivedFolder |
430 | = UserInventoryHelpers.GetInventoryFolder(m_scene.InventoryService, receiverSp.UUID, "Trash/f1"); | 430 | = UserInventoryHelpers.GetInventoryFolder(m_scene.InventoryService, receiverSp.UUID, "Trash/f1"); |
431 | 431 | ||
432 | InventoryFolderBase trashFolder | 432 | InventoryFolderBase trashFolder |
@@ -443,6 +443,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer.Tests | |||
443 | = UserInventoryHelpers.GetInventoryFolder(m_scene.InventoryService, giverSp.UUID, "f1"); | 443 | = UserInventoryHelpers.GetInventoryFolder(m_scene.InventoryService, giverSp.UUID, "f1"); |
444 | 444 | ||
445 | Assert.That(originalFolderAfterDelete, Is.Not.Null); | 445 | Assert.That(originalFolderAfterDelete, Is.Not.Null); |
446 | } | 446 | } |
447 | } | 447 | } |
448 | } \ No newline at end of file | 448 | } \ No newline at end of file |