aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/World
diff options
context:
space:
mode:
authorJustin Clarke Casey2009-01-23 19:24:36 +0000
committerJustin Clarke Casey2009-01-23 19:24:36 +0000
commit664f983943dd94d35184f5c0f69f8c58a011ba3a (patch)
treee86d12204576547e502047a2d1054bfc95cd8cb2 /OpenSim/Region/Environment/Modules/World
parentFix for llGetRot when the script is in a child prim. Also fixed llGetPrimitiv... (diff)
downloadopensim-SC_OLD-664f983943dd94d35184f5c0f69f8c58a011ba3a.zip
opensim-SC_OLD-664f983943dd94d35184f5c0f69f8c58a011ba3a.tar.gz
opensim-SC_OLD-664f983943dd94d35184f5c0f69f8c58a011ba3a.tar.bz2
opensim-SC_OLD-664f983943dd94d35184f5c0f69f8c58a011ba3a.tar.xz
* Extend archive test to check for the presence of a control file in a saved archive
Diffstat (limited to 'OpenSim/Region/Environment/Modules/World')
-rw-r--r--OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs7
-rw-r--r--OpenSim/Region/Environment/Modules/World/Archiver/Tests/ArchiverTests.cs40
2 files changed, 39 insertions, 8 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs
index 09776a7..bd58e7c 100644
--- a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs
+++ b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs
@@ -94,11 +94,13 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
94 94
95 byte[] data; 95 byte[] data;
96 TarArchiveReader.TarEntryType entryType; 96 TarArchiveReader.TarEntryType entryType;
97
97 while ((data = archive.ReadEntry(out filePath, out entryType)) != null) 98 while ((data = archive.ReadEntry(out filePath, out entryType)) != null)
98 { 99 {
99 //m_log.DebugFormat( 100 //m_log.DebugFormat(
100 // "[ARCHIVER]: Successfully read {0} ({1} bytes)}", filePath, data.Length); 101 // "[ARCHIVER]: Successfully read {0} ({1} bytes)}", filePath, data.Length);
101 if (entryType==TarArchiveReader.TarEntryType.TYPE_DIRECTORY) { 102 if (TarArchiveReader.TarEntryType.TYPE_DIRECTORY == entryType)
103 {
102 m_log.WarnFormat("[ARCHIVER]: Ignoring directory entry {0}", 104 m_log.WarnFormat("[ARCHIVER]: Ignoring directory entry {0}",
103 filePath); 105 filePath);
104 } 106 }
@@ -407,7 +409,6 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
407 409
408 private static Stream URIFetch(Uri uri) 410 private static Stream URIFetch(Uri uri)
409 { 411 {
410
411 HttpWebRequest request = (HttpWebRequest) WebRequest.Create(uri); 412 HttpWebRequest request = (HttpWebRequest) WebRequest.Create(uri);
412 413
413 // request.Credentials = credentials; 414 // request.Credentials = credentials;
@@ -425,8 +426,6 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
425 426
426 // return new BufferedStream(file, (int) response.ContentLength); 427 // return new BufferedStream(file, (int) response.ContentLength);
427 return new BufferedStream(file, 1000000); 428 return new BufferedStream(file, 1000000);
428
429 } 429 }
430
431 } 430 }
432} 431}
diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/Environment/Modules/World/Archiver/Tests/ArchiverTests.cs
index 149293d..db296b0 100644
--- a/OpenSim/Region/Environment/Modules/World/Archiver/Tests/ArchiverTests.cs
+++ b/OpenSim/Region/Environment/Modules/World/Archiver/Tests/ArchiverTests.cs
@@ -25,8 +25,14 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System.IO;
28using NUnit.Framework; 29using NUnit.Framework;
30using NUnit.Framework.SyntaxHelpers;
31using OpenSim.Region.Environment.Interfaces;
29using OpenSim.Region.Environment.Modules.World.Archiver; 32using OpenSim.Region.Environment.Modules.World.Archiver;
33using OpenSim.Region.Environment.Modules.World.Terrain;
34using OpenSim.Region.Environment.Scenes;
35using OpenSim.Tests.Common.Setup;
30 36
31namespace OpenSim.Region.Environment.Modules.World.Archiver.Tests 37namespace OpenSim.Region.Environment.Modules.World.Archiver.Tests
32{ 38{
@@ -38,11 +44,37 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver.Tests
38 /// </summary> 44 /// </summary>
39 [Test] 45 [Test]
40 public void TestSaveOarV0p2() 46 public void TestSaveOarV0p2()
41 { 47 {
42 // Create an archive containing only a terrain 48 //log4net.Config.XmlConfigurator.Configure();
43 //TarArchiveWriter taw = new TarArchiveWriter();
44 49
45 //System.Console.WriteLine("wibble"); 50 ArchiverModule archiverModule = new ArchiverModule();
51 TerrainModule terrainModule = new TerrainModule();
52
53 Scene scene = SceneSetupHelpers.SetupScene();
54 SceneSetupHelpers.SetupSceneModules(scene, archiverModule, terrainModule);
55
56 MemoryStream archiveWriteStream = new MemoryStream();
57 archiverModule.ArchiveRegion(archiveWriteStream);
58
59 // If there are no assets to fetch, then the entire archive region code path will execute in this thread,
60 // so no need to worry about signalling.
61 MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray());
62 TarArchiveReader tar = new TarArchiveReader(archiveReadStream);
63
64 bool gotControlFile = false;
65
66 string filePath;
67 TarArchiveReader.TarEntryType tarEntryType;
68
69 while (tar.ReadEntry(out filePath, out tarEntryType) != null)
70 {
71 if (ArchiveConstants.CONTROL_FILE_PATH == filePath)
72 gotControlFile = true;
73 }
74
75 Assert.That(gotControlFile, Is.True, "No control file in archive");
76
77 // TODO: Test presence of more files and contents of files.
46 } 78 }
47 } 79 }
48} \ No newline at end of file 80} \ No newline at end of file