aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/World/Archiver
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Archiver')
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs9
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs18
3 files changed, 19 insertions, 10 deletions
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
index b1dec4c..930a117 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;
@@ -545,7 +550,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
545 /// </summary> 550 /// </summary>
546 /// <param name="path"></param> 551 /// <param name="path"></param>
547 /// <param name="data"></param> 552 /// <param name="data"></param>
548 protected void LoadControlFile(string path, byte[] data) 553 public void LoadControlFile(string path, byte[] data)
549 { 554 {
550 XmlNamespaceManager nsmgr = new XmlNamespaceManager(new NameTable()); 555 XmlNamespaceManager nsmgr = new XmlNamespaceManager(new NameTable());
551 XmlParserContext context = new XmlParserContext(null, nsmgr, null, XmlSpace.None); 556 XmlParserContext context = new XmlParserContext(null, nsmgr, null, XmlSpace.None);
@@ -591,6 +596,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver
591 } 596 }
592 597
593 currentRegionSettings.Save(); 598 currentRegionSettings.Save();
599
600 ControlFileLoaded = true;
594 } 601 }
595 } 602 }
596} \ No newline at end of file 603} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
index f2d487e..597b780 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
@@ -206,7 +206,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
206 /// <returns></returns> 206 /// <returns></returns>
207 public static string CreateControlFile(Dictionary<string, object> options) 207 public static string CreateControlFile(Dictionary<string, object> options)
208 { 208 {
209 int majorVersion = MAX_MAJOR_VERSION, minorVersion = 5; 209 int majorVersion = MAX_MAJOR_VERSION, minorVersion = 6;
210// 210//
211// if (options.ContainsKey("version")) 211// if (options.ContainsKey("version"))
212// { 212// {
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