diff options
author | Justin Clarke Casey | 2009-04-28 19:40:02 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2009-04-28 19:40:02 +0000 |
commit | 898326b5e9e3f4fe509a1e880dbdc58d6c1b9ecb (patch) | |
tree | 18f03a1c7eb655f3a30e902e824d4b48d44bb318 /OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs | |
parent | * Add preliminary code for resolving iar profile names (diff) | |
download | opensim-SC_OLD-898326b5e9e3f4fe509a1e880dbdc58d6c1b9ecb.zip opensim-SC_OLD-898326b5e9e3f4fe509a1e880dbdc58d6c1b9ecb.tar.gz opensim-SC_OLD-898326b5e9e3f4fe509a1e880dbdc58d6c1b9ecb.tar.bz2 opensim-SC_OLD-898326b5e9e3f4fe509a1e880dbdc58d6c1b9ecb.tar.xz |
* Stop oar loading barfing if the archive contains directory entries
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs | 38 |
1 files changed, 34 insertions, 4 deletions
diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs index 70ed6a7..09ff9a2 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs | |||
@@ -48,13 +48,27 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests | |||
48 | public class ArchiverTests | 48 | public class ArchiverTests |
49 | { | 49 | { |
50 | private Guid m_lastRequestId; | 50 | private Guid m_lastRequestId; |
51 | private string m_lastErrorMessage; | ||
52 | |||
53 | private void LoadCompleted(Guid requestId, string errorMessage) | ||
54 | { | ||
55 | lock (this) | ||
56 | { | ||
57 | m_lastRequestId = requestId; | ||
58 | m_lastErrorMessage = errorMessage; | ||
59 | Console.WriteLine("About to pulse ArchiverTests on LoadCompleted"); | ||
60 | |||
61 | Monitor.PulseAll(this); | ||
62 | } | ||
63 | } | ||
51 | 64 | ||
52 | private void SaveCompleted(Guid requestId, string errorMessage) | 65 | private void SaveCompleted(Guid requestId, string errorMessage) |
53 | { | 66 | { |
54 | lock (this) | 67 | lock (this) |
55 | { | 68 | { |
56 | m_lastRequestId = requestId; | 69 | m_lastRequestId = requestId; |
57 | System.Console.WriteLine("About to pulse ArchiverTests"); | 70 | m_lastErrorMessage = errorMessage; |
71 | Console.WriteLine("About to pulse ArchiverTests on SaveCompleted"); | ||
58 | Monitor.PulseAll(this); | 72 | Monitor.PulseAll(this); |
59 | } | 73 | } |
60 | } | 74 | } |
@@ -188,10 +202,17 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests | |||
188 | [Test] | 202 | [Test] |
189 | public void TestLoadOarV0p2() | 203 | public void TestLoadOarV0p2() |
190 | { | 204 | { |
191 | //log4net.Config.XmlConfigurator.Configure(); | 205 | log4net.Config.XmlConfigurator.Configure(); |
192 | 206 | ||
193 | MemoryStream archiveWriteStream = new MemoryStream(); | 207 | MemoryStream archiveWriteStream = new MemoryStream(); |
194 | TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream); | 208 | TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream); |
209 | |||
210 | // Put in a random blank directory to check that this doesn't upset the load process | ||
211 | tar.WriteDir("ignoreme"); | ||
212 | |||
213 | // Also check that direct entries which will also have a file entry containing that directory doesn't | ||
214 | // upset load | ||
215 | tar.WriteDir(ArchiveConstants.TERRAINS_PATH); | ||
195 | 216 | ||
196 | tar.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, ArchiveWriteRequestExecution.Create0p2ControlFile()); | 217 | tar.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, ArchiveWriteRequestExecution.Create0p2ControlFile()); |
197 | 218 | ||
@@ -220,12 +241,21 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests | |||
220 | Math.Round(groupPosition.X), Math.Round(groupPosition.Y), Math.Round(groupPosition.Z), | 241 | Math.Round(groupPosition.X), Math.Round(groupPosition.Y), Math.Round(groupPosition.Z), |
221 | part1.UUID); | 242 | part1.UUID); |
222 | tar.WriteFile(ArchiveConstants.OBJECTS_PATH + object1FileName, object1.ToXmlString2()); | 243 | tar.WriteFile(ArchiveConstants.OBJECTS_PATH + object1FileName, object1.ToXmlString2()); |
223 | 244 | ||
224 | tar.Close(); | 245 | tar.Close(); |
225 | 246 | ||
226 | MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray()); | 247 | MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray()); |
227 | 248 | ||
228 | archiverModule.DearchiveRegion(archiveReadStream); | 249 | lock (this) |
250 | { | ||
251 | scene.EventManager.OnOarFileLoaded += LoadCompleted; | ||
252 | archiverModule.DearchiveRegion(archiveReadStream); | ||
253 | |||
254 | // Load occurs asynchronously right now | ||
255 | //Monitor.Wait(this, 60000); | ||
256 | } | ||
257 | |||
258 | Assert.That(m_lastErrorMessage, Is.Null); | ||
229 | 259 | ||
230 | SceneObjectPart object1PartLoaded = scene.GetSceneObjectPart(part1Name); | 260 | SceneObjectPart object1PartLoaded = scene.GetSceneObjectPart(part1Name); |
231 | 261 | ||