* Write a simple archive loading test which doesn't actually do any testing yet apart from not blow up

0.6.3-post-fixes
Justin Clarke Casey 2009-01-23 20:38:44 +00:00
parent bd2c345e56
commit dbd2b45233
5 changed files with 43 additions and 12 deletions

View File

@ -41,16 +41,12 @@ namespace OpenSim.Framework.Communications.Cache
/// <summary>
/// Manages local cache of assets and their sending to viewers.
/// </summary>
///
/// This class actually encapsulates two largely separate mechanisms. One mechanism fetches assets either
/// synchronously or async and passes the data back to the requester. The second mechanism fetches assets and
/// sends packetised data directly back to the client. The only point where they meet is AssetReceived() and
/// AssetNotFound(), which means they do share the same asset and texture caches.
///
/// TODO: Assets in this cache are effectively immortal (they are never disposed of through old age).
/// This is not a huge problem at the moment since other memory use usually dwarfs that used by assets
/// but it's something to bear in mind.
/// </summary>
/// AssetNotFound(), which means they do share the same asset and texture caches.I agr
public class AssetCache : IAssetReceiver
{
protected ICache m_memcache = new SimpleMemoryCache();

View File

@ -277,6 +277,17 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
m_scene.AssetCache.AddAsset(asset);
/**
* Create layers on decode for image assets. This is likely to significantly increase the time to load archives so
* it might be best done when dearchive takes place on a separate thread
if (asset.Type=AssetType.Texture)
{
IJ2KDecoder cacheLayerDecode = scene.RequestModuleInterface<IJ2KDecoder>();
if (cacheLayerDecode != null)
cacheLayerDecode.syncdecode(asset.FullID, asset.Data);
}
*/
return true;
}
else

View File

@ -88,7 +88,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
TarArchiveWriter archive = new TarArchiveWriter();
// Write out control file
archive.AddFile(ArchiveConstants.CONTROL_FILE_PATH, CreateControlFile());
archive.AddFile(ArchiveConstants.CONTROL_FILE_PATH, Create0p2ControlFile());
// Write out region settings
string settingsPath = String.Format("{0}{1}.xml", ArchiveConstants.SETTINGS_PATH, m_regionInfo.RegionName);
@ -129,10 +129,10 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
}
/// <summary>
/// Create the control file for this archive
/// Create the control file for a 0.2 version archive
/// </summary>
/// <returns></returns>
protected string CreateControlFile()
public static string Create0p2ControlFile()
{
StringWriter sw = new StringWriter();
XmlTextWriter xtw = new XmlTextWriter(sw);

View File

@ -32,7 +32,7 @@ using System.Text;
//using System.Reflection;
//using log4net;
namespace OpenSim.Region.Environment
namespace OpenSim.Region.Environment.Modules.World.Archiver
{
/// <summary>
/// Temporary code to produce a tar archive in tar v7 format

View File

@ -40,7 +40,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver.Tests
public class ArchiverTests
{
/// <summary>
/// Test saving a V0.2 OpenSim Region Archive. Does not yet do what it says on the tin
/// Test saving a V0.2 OpenSim Region Archive.
/// </summary>
[Test]
public void TestSaveOarV0p2()
@ -76,5 +76,29 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver.Tests
// TODO: Test presence of more files and contents of files.
}
/// <summary>
/// Test loading a V0.2 OpenSim Region Archive. Does not yet do what it says on the tin.
/// </summary>
[Test]
public void TestLoadOarV0p2()
{
MemoryStream archiveWriteStream = new MemoryStream();
TarArchiveWriter tar = new TarArchiveWriter();
tar.AddFile(ArchiveConstants.CONTROL_FILE_PATH, ArchiveWriteRequestExecution.Create0p2ControlFile());
tar.WriteTar(archiveWriteStream);
MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray());
ArchiverModule archiverModule = new ArchiverModule();
Scene scene = SceneSetupHelpers.SetupScene();
SceneSetupHelpers.SetupSceneModules(scene, archiverModule);
archiverModule.DearchiveRegion(archiveReadStream);
// TODO: Okay, so nothing is tested yet apart from the fact that it doesn't blow up
}
}
}