aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs58
1 files changed, 32 insertions, 26 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
index 4e55f21..c43f543 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
@@ -30,12 +30,14 @@ using System.IO;
30using System.Text; 30using System.Text;
31using System.Threading; 31using System.Threading;
32using NUnit.Framework; 32using NUnit.Framework;
33using NUnit.Framework.SyntaxHelpers;
33using OpenMetaverse; 34using OpenMetaverse;
34using OpenSim.Data; 35using OpenSim.Data;
35using OpenSim.Framework; 36using OpenSim.Framework;
36using OpenSim.Framework.Communications; 37using OpenSim.Framework.Communications;
37using OpenSim.Framework.Communications.Cache; 38using OpenSim.Framework.Communications.Cache;
38using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver; 39using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver;
40using OpenSim.Region.CoreModules.World.Archiver;
39using OpenSim.Region.Framework.Scenes; 41using OpenSim.Region.Framework.Scenes;
40using OpenSim.Tests.Common.Setup; 42using OpenSim.Tests.Common.Setup;
41 43
@@ -101,9 +103,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
101 cm.AssetCache.AddAsset(asset1); 103 cm.AssetCache.AddAsset(asset1);
102 104
103 // Create item 105 // Create item
106 UUID item1Id = UUID.Parse("00000000-0000-0000-0000-000000000080");
104 InventoryItemBase item1 = new InventoryItemBase(); 107 InventoryItemBase item1 = new InventoryItemBase();
105 item1.Name = "My Little Dog"; 108 item1.Name = "My Little Dog";
106 item1.AssetID = asset1.FullID; 109 item1.AssetID = asset1.FullID;
110 item1.ID = item1Id;
107 item1.Folder = userInfo.RootFolder.FindFolderByPath("Objects").ID; 111 item1.Folder = userInfo.RootFolder.FindFolderByPath("Objects").ID;
108 scene.AddInventoryItem(userId, item1); 112 scene.AddInventoryItem(userId, item1);
109 113
@@ -118,57 +122,59 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
118 Monitor.Wait(this, 60000); 122 Monitor.Wait(this, 60000);
119 } 123 }
120 124
121 /*
122 byte[] archive = archiveWriteStream.ToArray(); 125 byte[] archive = archiveWriteStream.ToArray();
123 MemoryStream archiveReadStream = new MemoryStream(archive); 126 MemoryStream archiveReadStream = new MemoryStream(archive);
124 TarArchiveReader tar = new TarArchiveReader(archiveReadStream); 127 TarArchiveReader tar = new TarArchiveReader(archiveReadStream);
125 128
126 bool gotControlFile = false; 129 //bool gotControlFile = false;
127 bool gotObject1File = false; 130 bool gotObject1File = false;
128 bool gotObject2File = false; 131 //bool gotObject2File = false;
129 string expectedObject1FileName = string.Format( 132 string expectedObject1FilePath = string.Format(
130 "{0}_{1:000}-{2:000}-{3:000}__{4}.xml", 133 "{0}{1}_{2}.xml",
131 part1.Name, 134 "Objects/",
132 Math.Round(part1.GroupPosition.X), Math.Round(part1.GroupPosition.Y), Math.Round(part1.GroupPosition.Z), 135 item1.Name,
133 part1.UUID); 136 item1Id);
137/*
134 string expectedObject2FileName = string.Format( 138 string expectedObject2FileName = string.Format(
135 "{0}_{1:000}-{2:000}-{3:000}__{4}.xml", 139 "{0}_{1:000}-{2:000}-{3:000}__{4}.xml",
136 part2.Name, 140 part2.Name,
137 Math.Round(part2.GroupPosition.X), Math.Round(part2.GroupPosition.Y), Math.Round(part2.GroupPosition.Z), 141 Math.Round(part2.GroupPosition.X), Math.Round(part2.GroupPosition.Y), Math.Round(part2.GroupPosition.Z),
138 part2.UUID); 142 part2.UUID);
143 */
139 144
140 string filePath; 145 string filePath;
141 TarArchiveReader.TarEntryType tarEntryType; 146 TarArchiveReader.TarEntryType tarEntryType;
142 147
143 while (tar.ReadEntry(out filePath, out tarEntryType) != null) 148 while (tar.ReadEntry(out filePath, out tarEntryType) != null)
144 { 149 {
150 /*
145 if (ArchiveConstants.CONTROL_FILE_PATH == filePath) 151 if (ArchiveConstants.CONTROL_FILE_PATH == filePath)
146 { 152 {
147 gotControlFile = true; 153 gotControlFile = true;
148 } 154 }
149 else if (filePath.StartsWith(ArchiveConstants.OBJECTS_PATH)) 155 */
156 if (filePath.StartsWith("Objects/") && filePath.EndsWith(".xml"))
150 { 157 {
151 string fileName = filePath.Remove(0, ArchiveConstants.OBJECTS_PATH.Length); 158 //string fileName = filePath.Remove(0, "Objects/".Length);
152 159
153 if (fileName.StartsWith(part1.Name)) 160 //if (fileName.StartsWith(part1.Name))
154 { 161 //{
155 Assert.That(fileName, Is.EqualTo(expectedObject1FileName)); 162 Assert.That(filePath, Is.EqualTo(expectedObject1FilePath));
156 gotObject1File = true; 163 gotObject1File = true;
157 } 164 //}
158 else if (fileName.StartsWith(part2.Name)) 165 //else if (fileName.StartsWith(part2.Name))
159 { 166 //{
160 Assert.That(fileName, Is.EqualTo(expectedObject2FileName)); 167 // Assert.That(fileName, Is.EqualTo(expectedObject2FileName));
161 gotObject2File = true; 168 // gotObject2File = true;
162 } 169 //}
163 } 170 }
164 } 171 }
165 172
166 Assert.That(gotControlFile, Is.True, "No control file in archive"); 173 //Assert.That(gotControlFile, Is.True, "No control file in archive");
167 Assert.That(gotObject1File, Is.True, "No object1 file in archive"); 174 Assert.That(gotObject1File, Is.True, "No item1 file in archive");
168 Assert.That(gotObject2File, Is.True, "No object2 file in archive"); 175 //Assert.That(gotObject2File, Is.True, "No object2 file in archive");
169 176
170 // TODO: Test presence of more files and contents of files. 177 // TODO: Test presence of more files and contents of files.
171 */
172 } 178 }
173 } 179 }
174} \ No newline at end of file 180} \ No newline at end of file