From 664f983943dd94d35184f5c0f69f8c58a011ba3a Mon Sep 17 00:00:00 2001
From: Justin Clarke Casey
Date: Fri, 23 Jan 2009 19:24:36 +0000
Subject: * Extend archive test to check for the presence of a control file in
a saved archive
---
.../Framework/Communications/GenericAsyncResult.cs | 3 +-
OpenSim/Framework/Communications/LoginService.cs | 1 +
.../Modules/World/Archiver/ArchiveReadRequest.cs | 7 ++--
.../Modules/World/Archiver/Tests/ArchiverTests.cs | 40 +++++++++++++++++++---
.../Scenes/Tests/StandaloneTeleportTests.cs | 2 +-
OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs | 14 ++++++--
6 files changed, 55 insertions(+), 12 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Framework/Communications/GenericAsyncResult.cs b/OpenSim/Framework/Communications/GenericAsyncResult.cs
index e85289a..62a921a 100644
--- a/OpenSim/Framework/Communications/GenericAsyncResult.cs
+++ b/OpenSim/Framework/Communications/GenericAsyncResult.cs
@@ -41,7 +41,7 @@ namespace OpenSim.Framework.Communications
private byte m_completed;
///
- /// Did process complete synchroneously?
+ /// Did process complete synchronously?
///
/// I have a hard time imagining a scenario where this is the case, again, same issue about
/// booleans and VolatileRead as m_completed
@@ -87,6 +87,7 @@ namespace OpenSim.Framework.Communications
}
}
}
+
return m_waitHandle;
}
}
diff --git a/OpenSim/Framework/Communications/LoginService.cs b/OpenSim/Framework/Communications/LoginService.cs
index 1abfc78..fe904b5 100644
--- a/OpenSim/Framework/Communications/LoginService.cs
+++ b/OpenSim/Framework/Communications/LoginService.cs
@@ -108,6 +108,7 @@ namespace OpenSim.Framework.Communications
{
// Temporary fix
m_loginMutex.WaitOne();
+
try
{
//CFK: CustomizeResponse contains sufficient strings to alleviate the need for this.
diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs
index 09776a7..bd58e7c 100644
--- a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs
+++ b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs
@@ -94,11 +94,13 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
byte[] data;
TarArchiveReader.TarEntryType entryType;
+
while ((data = archive.ReadEntry(out filePath, out entryType)) != null)
{
//m_log.DebugFormat(
// "[ARCHIVER]: Successfully read {0} ({1} bytes)}", filePath, data.Length);
- if (entryType==TarArchiveReader.TarEntryType.TYPE_DIRECTORY) {
+ if (TarArchiveReader.TarEntryType.TYPE_DIRECTORY == entryType)
+ {
m_log.WarnFormat("[ARCHIVER]: Ignoring directory entry {0}",
filePath);
}
@@ -407,7 +409,6 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
private static Stream URIFetch(Uri uri)
{
-
HttpWebRequest request = (HttpWebRequest) WebRequest.Create(uri);
// request.Credentials = credentials;
@@ -425,8 +426,6 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
// return new BufferedStream(file, (int) response.ContentLength);
return new BufferedStream(file, 1000000);
-
}
-
}
}
diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/Environment/Modules/World/Archiver/Tests/ArchiverTests.cs
index 149293d..db296b0 100644
--- a/OpenSim/Region/Environment/Modules/World/Archiver/Tests/ArchiverTests.cs
+++ b/OpenSim/Region/Environment/Modules/World/Archiver/Tests/ArchiverTests.cs
@@ -25,8 +25,14 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+using System.IO;
using NUnit.Framework;
+using NUnit.Framework.SyntaxHelpers;
+using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Modules.World.Archiver;
+using OpenSim.Region.Environment.Modules.World.Terrain;
+using OpenSim.Region.Environment.Scenes;
+using OpenSim.Tests.Common.Setup;
namespace OpenSim.Region.Environment.Modules.World.Archiver.Tests
{
@@ -38,11 +44,37 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver.Tests
///
[Test]
public void TestSaveOarV0p2()
- {
- // Create an archive containing only a terrain
- //TarArchiveWriter taw = new TarArchiveWriter();
+ {
+ //log4net.Config.XmlConfigurator.Configure();
- //System.Console.WriteLine("wibble");
+ ArchiverModule archiverModule = new ArchiverModule();
+ TerrainModule terrainModule = new TerrainModule();
+
+ Scene scene = SceneSetupHelpers.SetupScene();
+ SceneSetupHelpers.SetupSceneModules(scene, archiverModule, terrainModule);
+
+ MemoryStream archiveWriteStream = new MemoryStream();
+ archiverModule.ArchiveRegion(archiveWriteStream);
+
+ // If there are no assets to fetch, then the entire archive region code path will execute in this thread,
+ // so no need to worry about signalling.
+ MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray());
+ TarArchiveReader tar = new TarArchiveReader(archiveReadStream);
+
+ bool gotControlFile = false;
+
+ string filePath;
+ TarArchiveReader.TarEntryType tarEntryType;
+
+ while (tar.ReadEntry(out filePath, out tarEntryType) != null)
+ {
+ if (ArchiveConstants.CONTROL_FILE_PATH == filePath)
+ gotControlFile = true;
+ }
+
+ Assert.That(gotControlFile, Is.True, "No control file in archive");
+
+ // TODO: Test presence of more files and contents of files.
}
}
}
\ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/Tests/StandaloneTeleportTests.cs b/OpenSim/Region/Environment/Scenes/Tests/StandaloneTeleportTests.cs
index 0c7de74..221d97f 100644
--- a/OpenSim/Region/Environment/Scenes/Tests/StandaloneTeleportTests.cs
+++ b/OpenSim/Region/Environment/Scenes/Tests/StandaloneTeleportTests.cs
@@ -52,7 +52,7 @@ namespace OpenSim.Region.Environment.Scenes.Tests
[Test]
public void TestSimpleNotNeighboursTeleport()
{
- log4net.Config.XmlConfigurator.Configure();
+ //log4net.Config.XmlConfigurator.Configure();
UUID sceneAId = UUID.Parse("00000000-0000-0000-0000-000000000100");
UUID sceneBId = UUID.Parse("00000000-0000-0000-0000-000000000200");
diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
index 74f177a..44c32ff 100644
--- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
+++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
@@ -96,10 +96,20 @@ namespace OpenSim.Tests.Common.Setup
= physicsPluginManager.GetPhysicsScene("basicphysics", "ZeroMesher", configSource, "test");
return testScene;
- }
+ }
+
+ ///
+ /// Setup modules for a scene using their default settings.
+ ///
+ ///
+ ///
+ public static void SetupSceneModules(Scene scene, params IRegionModule[] modules)
+ {
+ SetupSceneModules(scene, null, modules);
+ }
///
- /// Setup the given modules for a given scene.
+ /// Setup modules for a scene.
///
///
///
--
cgit v1.1