diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs | 83 |
1 files changed, 80 insertions, 3 deletions
diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs index eec3c1b..63f1363 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs | |||
@@ -248,9 +248,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests | |||
248 | Dictionary<string, Object> options = new Dictionary<string, Object>(); | 248 | Dictionary<string, Object> options = new Dictionary<string, Object>(); |
249 | options.Add("noassets", true); | 249 | options.Add("noassets", true); |
250 | m_archiverModule.ArchiveRegion(archiveWriteStream, requestId, options); | 250 | m_archiverModule.ArchiveRegion(archiveWriteStream, requestId, options); |
251 | //AssetServerBase assetServer = (AssetServerBase)scene.CommsManager.AssetCache.AssetServer; | ||
252 | //while (assetServer.HasWaitingRequests()) | ||
253 | // assetServer.ProcessNextRequest(); | ||
254 | 251 | ||
255 | // Don't wait for completion - with --noassets save oar happens synchronously | 252 | // Don't wait for completion - with --noassets save oar happens synchronously |
256 | // Monitor.Wait(this, 60000); | 253 | // Monitor.Wait(this, 60000); |
@@ -410,6 +407,86 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests | |||
410 | } | 407 | } |
411 | 408 | ||
412 | /// <summary> | 409 | /// <summary> |
410 | /// Test loading an OpenSim Region Archive saved with the --publish option. | ||
411 | /// </summary> | ||
412 | [Test] | ||
413 | public void TestLoadPublishedOar() | ||
414 | { | ||
415 | TestHelpers.InMethod(); | ||
416 | // log4net.Config.XmlConfigurator.Configure(); | ||
417 | |||
418 | SceneObjectPart part1 = CreateSceneObjectPart1(); | ||
419 | SceneObjectGroup sog1 = new SceneObjectGroup(part1); | ||
420 | m_scene.AddNewSceneObject(sog1, false); | ||
421 | |||
422 | SceneObjectPart part2 = CreateSceneObjectPart2(); | ||
423 | |||
424 | AssetNotecard nc = new AssetNotecard(); | ||
425 | nc.BodyText = "Hello World!"; | ||
426 | nc.Encode(); | ||
427 | UUID ncAssetUuid = new UUID("00000000-0000-0000-1000-000000000000"); | ||
428 | UUID ncItemUuid = new UUID("00000000-0000-0000-1100-000000000000"); | ||
429 | AssetBase ncAsset | ||
430 | = AssetHelpers.CreateAsset(ncAssetUuid, AssetType.Notecard, nc.AssetData, UUID.Zero); | ||
431 | m_scene.AssetService.Store(ncAsset); | ||
432 | SceneObjectGroup sog2 = new SceneObjectGroup(part2); | ||
433 | TaskInventoryItem ncItem | ||
434 | = new TaskInventoryItem { Name = "ncItem", AssetID = ncAssetUuid, ItemID = ncItemUuid }; | ||
435 | part2.Inventory.AddInventoryItem(ncItem, true); | ||
436 | |||
437 | m_scene.AddNewSceneObject(sog2, false); | ||
438 | |||
439 | MemoryStream archiveWriteStream = new MemoryStream(); | ||
440 | m_scene.EventManager.OnOarFileSaved += SaveCompleted; | ||
441 | |||
442 | Guid requestId = new Guid("00000000-0000-0000-0000-808080808080"); | ||
443 | |||
444 | lock (this) | ||
445 | { | ||
446 | m_archiverModule.ArchiveRegion( | ||
447 | archiveWriteStream, requestId, new Dictionary<string, Object>() { { "wipe-owners", Boolean.TrueString } }); | ||
448 | |||
449 | Monitor.Wait(this, 60000); | ||
450 | } | ||
451 | |||
452 | Assert.That(m_lastRequestId, Is.EqualTo(requestId)); | ||
453 | |||
454 | byte[] archive = archiveWriteStream.ToArray(); | ||
455 | MemoryStream archiveReadStream = new MemoryStream(archive); | ||
456 | |||
457 | { | ||
458 | UUID estateOwner = TestHelpers.ParseTail(0x4747); | ||
459 | UUID objectOwner = TestHelpers.ParseTail(0x15); | ||
460 | |||
461 | // Reload to new scene | ||
462 | ArchiverModule archiverModule = new ArchiverModule(); | ||
463 | SerialiserModule serialiserModule = new SerialiserModule(); | ||
464 | TerrainModule terrainModule = new TerrainModule(); | ||
465 | |||
466 | TestScene scene2 = SceneHelpers.SetupScene(); | ||
467 | SceneHelpers.SetupSceneModules(scene2, archiverModule, serialiserModule, terrainModule); | ||
468 | |||
469 | // Make sure there's a valid owner for the owner we saved (this should have been wiped if the code is | ||
470 | // behaving correctly | ||
471 | UserAccountHelpers.CreateUserWithInventory(scene2, objectOwner); | ||
472 | |||
473 | scene2.RegionInfo.EstateSettings.EstateOwner = estateOwner; | ||
474 | |||
475 | lock (this) | ||
476 | { | ||
477 | scene2.EventManager.OnOarFileLoaded += LoadCompleted; | ||
478 | archiverModule.DearchiveRegion(archiveReadStream); | ||
479 | } | ||
480 | |||
481 | Assert.That(m_lastErrorMessage, Is.Null); | ||
482 | |||
483 | SceneObjectGroup loadedSog = scene2.GetSceneObjectGroup(part1.Name); | ||
484 | Assert.That(loadedSog.OwnerID, Is.EqualTo(estateOwner)); | ||
485 | Assert.That(loadedSog.LastOwnerID, Is.EqualTo(estateOwner)); | ||
486 | } | ||
487 | } | ||
488 | |||
489 | /// <summary> | ||
413 | /// Test loading the region settings of an OpenSim Region Archive. | 490 | /// Test loading the region settings of an OpenSim Region Archive. |
414 | /// </summary> | 491 | /// </summary> |
415 | [Test] | 492 | [Test] |