diff options
author | Oren Hurvitz | 2012-07-24 19:48:08 +0300 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-09-14 20:25:03 +0100 |
commit | ce468215d576cc301a261d85bee9baa68a246ce6 (patch) | |
tree | ad2c6d7e3156bf8dab596f2772cc712d4f96c698 /OpenSim/Region/CoreModules/World/Archiver/Tests | |
parent | Don't store the unnecessary VERSIONMIN. VERSIONMAX, METHOD or UserID (present... (diff) | |
download | opensim-SC_OLD-ce468215d576cc301a261d85bee9baa68a246ce6.zip opensim-SC_OLD-ce468215d576cc301a261d85bee9baa68a246ce6.tar.gz opensim-SC_OLD-ce468215d576cc301a261d85bee9baa68a246ce6.tar.bz2 opensim-SC_OLD-ce468215d576cc301a261d85bee9baa68a246ce6.tar.xz |
Support multi-region OAR files
Merged ArchiveWriteRequestPreparation.cs and ArchiveWriteRequestExecution.cs. This simplifies the code, and it's faster to write each scene to the archive as it's found rather than all at once at the end.
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Archiver/Tests')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs index 904110e..cfdfd8c 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs | |||
@@ -47,6 +47,7 @@ using ArchiveConstants = OpenSim.Framework.Serialization.ArchiveConstants; | |||
47 | using TarArchiveReader = OpenSim.Framework.Serialization.TarArchiveReader; | 47 | using TarArchiveReader = OpenSim.Framework.Serialization.TarArchiveReader; |
48 | using TarArchiveWriter = OpenSim.Framework.Serialization.TarArchiveWriter; | 48 | using TarArchiveWriter = OpenSim.Framework.Serialization.TarArchiveWriter; |
49 | using RegionSettings = OpenSim.Framework.RegionSettings; | 49 | using RegionSettings = OpenSim.Framework.RegionSettings; |
50 | using OpenSim.Region.Framework.Interfaces; | ||
50 | 51 | ||
51 | namespace OpenSim.Region.CoreModules.World.Archiver.Tests | 52 | namespace OpenSim.Region.CoreModules.World.Archiver.Tests |
52 | { | 53 | { |
@@ -70,9 +71,12 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests | |||
70 | 71 | ||
71 | m_scene = new SceneHelpers().SetupScene(); | 72 | m_scene = new SceneHelpers().SetupScene(); |
72 | SceneHelpers.SetupSceneModules(m_scene, m_archiverModule, serialiserModule, terrainModule); | 73 | SceneHelpers.SetupSceneModules(m_scene, m_archiverModule, serialiserModule, terrainModule); |
74 | |||
75 | new SceneManager(); | ||
76 | SceneManager.Instance.Add(m_scene); | ||
73 | } | 77 | } |
74 | 78 | ||
75 | private void LoadCompleted(Guid requestId, string errorMessage) | 79 | private void LoadCompleted(Guid requestId, List<UUID> loadedScenes, string errorMessage) |
76 | { | 80 | { |
77 | lock (this) | 81 | lock (this) |
78 | { | 82 | { |
@@ -186,7 +190,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests | |||
186 | Assert.That(filePath, Is.EqualTo(ArchiveConstants.CONTROL_FILE_PATH)); | 190 | Assert.That(filePath, Is.EqualTo(ArchiveConstants.CONTROL_FILE_PATH)); |
187 | 191 | ||
188 | ArchiveReadRequest arr = new ArchiveReadRequest(m_scene, (Stream)null, false, false, Guid.Empty); | 192 | ArchiveReadRequest arr = new ArchiveReadRequest(m_scene, (Stream)null, false, false, Guid.Empty); |
189 | arr.LoadControlFile(filePath, data); | 193 | arr.LoadControlFile(filePath, data, new DearchiveScenesInfo()); |
190 | 194 | ||
191 | Assert.That(arr.ControlFileLoaded, Is.True); | 195 | Assert.That(arr.ControlFileLoaded, Is.True); |
192 | 196 | ||
@@ -270,7 +274,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests | |||
270 | Assert.That(filePath, Is.EqualTo(ArchiveConstants.CONTROL_FILE_PATH)); | 274 | Assert.That(filePath, Is.EqualTo(ArchiveConstants.CONTROL_FILE_PATH)); |
271 | 275 | ||
272 | ArchiveReadRequest arr = new ArchiveReadRequest(m_scene, (Stream)null, false, false, Guid.Empty); | 276 | ArchiveReadRequest arr = new ArchiveReadRequest(m_scene, (Stream)null, false, false, Guid.Empty); |
273 | arr.LoadControlFile(filePath, data); | 277 | arr.LoadControlFile(filePath, data, new DearchiveScenesInfo()); |
274 | 278 | ||
275 | Assert.That(arr.ControlFileLoaded, Is.True); | 279 | Assert.That(arr.ControlFileLoaded, Is.True); |
276 | 280 | ||
@@ -307,7 +311,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests | |||
307 | 311 | ||
308 | tar.WriteFile( | 312 | tar.WriteFile( |
309 | ArchiveConstants.CONTROL_FILE_PATH, | 313 | ArchiveConstants.CONTROL_FILE_PATH, |
310 | new ArchiveWriteRequestPreparation(null, (Stream)null, Guid.Empty).CreateControlFile(new Dictionary<string, Object>())); | 314 | new ArchiveWriteRequestPreparation(m_scene, (Stream)null, Guid.Empty).CreateControlFile(new ArchiveScenesGroup())); |
311 | 315 | ||
312 | SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, ownerId, "obj1-", 0x11); | 316 | SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, ownerId, "obj1-", 0x11); |
313 | SceneObjectPart sop2 | 317 | SceneObjectPart sop2 |
@@ -362,11 +366,10 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests | |||
362 | // Also check that direct entries which will also have a file entry containing that directory doesn't | 366 | // Also check that direct entries which will also have a file entry containing that directory doesn't |
363 | // upset load | 367 | // upset load |
364 | tar.WriteDir(ArchiveConstants.TERRAINS_PATH); | 368 | tar.WriteDir(ArchiveConstants.TERRAINS_PATH); |
365 | 369 | ||
366 | tar.WriteFile( | 370 | tar.WriteFile( |
367 | ArchiveConstants.CONTROL_FILE_PATH, | 371 | ArchiveConstants.CONTROL_FILE_PATH, |
368 | new ArchiveWriteRequestPreparation(null, (Stream)null, Guid.Empty).CreateControlFile(new Dictionary<string, Object>())); | 372 | new ArchiveWriteRequestPreparation(m_scene, (Stream)null, Guid.Empty).CreateControlFile(new ArchiveScenesGroup())); |
369 | |||
370 | SceneObjectPart part1 = CreateSceneObjectPart1(); | 373 | SceneObjectPart part1 = CreateSceneObjectPart1(); |
371 | 374 | ||
372 | part1.SitTargetOrientation = new Quaternion(0.2f, 0.3f, 0.4f, 0.5f); | 375 | part1.SitTargetOrientation = new Quaternion(0.2f, 0.3f, 0.4f, 0.5f); |
@@ -519,6 +522,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests | |||
519 | TestScene scene2 = new SceneHelpers().SetupScene(); | 522 | TestScene scene2 = new SceneHelpers().SetupScene(); |
520 | SceneHelpers.SetupSceneModules(scene2, archiverModule, serialiserModule, terrainModule); | 523 | SceneHelpers.SetupSceneModules(scene2, archiverModule, serialiserModule, terrainModule); |
521 | 524 | ||
525 | SceneManager.Instance.Add(scene2); | ||
526 | |||
522 | // Make sure there's a valid owner for the owner we saved (this should have been wiped if the code is | 527 | // Make sure there's a valid owner for the owner we saved (this should have been wiped if the code is |
523 | // behaving correctly | 528 | // behaving correctly |
524 | UserAccountHelpers.CreateUserWithInventory(scene2, objectOwner); | 529 | UserAccountHelpers.CreateUserWithInventory(scene2, objectOwner); |
@@ -554,7 +559,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests | |||
554 | tar.WriteDir(ArchiveConstants.TERRAINS_PATH); | 559 | tar.WriteDir(ArchiveConstants.TERRAINS_PATH); |
555 | tar.WriteFile( | 560 | tar.WriteFile( |
556 | ArchiveConstants.CONTROL_FILE_PATH, | 561 | ArchiveConstants.CONTROL_FILE_PATH, |
557 | new ArchiveWriteRequestPreparation(null, (Stream)null, Guid.Empty).CreateControlFile(new Dictionary<string, Object>())); | 562 | new ArchiveWriteRequestPreparation(m_scene, (Stream)null, Guid.Empty).CreateControlFile(new ArchiveScenesGroup())); |
558 | 563 | ||
559 | RegionSettings rs = new RegionSettings(); | 564 | RegionSettings rs = new RegionSettings(); |
560 | rs.AgentLimit = 17; | 565 | rs.AgentLimit = 17; |