diff options
author | Justin Clarke Casey | 2009-02-10 18:43:36 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2009-02-10 18:43:36 +0000 |
commit | 25bc7a44cdb4809b184c81231d2d99ec3dcbaf72 (patch) | |
tree | 914cd06b9fe7a9d980ba60f961332d01c6c181eb /OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs | |
parent | * extend load oar test to check that an object was actually loaded (diff) | |
download | opensim-SC_OLD-25bc7a44cdb4809b184c81231d2d99ec3dcbaf72.zip opensim-SC_OLD-25bc7a44cdb4809b184c81231d2d99ec3dcbaf72.tar.gz opensim-SC_OLD-25bc7a44cdb4809b184c81231d2d99ec3dcbaf72.tar.bz2 opensim-SC_OLD-25bc7a44cdb4809b184c81231d2d99ec3dcbaf72.tar.xz |
* Implement merging of oars in code
* Not fully tested yet and not yet available as an option from the user console
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs | 82 |
1 files changed, 80 insertions, 2 deletions
diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs index 77a3044..f201e74 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs | |||
@@ -167,14 +167,13 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests | |||
167 | [Test] | 167 | [Test] |
168 | public void TestLoadOarV0p2() | 168 | public void TestLoadOarV0p2() |
169 | { | 169 | { |
170 | log4net.Config.XmlConfigurator.Configure(); | 170 | //log4net.Config.XmlConfigurator.Configure(); |
171 | 171 | ||
172 | MemoryStream archiveWriteStream = new MemoryStream(); | 172 | MemoryStream archiveWriteStream = new MemoryStream(); |
173 | TarArchiveWriter tar = new TarArchiveWriter(); | 173 | TarArchiveWriter tar = new TarArchiveWriter(); |
174 | 174 | ||
175 | tar.AddFile(ArchiveConstants.CONTROL_FILE_PATH, ArchiveWriteRequestExecution.Create0p2ControlFile()); | 175 | tar.AddFile(ArchiveConstants.CONTROL_FILE_PATH, ArchiveWriteRequestExecution.Create0p2ControlFile()); |
176 | 176 | ||
177 | UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000020"); | ||
178 | string part1Name = "object1"; | 177 | string part1Name = "object1"; |
179 | PrimitiveBaseShape shape = PrimitiveBaseShape.CreateCylinder(); | 178 | PrimitiveBaseShape shape = PrimitiveBaseShape.CreateCylinder(); |
180 | Vector3 groupPosition = new Vector3(90, 80, 70); | 179 | Vector3 groupPosition = new Vector3(90, 80, 70); |
@@ -216,5 +215,84 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests | |||
216 | Assert.That( | 215 | Assert.That( |
217 | object1PartLoaded.OffsetPosition, Is.EqualTo(offsetPosition), "object1 offset position not equal"); | 216 | object1PartLoaded.OffsetPosition, Is.EqualTo(offsetPosition), "object1 offset position not equal"); |
218 | } | 217 | } |
218 | |||
219 | /// <summary> | ||
220 | /// Test merging a V0.2 OpenSim Region Archive into an existing scene | ||
221 | /// </summary> | ||
222 | [Test] | ||
223 | public void TestMergeOarV0p2() | ||
224 | { | ||
225 | log4net.Config.XmlConfigurator.Configure(); | ||
226 | |||
227 | MemoryStream archiveWriteStream = new MemoryStream(); | ||
228 | |||
229 | string part2Name = "objectMerge"; | ||
230 | PrimitiveBaseShape part2Shape = PrimitiveBaseShape.CreateCylinder(); | ||
231 | Vector3 part2GroupPosition = new Vector3(90, 80, 70); | ||
232 | Quaternion part2RotationOffset = new Quaternion(60, 70, 80, 90); | ||
233 | Vector3 part2OffsetPosition = new Vector3(20, 25, 30); | ||
234 | |||
235 | // Create an oar file that we can use for the merge | ||
236 | { | ||
237 | ArchiverModule archiverModule = new ArchiverModule(); | ||
238 | SerialiserModule serialiserModule = new SerialiserModule(); | ||
239 | TerrainModule terrainModule = new TerrainModule(); | ||
240 | |||
241 | Scene scene = SceneSetupHelpers.SetupScene(); | ||
242 | SceneSetupHelpers.SetupSceneModules(scene, archiverModule, serialiserModule, terrainModule); | ||
243 | |||
244 | SceneObjectPart part2 | ||
245 | = new SceneObjectPart( | ||
246 | UUID.Zero, part2Shape, part2GroupPosition, part2RotationOffset, part2OffsetPosition); | ||
247 | part2.Name = part2Name; | ||
248 | SceneObjectGroup object2 = new SceneObjectGroup(part2); | ||
249 | |||
250 | scene.AddNewSceneObject(object2, false); | ||
251 | |||
252 | // Write out this scene | ||
253 | scene.EventManager.OnOarFileSaved += SaveCompleted; | ||
254 | archiverModule.ArchiveRegion(archiveWriteStream); | ||
255 | m_waitHandle.WaitOne(60000, true); | ||
256 | } | ||
257 | |||
258 | { | ||
259 | ArchiverModule archiverModule = new ArchiverModule(); | ||
260 | SerialiserModule serialiserModule = new SerialiserModule(); | ||
261 | TerrainModule terrainModule = new TerrainModule(); | ||
262 | |||
263 | Scene scene = SceneSetupHelpers.SetupScene(); | ||
264 | SceneSetupHelpers.SetupSceneModules(scene, archiverModule, serialiserModule, terrainModule); | ||
265 | |||
266 | string part1Name = "objectExisting"; | ||
267 | PrimitiveBaseShape part1Shape = PrimitiveBaseShape.CreateCylinder(); | ||
268 | Vector3 part1GroupPosition = new Vector3(80, 70, 60); | ||
269 | Quaternion part1RotationOffset = new Quaternion(50, 60, 70, 80); | ||
270 | Vector3 part1OffsetPosition = new Vector3(15, 20, 25); | ||
271 | |||
272 | SceneObjectPart part1 | ||
273 | = new SceneObjectPart( | ||
274 | UUID.Zero, part1Shape, part1GroupPosition, part1RotationOffset, part1OffsetPosition); | ||
275 | part1.Name = part1Name; | ||
276 | SceneObjectGroup object1 = new SceneObjectGroup(part1); | ||
277 | |||
278 | scene.AddNewSceneObject(object1, false); | ||
279 | |||
280 | // Merge in the archive we created earlier | ||
281 | byte[] archive = archiveWriteStream.ToArray(); | ||
282 | MemoryStream archiveReadStream = new MemoryStream(archive); | ||
283 | |||
284 | archiverModule.DearchiveRegion(archiveReadStream, true); | ||
285 | |||
286 | SceneObjectPart object1Existing = scene.GetSceneObjectPart(part1Name); | ||
287 | Assert.That(object1Existing, Is.Not.Null, "object1 was not present after merge"); | ||
288 | Assert.That(object1Existing.Name, Is.EqualTo(part1Name), "object1 names not identical after merge"); | ||
289 | Assert.That(object1Existing.GroupPosition, Is.EqualTo(part1GroupPosition), "object1 group position not equal after merge"); | ||
290 | |||
291 | SceneObjectPart object2PartMerged = scene.GetSceneObjectPart(part2Name); | ||
292 | Assert.That(object2PartMerged, Is.Not.Null, "object2 was not present after merge"); | ||
293 | Assert.That(object2PartMerged.Name, Is.EqualTo(part2Name), "object2 names not identical after merge"); | ||
294 | Assert.That(object2PartMerged.GroupPosition, Is.EqualTo(part2GroupPosition), "object2 group position not equal after merge"); | ||
295 | } | ||
296 | } | ||
219 | } | 297 | } |
220 | } \ No newline at end of file | 298 | } \ No newline at end of file |