diff options
author | Justin Clark-Casey (justincc) | 2011-04-18 22:35:33 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-04-18 22:35:33 +0100 |
commit | 6600aa2baf56e1f58e50eb5589de876e910131bb (patch) | |
tree | 09459dae35add58e7620a87b7d1e8ac5031ecac6 | |
parent | add test to ensure that an IAR starts with the control file (diff) | |
download | opensim-SC_OLD-6600aa2baf56e1f58e50eb5589de876e910131bb.zip opensim-SC_OLD-6600aa2baf56e1f58e50eb5589de876e910131bb.tar.gz opensim-SC_OLD-6600aa2baf56e1f58e50eb5589de876e910131bb.tar.bz2 opensim-SC_OLD-6600aa2baf56e1f58e50eb5589de876e910131bb.tar.xz |
Add regression test to check that OARs start with the control file.
3 files changed, 21 insertions, 9 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index 9acdc90..a12931f 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs | |||
@@ -77,6 +77,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
77 | /// </value> | 77 | /// </value> |
78 | private Stream m_loadStream; | 78 | private Stream m_loadStream; |
79 | 79 | ||
80 | /// <summary> | ||
81 | /// Has the control file been loaded for this archive? | ||
82 | /// </summary> | ||
80 | public bool ControlFileLoaded { get; private set; } | 83 | public bool ControlFileLoaded { get; private set; } |
81 | 84 | ||
82 | protected bool m_assetsLoaded; | 85 | protected bool m_assetsLoaded; |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index fd8f546..82bef48 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs | |||
@@ -57,6 +57,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
57 | /// bumps here should be compatible. | 57 | /// bumps here should be compatible. |
58 | /// </summary> | 58 | /// </summary> |
59 | public static int MAX_MAJOR_VERSION = 1; | 59 | public static int MAX_MAJOR_VERSION = 1; |
60 | |||
61 | /// <summary> | ||
62 | /// Has the control file been loaded for this archive? | ||
63 | /// </summary> | ||
64 | public bool ControlFileLoaded { get; private set; } | ||
60 | 65 | ||
61 | protected Scene m_scene; | 66 | protected Scene m_scene; |
62 | protected Stream m_loadStream; | 67 | protected Stream m_loadStream; |
@@ -527,7 +532,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
527 | /// </summary> | 532 | /// </summary> |
528 | /// <param name="path"></param> | 533 | /// <param name="path"></param> |
529 | /// <param name="data"></param> | 534 | /// <param name="data"></param> |
530 | protected void LoadControlFile(string path, byte[] data) | 535 | public void LoadControlFile(string path, byte[] data) |
531 | { | 536 | { |
532 | XmlNamespaceManager nsmgr = new XmlNamespaceManager(new NameTable()); | 537 | XmlNamespaceManager nsmgr = new XmlNamespaceManager(new NameTable()); |
533 | XmlParserContext context = new XmlParserContext(null, nsmgr, null, XmlSpace.None); | 538 | XmlParserContext context = new XmlParserContext(null, nsmgr, null, XmlSpace.None); |
@@ -573,6 +578,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
573 | } | 578 | } |
574 | 579 | ||
575 | currentRegionSettings.Save(); | 580 | currentRegionSettings.Save(); |
581 | |||
582 | ControlFileLoaded = true; | ||
576 | } | 583 | } |
577 | } | 584 | } |
578 | } \ No newline at end of file | 585 | } \ No newline at end of file |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs index e2760a2..2307c8e 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs | |||
@@ -171,7 +171,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests | |||
171 | MemoryStream archiveReadStream = new MemoryStream(archive); | 171 | MemoryStream archiveReadStream = new MemoryStream(archive); |
172 | TarArchiveReader tar = new TarArchiveReader(archiveReadStream); | 172 | TarArchiveReader tar = new TarArchiveReader(archiveReadStream); |
173 | 173 | ||
174 | bool gotControlFile = false; | ||
175 | bool gotNcAssetFile = false; | 174 | bool gotNcAssetFile = false; |
176 | 175 | ||
177 | string expectedNcAssetFileName = string.Format("{0}_{1}", ncAssetUuid, "notecard.txt"); | 176 | string expectedNcAssetFileName = string.Format("{0}_{1}", ncAssetUuid, "notecard.txt"); |
@@ -182,15 +181,19 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests | |||
182 | expectedPaths.Add(ArchiveHelpers.CreateObjectPath(sog2)); | 181 | expectedPaths.Add(ArchiveHelpers.CreateObjectPath(sog2)); |
183 | 182 | ||
184 | string filePath; | 183 | string filePath; |
185 | TarArchiveReader.TarEntryType tarEntryType; | 184 | TarArchiveReader.TarEntryType tarEntryType; |
186 | 185 | ||
186 | byte[] data = tar.ReadEntry(out filePath, out tarEntryType); | ||
187 | Assert.That(filePath, Is.EqualTo(ArchiveConstants.CONTROL_FILE_PATH)); | ||
188 | |||
189 | ArchiveReadRequest arr = new ArchiveReadRequest(m_scene, (Stream)null, false, false, Guid.Empty); | ||
190 | arr.LoadControlFile(filePath, data); | ||
191 | |||
192 | Assert.That(arr.ControlFileLoaded, Is.True); | ||
193 | |||
187 | while (tar.ReadEntry(out filePath, out tarEntryType) != null) | 194 | while (tar.ReadEntry(out filePath, out tarEntryType) != null) |
188 | { | 195 | { |
189 | if (ArchiveConstants.CONTROL_FILE_PATH == filePath) | 196 | if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH)) |
190 | { | ||
191 | gotControlFile = true; | ||
192 | } | ||
193 | else if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH)) | ||
194 | { | 197 | { |
195 | string fileName = filePath.Remove(0, ArchiveConstants.ASSETS_PATH.Length); | 198 | string fileName = filePath.Remove(0, ArchiveConstants.ASSETS_PATH.Length); |
196 | 199 | ||
@@ -203,7 +206,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests | |||
203 | } | 206 | } |
204 | } | 207 | } |
205 | 208 | ||
206 | Assert.That(gotControlFile, Is.True, "No control file in archive"); | ||
207 | Assert.That(gotNcAssetFile, Is.True, "No notecard asset file in archive"); | 209 | Assert.That(gotNcAssetFile, Is.True, "No notecard asset file in archive"); |
208 | Assert.That(foundPaths, Is.EquivalentTo(expectedPaths)); | 210 | Assert.That(foundPaths, Is.EquivalentTo(expectedPaths)); |
209 | 211 | ||