aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests
diff options
context:
space:
mode:
authoronefang2019-05-19 21:24:15 +1000
committeronefang2019-05-19 21:24:15 +1000
commit5e4d6cab00cb29cd088ab7b62ab13aff103b64cb (patch)
treea9fbc62df9eb2d1d9ba2698d8552eae71eca20d8 /OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests
parentAdd a build script. (diff)
downloadopensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.zip
opensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.gz
opensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.bz2
opensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.xz
Dump OpenSim 0.9.0.1 into it's own branch.
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadPathTests.cs120
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadTests.cs84
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveSaveTests.cs60
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs74
4 files changed, 169 insertions, 169 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadPathTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadPathTests.cs
index c2e645f..86eca17 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 Dictionary<UUID, InventoryNodeBase> nodesLoaded = new Dictionary<UUID, 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 Dictionary<UUID, 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 Dictionary<UUID, 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