aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs211
2 files changed, 85 insertions, 128 deletions
diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
index adcf6bd..9216e0b 100644
--- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
@@ -762,7 +762,7 @@ namespace Flotsam.RegionModules.AssetCache
762 case "expire": 762 case "expire":
763 763
764 764
765 if (cmdparams.Length >= 3) 765 if (cmdparams.Length < 3)
766 { 766 {
767 m_log.InfoFormat("[FLOTSAM ASSET CACHE] Invalid parameters for Expire, please specify a valid date & time", cmd); 767 m_log.InfoFormat("[FLOTSAM ASSET CACHE] Invalid parameters for Expire, please specify a valid date & time", cmd);
768 break; 768 break;
diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
index 1200105..c3e57f0 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
@@ -42,6 +42,7 @@ using OpenSim.Region.CoreModules.World.Terrain;
42using OpenSim.Region.Framework.Scenes; 42using OpenSim.Region.Framework.Scenes;
43using OpenSim.Region.Framework.Scenes.Serialization; 43using OpenSim.Region.Framework.Scenes.Serialization;
44using OpenSim.Tests.Common; 44using OpenSim.Tests.Common;
45using OpenSim.Tests.Common.Mock;
45using OpenSim.Tests.Common.Setup; 46using OpenSim.Tests.Common.Setup;
46 47
47namespace OpenSim.Region.CoreModules.World.Archiver.Tests 48namespace OpenSim.Region.CoreModules.World.Archiver.Tests
@@ -51,6 +52,20 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
51 { 52 {
52 private Guid m_lastRequestId; 53 private Guid m_lastRequestId;
53 private string m_lastErrorMessage; 54 private string m_lastErrorMessage;
55
56 protected TestScene m_scene;
57 protected ArchiverModule m_archiverModule;
58
59 [SetUp]
60 public void SetUp()
61 {
62 m_archiverModule = new ArchiverModule();
63 SerialiserModule serialiserModule = new SerialiserModule();
64 TerrainModule terrainModule = new TerrainModule();
65
66 m_scene = SceneSetupHelpers.SetupScene("scene1");
67 SceneSetupHelpers.SetupSceneModules(m_scene, m_archiverModule, serialiserModule, terrainModule);
68 }
54 69
55 private void LoadCompleted(Guid requestId, string errorMessage) 70 private void LoadCompleted(Guid requestId, string errorMessage)
56 { 71 {
@@ -75,6 +90,30 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
75 } 90 }
76 } 91 }
77 92
93 protected SceneObjectPart CreateSceneObjectPart1()
94 {
95 string partName = "My Little Pony";
96 UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000015");
97 PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere();
98 Vector3 groupPosition = new Vector3(10, 20, 30);
99 Quaternion rotationOffset = new Quaternion(20, 30, 40, 50);
100 Vector3 offsetPosition = new Vector3(5, 10, 15);
101
102 return new SceneObjectPart(ownerId, shape, groupPosition, rotationOffset, offsetPosition) { Name = partName };
103 }
104
105 protected SceneObjectPart CreateSceneObjectPart2()
106 {
107 string partName = "Action Man";
108 UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000016");
109 PrimitiveBaseShape shape = PrimitiveBaseShape.CreateCylinder();
110 Vector3 groupPosition = new Vector3(90, 80, 70);
111 Quaternion rotationOffset = new Quaternion(60, 70, 80, 90);
112 Vector3 offsetPosition = new Vector3(20, 25, 30);
113
114 return new SceneObjectPart(ownerId, shape, groupPosition, rotationOffset, offsetPosition) { Name = partName };
115 }
116
78 /// <summary> 117 /// <summary>
79 /// Test saving a V0.2 OpenSim Region Archive. 118 /// Test saving a V0.2 OpenSim Region Archive.
80 /// </summary> 119 /// </summary>
@@ -84,59 +123,20 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
84 TestHelper.InMethod(); 123 TestHelper.InMethod();
85 //log4net.Config.XmlConfigurator.Configure(); 124 //log4net.Config.XmlConfigurator.Configure();
86 125
87 ArchiverModule archiverModule = new ArchiverModule(); 126 SceneObjectPart part1 = CreateSceneObjectPart1();
88 SerialiserModule serialiserModule = new SerialiserModule(); 127 m_scene.AddNewSceneObject(new SceneObjectGroup(part1), false);
89 TerrainModule terrainModule = new TerrainModule();
90
91 Scene scene = SceneSetupHelpers.SetupScene("asset");
92 SceneSetupHelpers.SetupSceneModules(scene, archiverModule, serialiserModule, terrainModule);
93
94 SceneObjectPart part1;
95
96 // Create and add prim 1
97 {
98 string partName = "My Little Pony";
99 UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000015");
100 PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere();
101 Vector3 groupPosition = new Vector3(10, 20, 30);
102 Quaternion rotationOffset = new Quaternion(20, 30, 40, 50);
103 Vector3 offsetPosition = new Vector3(5, 10, 15);
104
105 part1
106 = new SceneObjectPart(
107 ownerId, shape, groupPosition, rotationOffset, offsetPosition);
108 part1.Name = partName;
109
110 scene.AddNewSceneObject(new SceneObjectGroup(part1), false);
111 }
112
113 SceneObjectPart part2;
114 128
115 // Create and add prim 2 129 SceneObjectPart part2 = CreateSceneObjectPart2();
116 { 130 m_scene.AddNewSceneObject(new SceneObjectGroup(part2), false);
117 string partName = "Action Man";
118 UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000016");
119 PrimitiveBaseShape shape = PrimitiveBaseShape.CreateCylinder();
120 Vector3 groupPosition = new Vector3(90, 80, 70);
121 Quaternion rotationOffset = new Quaternion(60, 70, 80, 90);
122 Vector3 offsetPosition = new Vector3(20, 25, 30);
123
124 part2
125 = new SceneObjectPart(
126 ownerId, shape, groupPosition, rotationOffset, offsetPosition);
127 part2.Name = partName;
128
129 scene.AddNewSceneObject(new SceneObjectGroup(part2), false);
130 }
131 131
132 MemoryStream archiveWriteStream = new MemoryStream(); 132 MemoryStream archiveWriteStream = new MemoryStream();
133 scene.EventManager.OnOarFileSaved += SaveCompleted; 133 m_scene.EventManager.OnOarFileSaved += SaveCompleted;
134 134
135 Guid requestId = new Guid("00000000-0000-0000-0000-808080808080"); 135 Guid requestId = new Guid("00000000-0000-0000-0000-808080808080");
136 136
137 lock (this) 137 lock (this)
138 { 138 {
139 archiverModule.ArchiveRegion(archiveWriteStream, requestId); 139 m_archiverModule.ArchiveRegion(archiveWriteStream, requestId);
140 //AssetServerBase assetServer = (AssetServerBase)scene.CommsManager.AssetCache.AssetServer; 140 //AssetServerBase assetServer = (AssetServerBase)scene.CommsManager.AssetCache.AssetServer;
141 //while (assetServer.HasWaitingRequests()) 141 //while (assetServer.HasWaitingRequests())
142 // assetServer.ProcessNextRequest(); 142 // assetServer.ProcessNextRequest();
@@ -218,25 +218,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
218 218
219 tar.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, ArchiveWriteRequestExecution.Create0p2ControlFile()); 219 tar.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, ArchiveWriteRequestExecution.Create0p2ControlFile());
220 220
221 string part1Name = "object1"; 221 SceneObjectPart part1 = CreateSceneObjectPart1();
222 PrimitiveBaseShape shape = PrimitiveBaseShape.CreateCylinder();
223 Vector3 groupPosition = new Vector3(90, 80, 70);
224 Quaternion rotationOffset = new Quaternion(60, 70, 80, 90);
225 Vector3 offsetPosition = new Vector3(20, 25, 30);
226
227 SerialiserModule serialiserModule = new SerialiserModule();
228 ArchiverModule archiverModule = new ArchiverModule();
229
230 Scene scene = SceneSetupHelpers.SetupScene();
231 SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
232
233 SceneObjectPart part1
234 = new SceneObjectPart(
235 UUID.Zero, shape, groupPosition, rotationOffset, offsetPosition);
236 part1.Name = part1Name;
237 SceneObjectGroup object1 = new SceneObjectGroup(part1); 222 SceneObjectGroup object1 = new SceneObjectGroup(part1);
238 223
239 // Let's put some inventory items into our object 224 // Let's put some inventory items into our object
225 string soundItemName = "sound-item1";
240 UUID soundItemUuid = UUID.Parse("00000000-0000-0000-0000-000000000002"); 226 UUID soundItemUuid = UUID.Parse("00000000-0000-0000-0000-000000000002");
241 Type type = GetType(); 227 Type type = GetType();
242 Assembly assembly = type.Assembly; 228 Assembly assembly = type.Assembly;
@@ -269,17 +255,18 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
269 asset1FileName = ArchiveConstants.ASSETS_PATH + soundUuid + ".wav"; 255 asset1FileName = ArchiveConstants.ASSETS_PATH + soundUuid + ".wav";
270 */ 256 */
271 257
272 TaskInventoryItem item1 = new TaskInventoryItem { AssetID = soundUuid, ItemID = soundItemUuid }; 258 TaskInventoryItem item1
259 = new TaskInventoryItem { AssetID = soundUuid, ItemID = soundItemUuid, Name = soundItemName };
273 part1.Inventory.AddInventoryItem(item1, true); 260 part1.Inventory.AddInventoryItem(item1, true);
274 } 261 }
275 } 262 }
276 263
277 scene.AddNewSceneObject(object1, false); 264 m_scene.AddNewSceneObject(object1, false);
278 265
279 string object1FileName = string.Format( 266 string object1FileName = string.Format(
280 "{0}_{1:000}-{2:000}-{3:000}__{4}.xml", 267 "{0}_{1:000}-{2:000}-{3:000}__{4}.xml",
281 part1Name, 268 part1.Name,
282 Math.Round(groupPosition.X), Math.Round(groupPosition.Y), Math.Round(groupPosition.Z), 269 Math.Round(part1.GroupPosition.X), Math.Round(part1.GroupPosition.Y), Math.Round(part1.GroupPosition.Z),
283 part1.UUID); 270 part1.UUID);
284 tar.WriteFile(ArchiveConstants.OBJECTS_PATH + object1FileName, SceneObjectSerializer.ToXml2Format(object1)); 271 tar.WriteFile(ArchiveConstants.OBJECTS_PATH + object1FileName, SceneObjectSerializer.ToXml2Format(object1));
285 272
@@ -289,30 +276,27 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
289 276
290 lock (this) 277 lock (this)
291 { 278 {
292 scene.EventManager.OnOarFileLoaded += LoadCompleted; 279 m_scene.EventManager.OnOarFileLoaded += LoadCompleted;
293 archiverModule.DearchiveRegion(archiveReadStream); 280 m_archiverModule.DearchiveRegion(archiveReadStream);
294 } 281 }
295 282
296 Assert.That(m_lastErrorMessage, Is.Null); 283 Assert.That(m_lastErrorMessage, Is.Null);
297 284
298 SceneObjectPart object1PartLoaded = scene.GetSceneObjectPart(part1Name); 285 SceneObjectPart object1PartLoaded = m_scene.GetSceneObjectPart(part1.Name);
299 286
300 Assert.That(object1PartLoaded, Is.Not.Null, "object1 was not loaded"); 287 Assert.That(object1PartLoaded, Is.Not.Null, "object1 was not loaded");
301 Assert.That(object1PartLoaded.Name, Is.EqualTo(part1Name), "object1 names not identical"); 288 Assert.That(object1PartLoaded.Name, Is.EqualTo(part1.Name), "object1 names not identical");
302 Assert.That(object1PartLoaded.GroupPosition, Is.EqualTo(groupPosition), "object1 group position not equal"); 289 Assert.That(object1PartLoaded.GroupPosition, Is.EqualTo(part1.GroupPosition), "object1 group position not equal");
303 Assert.That( 290 Assert.That(
304 object1PartLoaded.RotationOffset, Is.EqualTo(rotationOffset), "object1 rotation offset not equal"); 291 object1PartLoaded.RotationOffset, Is.EqualTo(part1.RotationOffset), "object1 rotation offset not equal");
305 Assert.That( 292 Assert.That(
306 object1PartLoaded.OffsetPosition, Is.EqualTo(offsetPosition), "object1 offset position not equal"); 293 object1PartLoaded.OffsetPosition, Is.EqualTo(part1.OffsetPosition), "object1 offset position not equal");
307 294
308 // Need to implement a method to get the task inventory item by name (since the uuid will have changed on load) 295 TaskInventoryItem loadedSoundItem = object1PartLoaded.Inventory.GetInventoryItems(soundItemName)[0];
309 /*
310 TaskInventoryItem loadedSoundItem = object1PartLoaded.Inventory.GetInventoryItem(soundItemUuid);
311 Assert.That(loadedSoundItem, Is.Not.Null, "loaded sound item was null"); 296 Assert.That(loadedSoundItem, Is.Not.Null, "loaded sound item was null");
312 AssetBase loadedSoundAsset = scene.AssetService.Get(loadedSoundItem.AssetID.ToString()); 297 AssetBase loadedSoundAsset = m_scene.AssetService.Get(loadedSoundItem.AssetID.ToString());
313 Assert.That(loadedSoundAsset, Is.Not.Null, "loaded sound asset was null"); 298 Assert.That(loadedSoundAsset, Is.Not.Null, "loaded sound asset was null");
314 Assert.That(loadedSoundAsset.Data, Is.EqualTo(soundData), "saved and loaded sound data do not match"); 299 Assert.That(loadedSoundAsset.Data, Is.EqualTo(soundData), "saved and loaded sound data do not match");
315 */
316 300
317 // Temporary 301 // Temporary
318 Console.WriteLine("Successfully completed {0}", MethodBase.GetCurrentMethod()); 302 Console.WriteLine("Successfully completed {0}", MethodBase.GetCurrentMethod());
@@ -325,12 +309,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
325 public void TestLoadOarV0_2RegionSettings() 309 public void TestLoadOarV0_2RegionSettings()
326 { 310 {
327 TestHelper.InMethod(); 311 TestHelper.InMethod();
328 //log4net.Config.XmlConfigurator.Configure(); 312 //log4net.Config.XmlConfigurator.Configure();
329
330 SerialiserModule serialiserModule = new SerialiserModule();
331 ArchiverModule archiverModule = new ArchiverModule();
332 Scene scene = SceneSetupHelpers.SetupScene();
333 SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
334 313
335 MemoryStream archiveWriteStream = new MemoryStream(); 314 MemoryStream archiveWriteStream = new MemoryStream();
336 TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream); 315 TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream);
@@ -377,12 +356,12 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
377 356
378 lock (this) 357 lock (this)
379 { 358 {
380 scene.EventManager.OnOarFileLoaded += LoadCompleted; 359 m_scene.EventManager.OnOarFileLoaded += LoadCompleted;
381 archiverModule.DearchiveRegion(archiveReadStream); 360 m_archiverModule.DearchiveRegion(archiveReadStream);
382 } 361 }
383 362
384 Assert.That(m_lastErrorMessage, Is.Null); 363 Assert.That(m_lastErrorMessage, Is.Null);
385 RegionSettings loadedRs = scene.RegionInfo.RegionSettings; 364 RegionSettings loadedRs = m_scene.RegionInfo.RegionSettings;
386 365
387 Assert.That(loadedRs.AgentLimit, Is.EqualTo(17)); 366 Assert.That(loadedRs.AgentLimit, Is.EqualTo(17));
388 Assert.That(loadedRs.AllowDamage, Is.True); 367 Assert.That(loadedRs.AllowDamage, Is.True);
@@ -426,11 +405,13 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
426 405
427 MemoryStream archiveWriteStream = new MemoryStream(); 406 MemoryStream archiveWriteStream = new MemoryStream();
428 407
429 string part2Name = "objectMerge"; 408// string part2Name = "objectMerge";
430 PrimitiveBaseShape part2Shape = PrimitiveBaseShape.CreateCylinder(); 409// PrimitiveBaseShape part2Shape = PrimitiveBaseShape.CreateCylinder();
431 Vector3 part2GroupPosition = new Vector3(90, 80, 70); 410// Vector3 part2GroupPosition = new Vector3(90, 80, 70);
432 Quaternion part2RotationOffset = new Quaternion(60, 70, 80, 90); 411// Quaternion part2RotationOffset = new Quaternion(60, 70, 80, 90);
433 Vector3 part2OffsetPosition = new Vector3(20, 25, 30); 412// Vector3 part2OffsetPosition = new Vector3(20, 25, 30);
413
414 SceneObjectPart part2 = CreateSceneObjectPart2();
434 415
435 // Create an oar file that we can use for the merge 416 // Create an oar file that we can use for the merge
436 { 417 {
@@ -439,63 +420,39 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
439 TerrainModule terrainModule = new TerrainModule(); 420 TerrainModule terrainModule = new TerrainModule();
440 421
441 Scene scene = SceneSetupHelpers.SetupScene(); 422 Scene scene = SceneSetupHelpers.SetupScene();
442 SceneSetupHelpers.SetupSceneModules(scene, archiverModule, serialiserModule, terrainModule); 423 SceneSetupHelpers.SetupSceneModules(scene, archiverModule, serialiserModule, terrainModule);
443 424
444 SceneObjectPart part2 425 m_scene.AddNewSceneObject(new SceneObjectGroup(part2), false);
445 = new SceneObjectPart(
446 UUID.Zero, part2Shape, part2GroupPosition, part2RotationOffset, part2OffsetPosition);
447 part2.Name = part2Name;
448 SceneObjectGroup object2 = new SceneObjectGroup(part2);
449
450 scene.AddNewSceneObject(object2, false);
451 426
452 // Write out this scene 427 // Write out this scene
453 scene.EventManager.OnOarFileSaved += SaveCompleted; 428 scene.EventManager.OnOarFileSaved += SaveCompleted;
454 429
455 lock (this) 430 lock (this)
456 { 431 {
457 archiverModule.ArchiveRegion(archiveWriteStream); 432 m_archiverModule.ArchiveRegion(archiveWriteStream);
458 Monitor.Wait(this, 60000); 433 Monitor.Wait(this, 60000);
459 } 434 }
460 } 435 }
461 436
462 { 437 {
463 ArchiverModule archiverModule = new ArchiverModule(); 438 SceneObjectPart part1 = CreateSceneObjectPart1();
464 SerialiserModule serialiserModule = new SerialiserModule(); 439 m_scene.AddNewSceneObject(new SceneObjectGroup(part1), false);
465 TerrainModule terrainModule = new TerrainModule();
466
467 Scene scene = SceneSetupHelpers.SetupScene();
468 SceneSetupHelpers.SetupSceneModules(scene, archiverModule, serialiserModule, terrainModule);
469
470 string part1Name = "objectExisting";
471 PrimitiveBaseShape part1Shape = PrimitiveBaseShape.CreateCylinder();
472 Vector3 part1GroupPosition = new Vector3(80, 70, 60);
473 Quaternion part1RotationOffset = new Quaternion(50, 60, 70, 80);
474 Vector3 part1OffsetPosition = new Vector3(15, 20, 25);
475
476 SceneObjectPart part1
477 = new SceneObjectPart(
478 UUID.Zero, part1Shape, part1GroupPosition, part1RotationOffset, part1OffsetPosition);
479 part1.Name = part1Name;
480 SceneObjectGroup object1 = new SceneObjectGroup(part1);
481
482 scene.AddNewSceneObject(object1, false);
483 440
484 // Merge in the archive we created earlier 441 // Merge in the archive we created earlier
485 byte[] archive = archiveWriteStream.ToArray(); 442 byte[] archive = archiveWriteStream.ToArray();
486 MemoryStream archiveReadStream = new MemoryStream(archive); 443 MemoryStream archiveReadStream = new MemoryStream(archive);
487 444
488 archiverModule.DearchiveRegion(archiveReadStream, true, Guid.Empty); 445 m_archiverModule.DearchiveRegion(archiveReadStream, true, Guid.Empty);
489 446
490 SceneObjectPart object1Existing = scene.GetSceneObjectPart(part1Name); 447 SceneObjectPart object1Existing = m_scene.GetSceneObjectPart(part1.Name);
491 Assert.That(object1Existing, Is.Not.Null, "object1 was not present after merge"); 448 Assert.That(object1Existing, Is.Not.Null, "object1 was not present after merge");
492 Assert.That(object1Existing.Name, Is.EqualTo(part1Name), "object1 names not identical after merge"); 449 Assert.That(object1Existing.Name, Is.EqualTo(part1.Name), "object1 names not identical after merge");
493 Assert.That(object1Existing.GroupPosition, Is.EqualTo(part1GroupPosition), "object1 group position not equal after merge"); 450 Assert.That(object1Existing.GroupPosition, Is.EqualTo(part1.GroupPosition), "object1 group position not equal after merge");
494 451
495 SceneObjectPart object2PartMerged = scene.GetSceneObjectPart(part2Name); 452 SceneObjectPart object2PartMerged = m_scene.GetSceneObjectPart(part2.Name);
496 Assert.That(object2PartMerged, Is.Not.Null, "object2 was not present after merge"); 453 Assert.That(object2PartMerged, Is.Not.Null, "object2 was not present after merge");
497 Assert.That(object2PartMerged.Name, Is.EqualTo(part2Name), "object2 names not identical after merge"); 454 Assert.That(object2PartMerged.Name, Is.EqualTo(part2.Name), "object2 names not identical after merge");
498 Assert.That(object2PartMerged.GroupPosition, Is.EqualTo(part2GroupPosition), "object2 group position not equal after merge"); 455 Assert.That(object2PartMerged.GroupPosition, Is.EqualTo(part2.GroupPosition), "object2 group position not equal after merge");
499 } 456 }
500 } 457 }
501 } 458 }