Add regression test to check that OARs start with the control file.
parent
e00e518692
commit
6600aa2baf
|
@ -77,6 +77,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
/// </value>
|
/// </value>
|
||||||
private Stream m_loadStream;
|
private Stream m_loadStream;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Has the control file been loaded for this archive?
|
||||||
|
/// </summary>
|
||||||
public bool ControlFileLoaded { get; private set; }
|
public bool ControlFileLoaded { get; private set; }
|
||||||
|
|
||||||
protected bool m_assetsLoaded;
|
protected bool m_assetsLoaded;
|
||||||
|
|
|
@ -58,6 +58,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static int MAX_MAJOR_VERSION = 1;
|
public static int MAX_MAJOR_VERSION = 1;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Has the control file been loaded for this archive?
|
||||||
|
/// </summary>
|
||||||
|
public bool ControlFileLoaded { get; private set; }
|
||||||
|
|
||||||
protected Scene m_scene;
|
protected Scene m_scene;
|
||||||
protected Stream m_loadStream;
|
protected Stream m_loadStream;
|
||||||
protected Guid m_requestId;
|
protected Guid m_requestId;
|
||||||
|
@ -527,7 +532,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="path"></param>
|
/// <param name="path"></param>
|
||||||
/// <param name="data"></param>
|
/// <param name="data"></param>
|
||||||
protected void LoadControlFile(string path, byte[] data)
|
public void LoadControlFile(string path, byte[] data)
|
||||||
{
|
{
|
||||||
XmlNamespaceManager nsmgr = new XmlNamespaceManager(new NameTable());
|
XmlNamespaceManager nsmgr = new XmlNamespaceManager(new NameTable());
|
||||||
XmlParserContext context = new XmlParserContext(null, nsmgr, null, XmlSpace.None);
|
XmlParserContext context = new XmlParserContext(null, nsmgr, null, XmlSpace.None);
|
||||||
|
@ -573,6 +578,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||||
}
|
}
|
||||||
|
|
||||||
currentRegionSettings.Save();
|
currentRegionSettings.Save();
|
||||||
|
|
||||||
|
ControlFileLoaded = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -171,7 +171,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
|
||||||
MemoryStream archiveReadStream = new MemoryStream(archive);
|
MemoryStream archiveReadStream = new MemoryStream(archive);
|
||||||
TarArchiveReader tar = new TarArchiveReader(archiveReadStream);
|
TarArchiveReader tar = new TarArchiveReader(archiveReadStream);
|
||||||
|
|
||||||
bool gotControlFile = false;
|
|
||||||
bool gotNcAssetFile = false;
|
bool gotNcAssetFile = false;
|
||||||
|
|
||||||
string expectedNcAssetFileName = string.Format("{0}_{1}", ncAssetUuid, "notecard.txt");
|
string expectedNcAssetFileName = string.Format("{0}_{1}", ncAssetUuid, "notecard.txt");
|
||||||
|
@ -184,13 +183,17 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
|
||||||
string filePath;
|
string filePath;
|
||||||
TarArchiveReader.TarEntryType tarEntryType;
|
TarArchiveReader.TarEntryType tarEntryType;
|
||||||
|
|
||||||
|
byte[] data = tar.ReadEntry(out filePath, out tarEntryType);
|
||||||
|
Assert.That(filePath, Is.EqualTo(ArchiveConstants.CONTROL_FILE_PATH));
|
||||||
|
|
||||||
|
ArchiveReadRequest arr = new ArchiveReadRequest(m_scene, (Stream)null, false, false, Guid.Empty);
|
||||||
|
arr.LoadControlFile(filePath, data);
|
||||||
|
|
||||||
|
Assert.That(arr.ControlFileLoaded, Is.True);
|
||||||
|
|
||||||
while (tar.ReadEntry(out filePath, out tarEntryType) != null)
|
while (tar.ReadEntry(out filePath, out tarEntryType) != null)
|
||||||
{
|
{
|
||||||
if (ArchiveConstants.CONTROL_FILE_PATH == filePath)
|
if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH))
|
||||||
{
|
|
||||||
gotControlFile = true;
|
|
||||||
}
|
|
||||||
else if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH))
|
|
||||||
{
|
{
|
||||||
string fileName = filePath.Remove(0, ArchiveConstants.ASSETS_PATH.Length);
|
string fileName = filePath.Remove(0, ArchiveConstants.ASSETS_PATH.Length);
|
||||||
|
|
||||||
|
@ -203,7 +206,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.That(gotControlFile, Is.True, "No control file in archive");
|
|
||||||
Assert.That(gotNcAssetFile, Is.True, "No notecard asset file in archive");
|
Assert.That(gotNcAssetFile, Is.True, "No notecard asset file in archive");
|
||||||
Assert.That(foundPaths, Is.EquivalentTo(expectedPaths));
|
Assert.That(foundPaths, Is.EquivalentTo(expectedPaths));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue