diff options
author | Melanie | 2010-08-30 02:30:28 +0100 |
---|---|---|
committer | Melanie | 2010-08-30 02:30:28 +0100 |
commit | 79bfa275da6b8be03678bfa284bd205410296b6a (patch) | |
tree | 1ce2f9f2da9bb0e3a8f5628d54f44e45bfc33044 /OpenSim/Region/CoreModules/Avatar | |
parent | Remove CRLF endings (diff) | |
parent | Fix a casting operation to use ToString() (diff) | |
download | opensim-SC_OLD-79bfa275da6b8be03678bfa284bd205410296b6a.zip opensim-SC_OLD-79bfa275da6b8be03678bfa284bd205410296b6a.tar.gz opensim-SC_OLD-79bfa275da6b8be03678bfa284bd205410296b6a.tar.bz2 opensim-SC_OLD-79bfa275da6b8be03678bfa284bd205410296b6a.tar.xz |
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar')
5 files changed, 178 insertions, 53 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 74784ae..38152cc 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -471,12 +471,86 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
471 | SceneObjectSerializer.ToOriginalXmlFormat(group); | 471 | SceneObjectSerializer.ToOriginalXmlFormat(group); |
472 | group.DetachToInventoryPrep(); | 472 | group.DetachToInventoryPrep(); |
473 | m_log.Debug("[ATTACHMENTS MODULE]: Saving attachpoint: " + ((uint)group.GetAttachmentPoint()).ToString()); | 473 | m_log.Debug("[ATTACHMENTS MODULE]: Saving attachpoint: " + ((uint)group.GetAttachmentPoint()).ToString()); |
474 | m_scene.UpdateKnownItem(remoteClient, group,group.GetFromItemID(), group.OwnerID); | 474 | UpdateKnownItem(remoteClient, group, group.GetFromItemID(), group.OwnerID); |
475 | m_scene.DeleteSceneObject(group, false); | 475 | m_scene.DeleteSceneObject(group, false); |
476 | return; | 476 | return; |
477 | } | 477 | } |
478 | } | 478 | } |
479 | } | 479 | } |
480 | } | 480 | } |
481 | |||
482 | public void UpdateAttachmentPosition(IClientAPI client, SceneObjectGroup sog, Vector3 pos) | ||
483 | { | ||
484 | // If this is an attachment, then we need to save the modified | ||
485 | // object back into the avatar's inventory. First we save the | ||
486 | // attachment point information, then we update the relative | ||
487 | // positioning (which caused this method to get driven in the | ||
488 | // first place. Then we have to mark the object as NOT an | ||
489 | // attachment. This is necessary in order to correctly save | ||
490 | // and retrieve GroupPosition information for the attachment. | ||
491 | // Then we save the asset back into the appropriate inventory | ||
492 | // entry. Finally, we restore the object's attachment status. | ||
493 | byte attachmentPoint = sog.GetAttachmentPoint(); | ||
494 | sog.UpdateGroupPosition(pos); | ||
495 | sog.RootPart.IsAttachment = false; | ||
496 | sog.AbsolutePosition = sog.RootPart.AttachedPos; | ||
497 | UpdateKnownItem(client, sog, sog.GetFromItemID(), sog.OwnerID); | ||
498 | sog.SetAttachmentPoint(attachmentPoint); | ||
499 | } | ||
500 | |||
501 | /// <summary> | ||
502 | /// Update the attachment asset for the new sog details if they have changed. | ||
503 | /// </summary> | ||
504 | /// | ||
505 | /// This is essential for preserving attachment attributes such as permission. Unlike normal scene objects, | ||
506 | /// these details are not stored on the region. | ||
507 | /// | ||
508 | /// <param name="remoteClient"></param> | ||
509 | /// <param name="grp"></param> | ||
510 | /// <param name="itemID"></param> | ||
511 | /// <param name="agentID"></param> | ||
512 | protected void UpdateKnownItem(IClientAPI remoteClient, SceneObjectGroup grp, UUID itemID, UUID agentID) | ||
513 | { | ||
514 | if (grp != null) | ||
515 | { | ||
516 | if (!grp.HasGroupChanged) | ||
517 | { | ||
518 | m_log.WarnFormat("[ATTACHMENTS MODULE]: Save request for {0} which is unchanged", grp.UUID); | ||
519 | return; | ||
520 | } | ||
521 | |||
522 | m_log.DebugFormat( | ||
523 | "[ATTACHMENTS MODULE]: Updating asset for attachment {0}, attachpoint {1}", | ||
524 | grp.UUID, grp.GetAttachmentPoint()); | ||
525 | |||
526 | string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp); | ||
527 | |||
528 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); | ||
529 | item = m_scene.InventoryService.GetItem(item); | ||
530 | |||
531 | if (item != null) | ||
532 | { | ||
533 | AssetBase asset = m_scene.CreateAsset( | ||
534 | grp.GetPartName(grp.LocalId), | ||
535 | grp.GetPartDescription(grp.LocalId), | ||
536 | (sbyte)AssetType.Object, | ||
537 | Utils.StringToBytes(sceneObjectXml), | ||
538 | remoteClient.AgentId); | ||
539 | m_scene.AssetService.Store(asset); | ||
540 | |||
541 | item.AssetID = asset.FullID; | ||
542 | item.Description = asset.Description; | ||
543 | item.Name = asset.Name; | ||
544 | item.AssetType = asset.Type; | ||
545 | item.InvType = (int)InventoryType.Object; | ||
546 | |||
547 | m_scene.InventoryService.UpdateItem(item); | ||
548 | |||
549 | // this gets called when the agent logs off! | ||
550 | if (remoteClient != null) | ||
551 | remoteClient.SendInventoryItemCreateUpdate(item, 0); | ||
552 | } | ||
553 | } | ||
554 | } | ||
481 | } | 555 | } |
482 | } | 556 | } \ No newline at end of file |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index 7683288..22c84e9 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs | |||
@@ -261,7 +261,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
261 | 261 | ||
262 | while (archivePath.Length > 0) | 262 | while (archivePath.Length > 0) |
263 | { | 263 | { |
264 | m_log.DebugFormat("[INVENTORY ARCHIVER]: Trying to resolve destination folder {0}", archivePath); | 264 | // m_log.DebugFormat("[INVENTORY ARCHIVER]: Trying to resolve destination folder {0}", archivePath); |
265 | 265 | ||
266 | if (resolvedFolders.ContainsKey(archivePath)) | 266 | if (resolvedFolders.ContainsKey(archivePath)) |
267 | { | 267 | { |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs index 84afb40..8343091 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs | |||
@@ -41,7 +41,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
41 | /// </summary> | 41 | /// </summary> |
42 | public static class InventoryArchiveUtils | 42 | public static class InventoryArchiveUtils |
43 | { | 43 | { |
44 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 44 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
45 | 45 | ||
46 | // Character used for escaping the path delimter ("\/") and itself ("\\") in human escaped strings | 46 | // Character used for escaping the path delimter ("\/") and itself ("\\") in human escaped strings |
47 | public static readonly char ESCAPE_CHARACTER = '\\'; | 47 | public static readonly char ESCAPE_CHARACTER = '\\'; |
@@ -120,6 +120,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
120 | foundFolders.Add(startFolder); | 120 | foundFolders.Add(startFolder); |
121 | return foundFolders; | 121 | return foundFolders; |
122 | } | 122 | } |
123 | |||
124 | // If the path isn't just / then trim any starting extraneous slashes | ||
125 | path = path.TrimStart(new char[] { PATH_DELIMITER }); | ||
126 | |||
127 | // m_log.DebugFormat("[INVENTORY ARCHIVE UTILS]: Adjusted path in FindFolderByPath() is [{0}]", path); | ||
123 | 128 | ||
124 | string[] components = SplitEscapedPath(path); | 129 | string[] components = SplitEscapedPath(path); |
125 | components[0] = UnescapePath(components[0]); | 130 | components[0] = UnescapePath(components[0]); |
@@ -199,6 +204,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
199 | public static InventoryItemBase FindItemByPath( | 204 | public static InventoryItemBase FindItemByPath( |
200 | IInventoryService inventoryService, InventoryFolderBase startFolder, string path) | 205 | IInventoryService inventoryService, InventoryFolderBase startFolder, string path) |
201 | { | 206 | { |
207 | // If the path isn't just / then trim any starting extraneous slashes | ||
208 | path = path.TrimStart(new char[] { PATH_DELIMITER }); | ||
209 | |||
202 | string[] components = SplitEscapedPath(path); | 210 | string[] components = SplitEscapedPath(path); |
203 | components[0] = UnescapePath(components[0]); | 211 | components[0] = UnescapePath(components[0]); |
204 | 212 | ||
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs index 25a78ff..9908018 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs | |||
@@ -221,7 +221,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
221 | InventoryItemBase inventoryItem = null; | 221 | InventoryItemBase inventoryItem = null; |
222 | InventoryFolderBase rootFolder = m_scene.InventoryService.GetRootFolder(m_userInfo.PrincipalID); | 222 | InventoryFolderBase rootFolder = m_scene.InventoryService.GetRootFolder(m_userInfo.PrincipalID); |
223 | 223 | ||
224 | bool foundStar = false; | 224 | bool saveFolderContentsOnly = false; |
225 | 225 | ||
226 | // Eliminate double slashes and any leading / on the path. | 226 | // Eliminate double slashes and any leading / on the path. |
227 | string[] components | 227 | string[] components |
@@ -234,7 +234,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
234 | // folder itself. This may get more sophisicated later on | 234 | // folder itself. This may get more sophisicated later on |
235 | if (maxComponentIndex >= 0 && components[maxComponentIndex] == STAR_WILDCARD) | 235 | if (maxComponentIndex >= 0 && components[maxComponentIndex] == STAR_WILDCARD) |
236 | { | 236 | { |
237 | foundStar = true; | 237 | saveFolderContentsOnly = true; |
238 | maxComponentIndex--; | 238 | maxComponentIndex--; |
239 | } | 239 | } |
240 | 240 | ||
@@ -281,10 +281,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
281 | { | 281 | { |
282 | m_log.DebugFormat( | 282 | m_log.DebugFormat( |
283 | "[INVENTORY ARCHIVER]: Found folder {0} {1} at {2}", | 283 | "[INVENTORY ARCHIVER]: Found folder {0} {1} at {2}", |
284 | inventoryFolder.Name, inventoryFolder.ID, m_invPath); | 284 | inventoryFolder.Name, |
285 | inventoryFolder.ID, | ||
286 | m_invPath == String.Empty ? InventoryFolderImpl.PATH_DELIMITER : m_invPath ); | ||
285 | 287 | ||
286 | //recurse through all dirs getting dirs and files | 288 | //recurse through all dirs getting dirs and files |
287 | SaveInvFolder(inventoryFolder, ArchiveConstants.INVENTORY_PATH, !foundStar); | 289 | SaveInvFolder(inventoryFolder, ArchiveConstants.INVENTORY_PATH, !saveFolderContentsOnly); |
288 | } | 290 | } |
289 | else if (inventoryItem != null) | 291 | else if (inventoryItem != null) |
290 | { | 292 | { |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index 3fb2c8c..0218f86 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs | |||
@@ -55,12 +55,58 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
55 | { | 55 | { |
56 | protected ManualResetEvent mre = new ManualResetEvent(false); | 56 | protected ManualResetEvent mre = new ManualResetEvent(false); |
57 | 57 | ||
58 | /// <summary> | ||
59 | /// Stream of data representing a common IAR that can be reused in load tests. | ||
60 | /// </summary> | ||
61 | protected MemoryStream m_iarStream; | ||
62 | |||
63 | protected UserAccount m_ua1 | ||
64 | = new UserAccount { | ||
65 | PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000555"), | ||
66 | FirstName = "Mr", | ||
67 | LastName = "Tiddles" }; | ||
68 | protected UserAccount m_ua2 | ||
69 | = new UserAccount { | ||
70 | PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000666"), | ||
71 | FirstName = "Lord", | ||
72 | LastName = "Lucan" }; | ||
73 | string m_item1Name = "b.lsl"; | ||
74 | |||
58 | private void SaveCompleted( | 75 | private void SaveCompleted( |
59 | Guid id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream, | 76 | Guid id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream, |
60 | Exception reportedException) | 77 | Exception reportedException) |
61 | { | 78 | { |
62 | mre.Set(); | 79 | mre.Set(); |
63 | } | 80 | } |
81 | |||
82 | [SetUp] | ||
83 | public void Init() | ||
84 | { | ||
85 | ConstructDefaultIarForTestLoad(); | ||
86 | } | ||
87 | |||
88 | protected void ConstructDefaultIarForTestLoad() | ||
89 | { | ||
90 | string archiveItemName = InventoryArchiveWriteRequest.CreateArchiveItemName(m_item1Name, UUID.Random()); | ||
91 | |||
92 | MemoryStream archiveWriteStream = new MemoryStream(); | ||
93 | TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream); | ||
94 | |||
95 | InventoryItemBase item1 = new InventoryItemBase(); | ||
96 | item1.Name = m_item1Name; | ||
97 | item1.AssetID = UUID.Random(); | ||
98 | item1.GroupID = UUID.Random(); | ||
99 | item1.CreatorId = OspResolver.MakeOspa(m_ua2.FirstName, m_ua2.LastName); | ||
100 | //item1.CreatorId = userUuid.ToString(); | ||
101 | //item1.CreatorId = "00000000-0000-0000-0000-000000000444"; | ||
102 | item1.Owner = UUID.Zero; | ||
103 | |||
104 | string item1FileName | ||
105 | = string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName); | ||
106 | tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1)); | ||
107 | tar.Close(); | ||
108 | m_iarStream = new MemoryStream(archiveWriteStream.ToArray()); | ||
109 | } | ||
64 | 110 | ||
65 | /// <summary> | 111 | /// <summary> |
66 | /// Test saving an inventory path to a V0.1 OpenSim Inventory Archive | 112 | /// Test saving an inventory path to a V0.1 OpenSim Inventory Archive |
@@ -122,6 +168,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
122 | MemoryStream archiveWriteStream = new MemoryStream(); | 168 | MemoryStream archiveWriteStream = new MemoryStream(); |
123 | archiverModule.OnInventoryArchiveSaved += SaveCompleted; | 169 | archiverModule.OnInventoryArchiveSaved += SaveCompleted; |
124 | 170 | ||
171 | // Test saving a particular path | ||
125 | mre.Reset(); | 172 | mre.Reset(); |
126 | archiverModule.ArchiveInventory( | 173 | archiverModule.ArchiveInventory( |
127 | Guid.NewGuid(), userFirstName, userLastName, "Objects", userPassword, archiveWriteStream); | 174 | Guid.NewGuid(), userFirstName, userLastName, "Objects", userPassword, archiveWriteStream); |
@@ -148,7 +195,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
148 | 195 | ||
149 | while (tar.ReadEntry(out filePath, out tarEntryType) != null) | 196 | while (tar.ReadEntry(out filePath, out tarEntryType) != null) |
150 | { | 197 | { |
151 | Console.WriteLine("Got {0}", filePath); | 198 | // Console.WriteLine("Got {0}", filePath); |
152 | 199 | ||
153 | // if (ArchiveConstants.CONTROL_FILE_PATH == filePath) | 200 | // if (ArchiveConstants.CONTROL_FILE_PATH == filePath) |
154 | // { | 201 | // { |
@@ -297,6 +344,30 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
297 | } | 344 | } |
298 | 345 | ||
299 | /// <summary> | 346 | /// <summary> |
347 | /// Test that things work when the load path specified starts with a slash | ||
348 | /// </summary> | ||
349 | [Test] | ||
350 | public void TestLoadIarPathStartsWithSlash() | ||
351 | { | ||
352 | TestHelper.InMethod(); | ||
353 | // log4net.Config.XmlConfigurator.Configure(); | ||
354 | |||
355 | SerialiserModule serialiserModule = new SerialiserModule(); | ||
356 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); | ||
357 | Scene scene = SceneSetupHelpers.SetupScene("inventory"); | ||
358 | SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); | ||
359 | |||
360 | UserProfileTestUtils.CreateUserWithInventory(scene, m_ua1, "password"); | ||
361 | archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "/Objects", "password", m_iarStream); | ||
362 | |||
363 | InventoryItemBase foundItem1 | ||
364 | = InventoryArchiveUtils.FindItemByPath( | ||
365 | scene.InventoryService, m_ua1.PrincipalID, "/Objects/" + m_item1Name); | ||
366 | |||
367 | Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1 in TestLoadIarFolderStartsWithSlash()"); | ||
368 | } | ||
369 | |||
370 | /// <summary> | ||
300 | /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where | 371 | /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where |
301 | /// an account exists with the creator name. | 372 | /// an account exists with the creator name. |
302 | /// </summary> | 373 | /// </summary> |
@@ -308,34 +379,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
308 | TestHelper.InMethod(); | 379 | TestHelper.InMethod(); |
309 | //log4net.Config.XmlConfigurator.Configure(); | 380 | //log4net.Config.XmlConfigurator.Configure(); |
310 | 381 | ||
311 | string userFirstName = "Mr"; | ||
312 | string userLastName = "Tiddles"; | ||
313 | UUID userUuid = UUID.Parse("00000000-0000-0000-0000-000000000555"); | ||
314 | string userItemCreatorFirstName = "Lord"; | ||
315 | string userItemCreatorLastName = "Lucan"; | ||
316 | UUID userItemCreatorUuid = UUID.Parse("00000000-0000-0000-0000-000000000666"); | ||
317 | |||
318 | string item1Name = "b.lsl"; | ||
319 | string archiveItemName = InventoryArchiveWriteRequest.CreateArchiveItemName(item1Name, UUID.Random()); | ||
320 | |||
321 | MemoryStream archiveWriteStream = new MemoryStream(); | ||
322 | TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream); | ||
323 | |||
324 | InventoryItemBase item1 = new InventoryItemBase(); | ||
325 | item1.Name = item1Name; | ||
326 | item1.AssetID = UUID.Random(); | ||
327 | item1.GroupID = UUID.Random(); | ||
328 | item1.CreatorId = OspResolver.MakeOspa(userItemCreatorFirstName, userItemCreatorLastName); | ||
329 | //item1.CreatorId = userUuid.ToString(); | ||
330 | //item1.CreatorId = "00000000-0000-0000-0000-000000000444"; | ||
331 | item1.Owner = UUID.Zero; | ||
332 | |||
333 | string item1FileName | ||
334 | = string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName); | ||
335 | tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1)); | ||
336 | tar.Close(); | ||
337 | |||
338 | MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray()); | ||
339 | SerialiserModule serialiserModule = new SerialiserModule(); | 382 | SerialiserModule serialiserModule = new SerialiserModule(); |
340 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); | 383 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); |
341 | 384 | ||
@@ -344,15 +387,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
344 | 387 | ||
345 | SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); | 388 | SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); |
346 | 389 | ||
347 | UserProfileTestUtils.CreateUserWithInventory( | 390 | UserProfileTestUtils.CreateUserWithInventory(scene, m_ua1, "meowfood"); |
348 | scene, userFirstName, userLastName, userUuid, "meowfood"); | 391 | UserProfileTestUtils.CreateUserWithInventory(scene, m_ua2, "hampshire"); |
349 | UserProfileTestUtils.CreateUserWithInventory( | ||
350 | scene, userItemCreatorFirstName, userItemCreatorLastName, userItemCreatorUuid, "hampshire"); | ||
351 | 392 | ||
352 | archiverModule.DearchiveInventory(userFirstName, userLastName, "/", "meowfood", archiveReadStream); | 393 | archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "/", "meowfood", m_iarStream); |
353 | 394 | ||
354 | InventoryItemBase foundItem1 | 395 | InventoryItemBase foundItem1 |
355 | = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userUuid, item1Name); | 396 | = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_ua1.PrincipalID, m_item1Name); |
356 | 397 | ||
357 | Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1"); | 398 | Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1"); |
358 | 399 | ||
@@ -362,31 +403,31 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
362 | // foundItem1.CreatorId, Is.EqualTo(item1.CreatorId), | 403 | // foundItem1.CreatorId, Is.EqualTo(item1.CreatorId), |
363 | // "Loaded item non-uuid creator doesn't match original"); | 404 | // "Loaded item non-uuid creator doesn't match original"); |
364 | Assert.That( | 405 | Assert.That( |
365 | foundItem1.CreatorId, Is.EqualTo(userItemCreatorUuid.ToString()), | 406 | foundItem1.CreatorId, Is.EqualTo(m_ua2.PrincipalID.ToString()), |
366 | "Loaded item non-uuid creator doesn't match original"); | 407 | "Loaded item non-uuid creator doesn't match original"); |
367 | 408 | ||
368 | Assert.That( | 409 | Assert.That( |
369 | foundItem1.CreatorIdAsUuid, Is.EqualTo(userItemCreatorUuid), | 410 | foundItem1.CreatorIdAsUuid, Is.EqualTo(m_ua2.PrincipalID), |
370 | "Loaded item uuid creator doesn't match original"); | 411 | "Loaded item uuid creator doesn't match original"); |
371 | Assert.That(foundItem1.Owner, Is.EqualTo(userUuid), | 412 | Assert.That(foundItem1.Owner, Is.EqualTo(m_ua1.PrincipalID), |
372 | "Loaded item owner doesn't match inventory reciever"); | 413 | "Loaded item owner doesn't match inventory reciever"); |
373 | 414 | ||
374 | // Now try loading to a root child folder | 415 | // Now try loading to a root child folder |
375 | UserInventoryTestUtils.CreateInventoryFolder(scene.InventoryService, userUuid, "xA"); | 416 | UserInventoryTestUtils.CreateInventoryFolder(scene.InventoryService, m_ua1.PrincipalID, "xA"); |
376 | archiveReadStream = new MemoryStream(archiveReadStream.ToArray()); | 417 | MemoryStream archiveReadStream = new MemoryStream(m_iarStream.ToArray()); |
377 | archiverModule.DearchiveInventory(userFirstName, userLastName, "xA", "meowfood", archiveReadStream); | 418 | archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "xA", "meowfood", archiveReadStream); |
378 | 419 | ||
379 | InventoryItemBase foundItem2 | 420 | InventoryItemBase foundItem2 |
380 | = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userUuid, "xA/" + item1Name); | 421 | = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_ua1.PrincipalID, "xA/" + m_item1Name); |
381 | Assert.That(foundItem2, Is.Not.Null, "Didn't find loaded item 2"); | 422 | Assert.That(foundItem2, Is.Not.Null, "Didn't find loaded item 2"); |
382 | 423 | ||
383 | // Now try loading to a more deeply nested folder | 424 | // Now try loading to a more deeply nested folder |
384 | UserInventoryTestUtils.CreateInventoryFolder(scene.InventoryService, userUuid, "xB/xC"); | 425 | UserInventoryTestUtils.CreateInventoryFolder(scene.InventoryService, m_ua1.PrincipalID, "xB/xC"); |
385 | archiveReadStream = new MemoryStream(archiveReadStream.ToArray()); | 426 | archiveReadStream = new MemoryStream(archiveReadStream.ToArray()); |
386 | archiverModule.DearchiveInventory(userFirstName, userLastName, "xB/xC", "meowfood", archiveReadStream); | 427 | archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "xB/xC", "meowfood", archiveReadStream); |
387 | 428 | ||
388 | InventoryItemBase foundItem3 | 429 | InventoryItemBase foundItem3 |
389 | = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userUuid, "xB/xC/" + item1Name); | 430 | = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_ua1.PrincipalID, "xB/xC/" + m_item1Name); |
390 | Assert.That(foundItem3, Is.Not.Null, "Didn't find loaded item 3"); | 431 | Assert.That(foundItem3, Is.Not.Null, "Didn't find loaded item 3"); |
391 | } | 432 | } |
392 | 433 | ||