* Extend archive test to check for the presence of a control file in a saved archive
parent
04a565e6b1
commit
664f983943
|
@ -41,7 +41,7 @@ namespace OpenSim.Framework.Communications
|
|||
private byte m_completed;
|
||||
|
||||
/// <summary>
|
||||
/// Did process complete synchroneously?
|
||||
/// Did process complete synchronously?
|
||||
/// </summary>
|
||||
/// <remarks>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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
@ -39,10 +45,36 @@ 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.
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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");
|
||||
|
|
|
@ -99,7 +99,17 @@ namespace OpenSim.Tests.Common.Setup
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Setup the given modules for a given scene.
|
||||
/// Setup modules for a scene using their default settings.
|
||||
/// </summary>
|
||||
/// <param name="scene"></param>
|
||||
/// <param name="modules"></param>
|
||||
public static void SetupSceneModules(Scene scene, params IRegionModule[] modules)
|
||||
{
|
||||
SetupSceneModules(scene, null, modules);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Setup modules for a scene.
|
||||
/// </summary>
|
||||
/// <param name="scene"></param>
|
||||
/// <param name="config"></param>
|
||||
|
|
Loading…
Reference in New Issue