diff options
author | Justin Clark-Casey (justincc) | 2009-09-09 18:03:49 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2009-09-09 18:03:49 +0100 |
commit | 0683cf6e0d541571d04d6511dc0ecabb17dd1e1e (patch) | |
tree | 13693d05d9bf2c3514266fab1f649de455477cf1 | |
parent | Merge branch 'master' of ssh://justincc@opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC_OLD-0683cf6e0d541571d04d6511dc0ecabb17dd1e1e.zip opensim-SC_OLD-0683cf6e0d541571d04d6511dc0ecabb17dd1e1e.tar.gz opensim-SC_OLD-0683cf6e0d541571d04d6511dc0ecabb17dd1e1e.tar.bz2 opensim-SC_OLD-0683cf6e0d541571d04d6511dc0ecabb17dd1e1e.tar.xz |
Add test to check behaviour if an iar is loaded where no user profile exists for the creators
Disable generation of temporary profiles for now, instead record loading user as creator
4 files changed, 90 insertions, 20 deletions
diff --git a/OpenSim/Framework/Communications/Osp/OspResolver.cs b/OpenSim/Framework/Communications/Osp/OspResolver.cs index 502fee3..e98317a 100644 --- a/OpenSim/Framework/Communications/Osp/OspResolver.cs +++ b/OpenSim/Framework/Communications/Osp/OspResolver.cs | |||
@@ -153,7 +153,9 @@ namespace OpenSim.Framework.Communications.Osp | |||
153 | CachedUserInfo userInfo = commsManager.UserProfileCacheService.GetUserDetails(firstName, lastName); | 153 | CachedUserInfo userInfo = commsManager.UserProfileCacheService.GetUserDetails(firstName, lastName); |
154 | if (userInfo != null) | 154 | if (userInfo != null) |
155 | return userInfo.UserProfile.ID; | 155 | return userInfo.UserProfile.ID; |
156 | 156 | ||
157 | // XXX: Disable temporary user profile creation for now as implementation is incomplete - justincc | ||
158 | /* | ||
157 | UserProfileData tempUserProfile = new UserProfileData(); | 159 | UserProfileData tempUserProfile = new UserProfileData(); |
158 | tempUserProfile.FirstName = firstName; | 160 | tempUserProfile.FirstName = firstName; |
159 | tempUserProfile.SurName = lastName; | 161 | tempUserProfile.SurName = lastName; |
@@ -164,6 +166,9 @@ namespace OpenSim.Framework.Communications.Osp | |||
164 | commsManager.UserService.AddTemporaryUserProfile(tempUserProfile); | 166 | commsManager.UserService.AddTemporaryUserProfile(tempUserProfile); |
165 | 167 | ||
166 | return tempUserProfile.ID; | 168 | return tempUserProfile.ID; |
169 | */ | ||
170 | |||
171 | return UUID.Zero; | ||
167 | } | 172 | } |
168 | } | 173 | } |
169 | } | 174 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index 50c0f93..2a1c82e 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs | |||
@@ -177,6 +177,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
177 | UUID ospResolvedId = OspResolver.ResolveOspa(item.CreatorId, m_scene.CommsManager); | 177 | UUID ospResolvedId = OspResolver.ResolveOspa(item.CreatorId, m_scene.CommsManager); |
178 | if (UUID.Zero != ospResolvedId) | 178 | if (UUID.Zero != ospResolvedId) |
179 | item.CreatorIdAsUuid = ospResolvedId; | 179 | item.CreatorIdAsUuid = ospResolvedId; |
180 | else | ||
181 | item.CreatorIdAsUuid = m_userInfo.UserProfile.ID; | ||
180 | 182 | ||
181 | item.Owner = m_userInfo.UserProfile.ID; | 183 | item.Owner = m_userInfo.UserProfile.ID; |
182 | 184 | ||
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index 384a1f2..9c5f8f3 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs | |||
@@ -81,7 +81,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
81 | public void TestSaveIarV0_1() | 81 | public void TestSaveIarV0_1() |
82 | { | 82 | { |
83 | TestHelper.InMethod(); | 83 | TestHelper.InMethod(); |
84 | log4net.Config.XmlConfigurator.Configure(); | 84 | //log4net.Config.XmlConfigurator.Configure(); |
85 | 85 | ||
86 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); | 86 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); |
87 | 87 | ||
@@ -202,12 +202,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
202 | /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where | 202 | /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where |
203 | /// an account exists with the creator name. | 203 | /// an account exists with the creator name. |
204 | /// </summary> | 204 | /// </summary> |
205 | /// | ||
206 | /// This test also does some deeper probing of loading into nested inventory structures | ||
205 | [Test] | 207 | [Test] |
206 | public void TestLoadIarV0_1ExistingUsers() | 208 | public void TestLoadIarV0_1ExistingUsers() |
207 | { | 209 | { |
208 | TestHelper.InMethod(); | 210 | TestHelper.InMethod(); |
209 | 211 | ||
210 | log4net.Config.XmlConfigurator.Configure(); | 212 | //log4net.Config.XmlConfigurator.Configure(); |
211 | 213 | ||
212 | string userFirstName = "Mr"; | 214 | string userFirstName = "Mr"; |
213 | string userLastName = "Tiddles"; | 215 | string userLastName = "Tiddles"; |
@@ -291,6 +293,77 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
291 | 293 | ||
292 | /// <summary> | 294 | /// <summary> |
293 | /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where | 295 | /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where |
296 | /// embedded creators do not exist in the system | ||
297 | /// </summary> | ||
298 | /// | ||
299 | /// This may possibly one day get overtaken by the as yet incomplete temporary profiles feature | ||
300 | /// (as tested in the a later commented out test) | ||
301 | [Test] | ||
302 | public void TestLoadIarV0_1AbsentUsers() | ||
303 | { | ||
304 | TestHelper.InMethod(); | ||
305 | |||
306 | log4net.Config.XmlConfigurator.Configure(); | ||
307 | |||
308 | string userFirstName = "Charlie"; | ||
309 | string userLastName = "Chan"; | ||
310 | UUID userUuid = UUID.Parse("00000000-0000-0000-0000-000000000999"); | ||
311 | string userItemCreatorFirstName = "Bat"; | ||
312 | string userItemCreatorLastName = "Man"; | ||
313 | //UUID userItemCreatorUuid = UUID.Parse("00000000-0000-0000-0000-000000008888"); | ||
314 | |||
315 | string itemName = "b.lsl"; | ||
316 | string archiveItemName | ||
317 | = string.Format("{0}{1}{2}", itemName, "_", UUID.Random()); | ||
318 | |||
319 | MemoryStream archiveWriteStream = new MemoryStream(); | ||
320 | TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream); | ||
321 | |||
322 | InventoryItemBase item1 = new InventoryItemBase(); | ||
323 | item1.Name = itemName; | ||
324 | item1.AssetID = UUID.Random(); | ||
325 | item1.GroupID = UUID.Random(); | ||
326 | item1.CreatorId = OspResolver.MakeOspa(userItemCreatorFirstName, userItemCreatorLastName); | ||
327 | //item1.CreatorId = userUuid.ToString(); | ||
328 | //item1.CreatorId = "00000000-0000-0000-0000-000000000444"; | ||
329 | item1.Owner = UUID.Zero; | ||
330 | |||
331 | string item1FileName | ||
332 | = string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName); | ||
333 | tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1)); | ||
334 | tar.Close(); | ||
335 | |||
336 | MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray()); | ||
337 | SerialiserModule serialiserModule = new SerialiserModule(); | ||
338 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); | ||
339 | |||
340 | // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene | ||
341 | Scene scene = SceneSetupHelpers.SetupScene("inventory"); | ||
342 | IUserAdminService userAdminService = scene.CommsManager.UserAdminService; | ||
343 | |||
344 | SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); | ||
345 | userAdminService.AddUser( | ||
346 | userFirstName, userLastName, "meowfood", String.Empty, 1000, 1000, userUuid); | ||
347 | |||
348 | archiverModule.DearchiveInventory(userFirstName, userLastName, "/", archiveReadStream); | ||
349 | |||
350 | CachedUserInfo userInfo | ||
351 | = scene.CommsManager.UserProfileCacheService.GetUserDetails(userFirstName, userLastName); | ||
352 | |||
353 | InventoryItemBase foundItem1 | ||
354 | = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userInfo.UserProfile.ID, itemName); | ||
355 | |||
356 | Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1"); | ||
357 | // Assert.That( | ||
358 | // foundItem1.CreatorId, Is.EqualTo(userUuid), | ||
359 | // "Loaded item non-uuid creator doesn't match that of the loading user"); | ||
360 | Assert.That( | ||
361 | foundItem1.CreatorIdAsUuid, Is.EqualTo(userUuid), | ||
362 | "Loaded item uuid creator doesn't match that of the loading user"); | ||
363 | } | ||
364 | |||
365 | /// <summary> | ||
366 | /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where | ||
294 | /// no account exists with the creator name | 367 | /// no account exists with the creator name |
295 | /// </summary> | 368 | /// </summary> |
296 | /// Disabled since temporary profiles have not yet been implemented. | 369 | /// Disabled since temporary profiles have not yet been implemented. |
@@ -376,7 +449,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
376 | { | 449 | { |
377 | TestHelper.InMethod(); | 450 | TestHelper.InMethod(); |
378 | 451 | ||
379 | log4net.Config.XmlConfigurator.Configure(); | 452 | //log4net.Config.XmlConfigurator.Configure(); |
380 | 453 | ||
381 | Scene scene = SceneSetupHelpers.SetupScene("inventory"); | 454 | Scene scene = SceneSetupHelpers.SetupScene("inventory"); |
382 | CommunicationsManager commsManager = scene.CommsManager; | 455 | CommunicationsManager commsManager = scene.CommsManager; |
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index fea288e..94223d8 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | |||
@@ -3488,7 +3488,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
3488 | { | 3488 | { |
3489 | if (geom == localGround) | 3489 | if (geom == localGround) |
3490 | { | 3490 | { |
3491 | localHeightfield = TerrainHeightFieldHeights[geom]; | 3491 | //localHeightfield = TerrainHeightFieldHeights[geom]; |
3492 | proceed = true; | 3492 | proceed = true; |
3493 | } | 3493 | } |
3494 | else | 3494 | else |
@@ -3510,7 +3510,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
3510 | // memory corruption | 3510 | // memory corruption |
3511 | if (TerrainHeightFieldHeights.ContainsKey(g)) | 3511 | if (TerrainHeightFieldHeights.ContainsKey(g)) |
3512 | { | 3512 | { |
3513 | float[] removingHeightField = TerrainHeightFieldHeights[g]; | 3513 | //float[] removingHeightField = TerrainHeightFieldHeights[g]; |
3514 | TerrainHeightFieldHeights.Remove(g); | 3514 | TerrainHeightFieldHeights.Remove(g); |
3515 | 3515 | ||
3516 | if (RegionTerrain.ContainsKey(g)) | 3516 | if (RegionTerrain.ContainsKey(g)) |
@@ -3519,27 +3519,17 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
3519 | } | 3519 | } |
3520 | 3520 | ||
3521 | d.GeomDestroy(g); | 3521 | d.GeomDestroy(g); |
3522 | removingHeightField = new float[0]; | 3522 | //removingHeightField = new float[0]; |
3523 | 3523 | } | |
3524 | |||
3525 | |||
3526 | } | ||
3527 | |||
3528 | } | 3524 | } |
3529 | |||
3530 | } | 3525 | } |
3531 | else | 3526 | else |
3532 | { | 3527 | { |
3533 | m_log.Warn("[PHYSICS]: Couldn't proceed with UnCombine. Region has inconsistant data."); | 3528 | m_log.Warn("[PHYSICS]: Couldn't proceed with UnCombine. Region has inconsistant data."); |
3534 | |||
3535 | } | 3529 | } |
3536 | 3530 | } | |
3537 | } | ||
3538 | |||
3539 | } | 3531 | } |
3540 | } | 3532 | } |
3541 | |||
3542 | |||
3543 | 3533 | ||
3544 | public override void SetWaterLevel(float baseheight) | 3534 | public override void SetWaterLevel(float baseheight) |
3545 | { | 3535 | { |