diff options
author | Teravus Ovares (Dan Olivares) | 2009-09-08 04:43:17 -0400 |
---|---|---|
committer | Teravus Ovares (Dan Olivares) | 2009-09-08 04:43:17 -0400 |
commit | f0e2fd426b074ceb992124cf5eb2ebe8db5c04dd (patch) | |
tree | bea9234644b05887b4c7cc063d457b91610ed9dc /OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs | |
parent | * Fixes a 'take object from mega region' and rez it in a regular region.. ... (diff) | |
parent | llRot2Euler() now returns angles -PI < angle < PI (diff) | |
download | opensim-SC_OLD-f0e2fd426b074ceb992124cf5eb2ebe8db5c04dd.zip opensim-SC_OLD-f0e2fd426b074ceb992124cf5eb2ebe8db5c04dd.tar.gz opensim-SC_OLD-f0e2fd426b074ceb992124cf5eb2ebe8db5c04dd.tar.bz2 opensim-SC_OLD-f0e2fd426b074ceb992124cf5eb2ebe8db5c04dd.tar.xz |
Merge branch 'master' of ssh://MyConnection/var/git/opensim
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs | 52 |
1 files changed, 23 insertions, 29 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index a151c9d..d579a81 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs | |||
@@ -77,13 +77,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
77 | /// </summary> | 77 | /// </summary> |
78 | // Commenting for now! The mock inventory service needs more beef, at least for | 78 | // Commenting for now! The mock inventory service needs more beef, at least for |
79 | // GetFolderForType | 79 | // GetFolderForType |
80 | //[Test] | 80 | [Test] |
81 | public void TestSaveIarV0_1() | 81 | public void TestSaveIarV0_1() |
82 | { | 82 | { |
83 | TestHelper.InMethod(); | 83 | TestHelper.InMethod(); |
84 | log4net.Config.XmlConfigurator.Configure(); | 84 | log4net.Config.XmlConfigurator.Configure(); |
85 | 85 | ||
86 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(); | 86 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); |
87 | 87 | ||
88 | Scene scene = SceneSetupHelpers.SetupScene("Inventory"); | 88 | Scene scene = SceneSetupHelpers.SetupScene("Inventory"); |
89 | SceneSetupHelpers.SetupSceneModules(scene, archiverModule); | 89 | SceneSetupHelpers.SetupSceneModules(scene, archiverModule); |
@@ -93,7 +93,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
93 | string userFirstName = "Jock"; | 93 | string userFirstName = "Jock"; |
94 | string userLastName = "Stirrup"; | 94 | string userLastName = "Stirrup"; |
95 | UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020"); | 95 | UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020"); |
96 | // CachedUserInfo userInfo; | ||
97 | 96 | ||
98 | lock (this) | 97 | lock (this) |
99 | { | 98 | { |
@@ -101,9 +100,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
101 | cm, userFirstName, userLastName, userId, InventoryReceived); | 100 | cm, userFirstName, userLastName, userId, InventoryReceived); |
102 | Monitor.Wait(this, 60000); | 101 | Monitor.Wait(this, 60000); |
103 | } | 102 | } |
104 | 103 | ||
105 | Console.WriteLine("here"); | ||
106 | |||
107 | // Create asset | 104 | // Create asset |
108 | SceneObjectGroup object1; | 105 | SceneObjectGroup object1; |
109 | SceneObjectPart part1; | 106 | SceneObjectPart part1; |
@@ -136,16 +133,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
136 | item1.Name = "My Little Dog"; | 133 | item1.Name = "My Little Dog"; |
137 | item1.AssetID = asset1.FullID; | 134 | item1.AssetID = asset1.FullID; |
138 | item1.ID = item1Id; | 135 | item1.ID = item1Id; |
139 | //userInfo.RootFolder.FindFolderByPath("Objects").ID; | 136 | InventoryFolderBase objsFolder |
140 | //InventoryFolderBase objsFolder = scene.InventoryService.GetFolderForType(userId, AssetType.Object); | 137 | = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects"); |
141 | Console.WriteLine("here2"); | ||
142 | IInventoryService inventoryService = scene.InventoryService; | ||
143 | InventoryFolderBase rootFolder = inventoryService.GetRootFolder(userId); | ||
144 | InventoryCollection rootContents = inventoryService.GetFolderContent(userId, rootFolder.ID); | ||
145 | InventoryFolderBase objsFolder = null; | ||
146 | foreach (InventoryFolderBase folder in rootContents.Folders) | ||
147 | if (folder.Name == "Objects") | ||
148 | objsFolder = folder; | ||
149 | item1.Folder = objsFolder.ID; | 138 | item1.Folder = objsFolder.ID; |
150 | scene.AddInventoryItem(userId, item1); | 139 | scene.AddInventoryItem(userId, item1); |
151 | 140 | ||
@@ -155,7 +144,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
155 | mre.Reset(); | 144 | mre.Reset(); |
156 | archiverModule.ArchiveInventory( | 145 | archiverModule.ArchiveInventory( |
157 | Guid.NewGuid(), userFirstName, userLastName, "Objects", archiveWriteStream); | 146 | Guid.NewGuid(), userFirstName, userLastName, "Objects", archiveWriteStream); |
158 | mre.WaitOne(); | 147 | mre.WaitOne(60000, false); |
159 | 148 | ||
160 | byte[] archive = archiveWriteStream.ToArray(); | 149 | byte[] archive = archiveWriteStream.ToArray(); |
161 | MemoryStream archiveReadStream = new MemoryStream(archive); | 150 | MemoryStream archiveReadStream = new MemoryStream(archive); |
@@ -257,7 +246,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
257 | 246 | ||
258 | MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray()); | 247 | MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray()); |
259 | SerialiserModule serialiserModule = new SerialiserModule(); | 248 | SerialiserModule serialiserModule = new SerialiserModule(); |
260 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(); | 249 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); |
261 | 250 | ||
262 | // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene | 251 | // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene |
263 | Scene scene = SceneSetupHelpers.SetupScene("inventory"); | 252 | Scene scene = SceneSetupHelpers.SetupScene("inventory"); |
@@ -275,7 +264,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
275 | CachedUserInfo userInfo | 264 | CachedUserInfo userInfo |
276 | = scene.CommsManager.UserProfileCacheService.GetUserDetails(userFirstName, userLastName); | 265 | = scene.CommsManager.UserProfileCacheService.GetUserDetails(userFirstName, userLastName); |
277 | 266 | ||
278 | InventoryItemBase foundItem = userInfo.RootFolder.FindItemByPath(itemName); | 267 | InventoryItemBase foundItem |
268 | = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userInfo.UserProfile.ID, itemName); | ||
269 | |||
279 | Assert.That(foundItem, Is.Not.Null, "Didn't find loaded item"); | 270 | Assert.That(foundItem, Is.Not.Null, "Didn't find loaded item"); |
280 | Assert.That( | 271 | Assert.That( |
281 | foundItem.CreatorId, Is.EqualTo(item1.CreatorId), | 272 | foundItem.CreatorId, Is.EqualTo(item1.CreatorId), |
@@ -325,7 +316,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
325 | 316 | ||
326 | MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray()); | 317 | MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray()); |
327 | SerialiserModule serialiserModule = new SerialiserModule(); | 318 | SerialiserModule serialiserModule = new SerialiserModule(); |
328 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(); | 319 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); |
329 | 320 | ||
330 | // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene | 321 | // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene |
331 | Scene scene = SceneSetupHelpers.SetupScene(); | 322 | Scene scene = SceneSetupHelpers.SetupScene(); |
@@ -385,9 +376,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
385 | Monitor.Wait(this, 60000); | 376 | Monitor.Wait(this, 60000); |
386 | } | 377 | } |
387 | 378 | ||
388 | Console.WriteLine("userInfo.RootFolder 1: {0}", userInfo.RootFolder); | 379 | //Console.WriteLine("userInfo.RootFolder 1: {0}", userInfo.RootFolder); |
389 | 380 | ||
390 | Dictionary <string, InventoryFolderImpl> foldersCreated = new Dictionary<string, InventoryFolderImpl>(); | 381 | Dictionary <string, InventoryFolderBase> foldersCreated = new Dictionary<string, InventoryFolderBase>(); |
391 | List<InventoryNodeBase> nodesLoaded = new List<InventoryNodeBase>(); | 382 | List<InventoryNodeBase> nodesLoaded = new List<InventoryNodeBase>(); |
392 | 383 | ||
393 | string folder1Name = "a"; | 384 | string folder1Name = "a"; |
@@ -405,17 +396,20 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
405 | "{0}{1}/{2}/{3}", | 396 | "{0}{1}/{2}/{3}", |
406 | ArchiveConstants.INVENTORY_PATH, folder1ArchiveName, folder2ArchiveName, itemName); | 397 | ArchiveConstants.INVENTORY_PATH, folder1ArchiveName, folder2ArchiveName, itemName); |
407 | 398 | ||
408 | Console.WriteLine("userInfo.RootFolder 2: {0}", userInfo.RootFolder); | 399 | //Console.WriteLine("userInfo.RootFolder 2: {0}", userInfo.RootFolder); |
409 | 400 | ||
410 | new InventoryArchiveReadRequest(userInfo, null, (Stream)null, null, null) | 401 | new InventoryArchiveReadRequest(scene, userInfo, null, (Stream)null) |
411 | .ReplicateArchivePathToUserInventory( | 402 | .ReplicateArchivePathToUserInventory( |
412 | itemArchivePath, false, userInfo.RootFolder, foldersCreated, nodesLoaded); | 403 | itemArchivePath, false, scene.InventoryService.GetRootFolder(userInfo.UserProfile.ID), |
404 | foldersCreated, nodesLoaded); | ||
413 | 405 | ||
414 | Console.WriteLine("userInfo.RootFolder 3: {0}", userInfo.RootFolder); | 406 | //Console.WriteLine("userInfo.RootFolder 3: {0}", userInfo.RootFolder); |
415 | InventoryFolderImpl folder1 = userInfo.RootFolder.FindFolderByPath("a"); | 407 | //InventoryFolderImpl folder1 = userInfo.RootFolder.FindFolderByPath("a"); |
408 | InventoryFolderBase folder1 | ||
409 | = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userInfo.UserProfile.ID, "a"); | ||
416 | Assert.That(folder1, Is.Not.Null, "Could not find folder a"); | 410 | Assert.That(folder1, Is.Not.Null, "Could not find folder a"); |
417 | InventoryFolderImpl folder2 = folder1.FindFolderByPath("b"); | 411 | InventoryFolderBase folder2 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, "b"); |
418 | Assert.That(folder2, Is.Not.Null, "Could not find folder b"); | 412 | Assert.That(folder2, Is.Not.Null, "Could not find folder b"); |
419 | } | 413 | } |
420 | } | 414 | } |
421 | } | 415 | } \ No newline at end of file |