diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Archiver')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs | 6 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs | 148 | ||||
-rwxr-xr-x | OpenSim/Region/CoreModules/World/Archiver/Tests/Resources/test-sound.wav | bin | 0 -> 211648 bytes |
3 files changed, 151 insertions, 3 deletions
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index 52add23..8ed1913 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs | |||
@@ -423,9 +423,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
423 | currentRegionSettings.TerrainTexture4 = loadedRegionSettings.TerrainTexture4; | 423 | currentRegionSettings.TerrainTexture4 = loadedRegionSettings.TerrainTexture4; |
424 | currentRegionSettings.UseEstateSun = loadedRegionSettings.UseEstateSun; | 424 | currentRegionSettings.UseEstateSun = loadedRegionSettings.UseEstateSun; |
425 | currentRegionSettings.WaterHeight = loadedRegionSettings.WaterHeight; | 425 | currentRegionSettings.WaterHeight = loadedRegionSettings.WaterHeight; |
426 | 426 | ||
427 | IEstateModule estateModule = m_scene.RequestModuleInterface<IEstateModule>(); | 427 | IEstateModule estateModule = m_scene.RequestModuleInterface<IEstateModule>(); |
428 | estateModule.sendRegionHandshakeToAll(); | 428 | |
429 | if (estateModule != null) | ||
430 | estateModule.sendRegionHandshakeToAll(); | ||
429 | 431 | ||
430 | return true; | 432 | return true; |
431 | } | 433 | } |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs index edac4a4..1200105 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs | |||
@@ -36,6 +36,7 @@ using OpenMetaverse; | |||
36 | using OpenSim.Framework; | 36 | using OpenSim.Framework; |
37 | using OpenSim.Framework.Communications.Cache; | 37 | using OpenSim.Framework.Communications.Cache; |
38 | using OpenSim.Framework.Serialization; | 38 | using OpenSim.Framework.Serialization; |
39 | using OpenSim.Framework.Serialization.External; | ||
39 | using OpenSim.Region.CoreModules.World.Serialiser; | 40 | using OpenSim.Region.CoreModules.World.Serialiser; |
40 | using OpenSim.Region.CoreModules.World.Terrain; | 41 | using OpenSim.Region.CoreModules.World.Terrain; |
41 | using OpenSim.Region.Framework.Scenes; | 42 | using OpenSim.Region.Framework.Scenes; |
@@ -214,7 +215,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests | |||
214 | // Also check that direct entries which will also have a file entry containing that directory doesn't | 215 | // Also check that direct entries which will also have a file entry containing that directory doesn't |
215 | // upset load | 216 | // upset load |
216 | tar.WriteDir(ArchiveConstants.TERRAINS_PATH); | 217 | tar.WriteDir(ArchiveConstants.TERRAINS_PATH); |
217 | 218 | ||
218 | tar.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, ArchiveWriteRequestExecution.Create0p2ControlFile()); | 219 | tar.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, ArchiveWriteRequestExecution.Create0p2ControlFile()); |
219 | 220 | ||
220 | string part1Name = "object1"; | 221 | string part1Name = "object1"; |
@@ -234,6 +235,45 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests | |||
234 | UUID.Zero, shape, groupPosition, rotationOffset, offsetPosition); | 235 | UUID.Zero, shape, groupPosition, rotationOffset, offsetPosition); |
235 | part1.Name = part1Name; | 236 | part1.Name = part1Name; |
236 | SceneObjectGroup object1 = new SceneObjectGroup(part1); | 237 | SceneObjectGroup object1 = new SceneObjectGroup(part1); |
238 | |||
239 | // Let's put some inventory items into our object | ||
240 | UUID soundItemUuid = UUID.Parse("00000000-0000-0000-0000-000000000002"); | ||
241 | Type type = GetType(); | ||
242 | Assembly assembly = type.Assembly; | ||
243 | string soundDataResourceName = null; | ||
244 | string[] names = assembly.GetManifestResourceNames(); | ||
245 | foreach (string name in names) | ||
246 | { | ||
247 | if (name.EndsWith(".Resources.test-sound.wav")) | ||
248 | soundDataResourceName = name; | ||
249 | } | ||
250 | Assert.That(soundDataResourceName, Is.Not.Null); | ||
251 | |||
252 | byte[] soundData; | ||
253 | Console.WriteLine("Loading " + soundDataResourceName); | ||
254 | using (Stream resource = assembly.GetManifestResourceStream(soundDataResourceName)) | ||
255 | { | ||
256 | using (BinaryReader br = new BinaryReader(resource)) | ||
257 | { | ||
258 | // FIXME: Use the inspector insteadthere are so many forums and lists already, though admittedly none of them are suitable for cross virtual-enivornemnt discussion | ||
259 | soundData = br.ReadBytes(99999999); | ||
260 | UUID soundUuid = UUID.Parse("00000000-0000-0000-0000-000000000001"); | ||
261 | string soundAssetFileName | ||
262 | = ArchiveConstants.ASSETS_PATH + soundUuid | ||
263 | + ArchiveConstants.ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.SoundWAV]; | ||
264 | tar.WriteFile(soundAssetFileName, soundData); | ||
265 | |||
266 | /* | ||
267 | AssetBase soundAsset = AssetHelpers.CreateAsset(soundUuid, soundData); | ||
268 | scene.AssetService.Store(soundAsset); | ||
269 | asset1FileName = ArchiveConstants.ASSETS_PATH + soundUuid + ".wav"; | ||
270 | */ | ||
271 | |||
272 | TaskInventoryItem item1 = new TaskInventoryItem { AssetID = soundUuid, ItemID = soundItemUuid }; | ||
273 | part1.Inventory.AddInventoryItem(item1, true); | ||
274 | } | ||
275 | } | ||
276 | |||
237 | scene.AddNewSceneObject(object1, false); | 277 | scene.AddNewSceneObject(object1, false); |
238 | 278 | ||
239 | string object1FileName = string.Format( | 279 | string object1FileName = string.Format( |
@@ -265,11 +305,117 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests | |||
265 | Assert.That( | 305 | Assert.That( |
266 | object1PartLoaded.OffsetPosition, Is.EqualTo(offsetPosition), "object1 offset position not equal"); | 306 | object1PartLoaded.OffsetPosition, Is.EqualTo(offsetPosition), "object1 offset position not equal"); |
267 | 307 | ||
308 | // Need to implement a method to get the task inventory item by name (since the uuid will have changed on load) | ||
309 | /* | ||
310 | TaskInventoryItem loadedSoundItem = object1PartLoaded.Inventory.GetInventoryItem(soundItemUuid); | ||
311 | Assert.That(loadedSoundItem, Is.Not.Null, "loaded sound item was null"); | ||
312 | AssetBase loadedSoundAsset = scene.AssetService.Get(loadedSoundItem.AssetID.ToString()); | ||
313 | Assert.That(loadedSoundAsset, Is.Not.Null, "loaded sound asset was null"); | ||
314 | Assert.That(loadedSoundAsset.Data, Is.EqualTo(soundData), "saved and loaded sound data do not match"); | ||
315 | */ | ||
316 | |||
268 | // Temporary | 317 | // Temporary |
269 | Console.WriteLine("Successfully completed {0}", MethodBase.GetCurrentMethod()); | 318 | Console.WriteLine("Successfully completed {0}", MethodBase.GetCurrentMethod()); |
270 | } | 319 | } |
271 | 320 | ||
272 | /// <summary> | 321 | /// <summary> |
322 | /// Test loading the region settings of a V0.2 OpenSim Region Archive. | ||
323 | /// </summary> | ||
324 | [Test] | ||
325 | public void TestLoadOarV0_2RegionSettings() | ||
326 | { | ||
327 | TestHelper.InMethod(); | ||
328 | //log4net.Config.XmlConfigurator.Configure(); | ||
329 | |||
330 | SerialiserModule serialiserModule = new SerialiserModule(); | ||
331 | ArchiverModule archiverModule = new ArchiverModule(); | ||
332 | Scene scene = SceneSetupHelpers.SetupScene(); | ||
333 | SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); | ||
334 | |||
335 | MemoryStream archiveWriteStream = new MemoryStream(); | ||
336 | TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream); | ||
337 | |||
338 | tar.WriteDir(ArchiveConstants.TERRAINS_PATH); | ||
339 | tar.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, ArchiveWriteRequestExecution.Create0p2ControlFile()); | ||
340 | |||
341 | RegionSettings rs = new RegionSettings(); | ||
342 | rs.AgentLimit = 17; | ||
343 | rs.AllowDamage = true; | ||
344 | rs.AllowLandJoinDivide = true; | ||
345 | rs.AllowLandResell = true; | ||
346 | rs.BlockFly = true; | ||
347 | rs.BlockShowInSearch = true; | ||
348 | rs.BlockTerraform = true; | ||
349 | rs.DisableCollisions = true; | ||
350 | rs.DisablePhysics = true; | ||
351 | rs.DisableScripts = true; | ||
352 | rs.Elevation1NW = 15.9; | ||
353 | rs.Elevation1NE = 45.3; | ||
354 | rs.Elevation1SE = 49; | ||
355 | rs.Elevation1SW = 1.9; | ||
356 | rs.Elevation2NW = 4.5; | ||
357 | rs.Elevation2NE = 19.2; | ||
358 | rs.Elevation2SE = 9.2; | ||
359 | rs.Elevation2SW = 2.1; | ||
360 | rs.FixedSun = true; | ||
361 | rs.ObjectBonus = 1.4; | ||
362 | rs.RestrictPushing = true; | ||
363 | rs.TerrainLowerLimit = 0.4; | ||
364 | rs.TerrainRaiseLimit = 17.9; | ||
365 | rs.TerrainTexture1 = UUID.Parse("00000000-0000-0000-0000-000000000020"); | ||
366 | rs.TerrainTexture2 = UUID.Parse("00000000-0000-0000-0000-000000000040"); | ||
367 | rs.TerrainTexture3 = UUID.Parse("00000000-0000-0000-0000-000000000060"); | ||
368 | rs.TerrainTexture4 = UUID.Parse("00000000-0000-0000-0000-000000000080"); | ||
369 | rs.UseEstateSun = true; | ||
370 | rs.WaterHeight = 23; | ||
371 | |||
372 | tar.WriteFile(ArchiveConstants.SETTINGS_PATH + "region1.xml", RegionSettingsSerializer.Serialize(rs)); | ||
373 | |||
374 | tar.Close(); | ||
375 | |||
376 | MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray()); | ||
377 | |||
378 | lock (this) | ||
379 | { | ||
380 | scene.EventManager.OnOarFileLoaded += LoadCompleted; | ||
381 | archiverModule.DearchiveRegion(archiveReadStream); | ||
382 | } | ||
383 | |||
384 | Assert.That(m_lastErrorMessage, Is.Null); | ||
385 | RegionSettings loadedRs = scene.RegionInfo.RegionSettings; | ||
386 | |||
387 | Assert.That(loadedRs.AgentLimit, Is.EqualTo(17)); | ||
388 | Assert.That(loadedRs.AllowDamage, Is.True); | ||
389 | Assert.That(loadedRs.AllowLandJoinDivide, Is.True); | ||
390 | Assert.That(loadedRs.AllowLandResell, Is.True); | ||
391 | Assert.That(loadedRs.BlockFly, Is.True); | ||
392 | Assert.That(loadedRs.BlockShowInSearch, Is.True); | ||
393 | Assert.That(loadedRs.BlockTerraform, Is.True); | ||
394 | Assert.That(loadedRs.DisableCollisions, Is.True); | ||
395 | Assert.That(loadedRs.DisablePhysics, Is.True); | ||
396 | Assert.That(loadedRs.DisableScripts, Is.True); | ||
397 | Assert.That(loadedRs.Elevation1NW, Is.EqualTo(15.9)); | ||
398 | Assert.That(loadedRs.Elevation1NE, Is.EqualTo(45.3)); | ||
399 | Assert.That(loadedRs.Elevation1SE, Is.EqualTo(49)); | ||
400 | Assert.That(loadedRs.Elevation1SW, Is.EqualTo(1.9)); | ||
401 | Assert.That(loadedRs.Elevation2NW, Is.EqualTo(4.5)); | ||
402 | Assert.That(loadedRs.Elevation2NE, Is.EqualTo(19.2)); | ||
403 | Assert.That(loadedRs.Elevation2SE, Is.EqualTo(9.2)); | ||
404 | Assert.That(loadedRs.Elevation2SW, Is.EqualTo(2.1)); | ||
405 | Assert.That(loadedRs.FixedSun, Is.True); | ||
406 | Assert.That(loadedRs.ObjectBonus, Is.EqualTo(1.4)); | ||
407 | Assert.That(loadedRs.RestrictPushing, Is.True); | ||
408 | Assert.That(loadedRs.TerrainLowerLimit, Is.EqualTo(0.4)); | ||
409 | Assert.That(loadedRs.TerrainRaiseLimit, Is.EqualTo(17.9)); | ||
410 | Assert.That(loadedRs.TerrainTexture1, Is.EqualTo(UUID.Parse("00000000-0000-0000-0000-000000000020"))); | ||
411 | Assert.That(loadedRs.TerrainTexture2, Is.EqualTo(UUID.Parse("00000000-0000-0000-0000-000000000040"))); | ||
412 | Assert.That(loadedRs.TerrainTexture3, Is.EqualTo(UUID.Parse("00000000-0000-0000-0000-000000000060"))); | ||
413 | Assert.That(loadedRs.TerrainTexture4, Is.EqualTo(UUID.Parse("00000000-0000-0000-0000-000000000080"))); | ||
414 | Assert.That(loadedRs.UseEstateSun, Is.True); | ||
415 | Assert.That(loadedRs.WaterHeight, Is.EqualTo(23)); | ||
416 | } | ||
417 | |||
418 | /// <summary> | ||
273 | /// Test merging a V0.2 OpenSim Region Archive into an existing scene | 419 | /// Test merging a V0.2 OpenSim Region Archive into an existing scene |
274 | /// </summary> | 420 | /// </summary> |
275 | //[Test] | 421 | //[Test] |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/Resources/test-sound.wav b/OpenSim/Region/CoreModules/World/Archiver/Tests/Resources/test-sound.wav new file mode 100755 index 0000000..b45ee54 --- /dev/null +++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/Resources/test-sound.wav | |||
Binary files differ | |||