aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-11-24 02:43:31 +0000
committerJustin Clark-Casey (justincc)2012-11-24 02:43:31 +0000
commit82690e138448ebac6456ab03dcca4b0a8a1cc57a (patch)
tree0b5de164235b49d9d66f09582b857cd129d68b96 /OpenSim/Region
parentminor: Add some currently commented out debug log lines for investigating iss... (diff)
downloadopensim-SC-82690e138448ebac6456ab03dcca4b0a8a1cc57a.zip
opensim-SC-82690e138448ebac6456ab03dcca4b0a8a1cc57a.tar.gz
opensim-SC-82690e138448ebac6456ab03dcca4b0a8a1cc57a.tar.bz2
opensim-SC-82690e138448ebac6456ab03dcca4b0a8a1cc57a.tar.xz
Fix bug where loading an OAR with a deeded parcel would always set the parcel owner ID to the estate owner even if the group UUID was present.
Aims to address http://opensimulator.org/mantis/view.php?id=6355 As part of this work, an incomplete IXGroupsData was added which currently only allows store/fetch/delete of group records (i.e. no membership data etc) This is subject to change and currently only an in-memory storage implementation exists for regression test purposes.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs30
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs11
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs312
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs5
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandObject.cs13
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs15
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs127
7 files changed, 300 insertions, 213 deletions
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
index 60bbf9b..c810242 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
@@ -552,19 +552,23 @@ namespace OpenSim.Region.CoreModules.World.Archiver
552 552
553 // Validate User and Group UUID's 553 // Validate User and Group UUID's
554 554
555 if (!ResolveUserUuid(scene, parcel.OwnerID)) 555 if (parcel.IsGroupOwned)
556 parcel.OwnerID = m_rootScene.RegionInfo.EstateSettings.EstateOwner;
557
558 if (!ResolveGroupUuid(parcel.GroupID))
559 { 556 {
560// m_log.DebugFormat("[ARCHIVE READ REQUEST]: Could not find group {0}", parcel.GroupID); 557 if (!ResolveGroupUuid(parcel.GroupID))
561 parcel.GroupID = UUID.Zero; 558 {
562 parcel.IsGroupOwned = false; 559 parcel.OwnerID = m_rootScene.RegionInfo.EstateSettings.EstateOwner;
560 parcel.GroupID = UUID.Zero;
561 parcel.IsGroupOwned = false;
562 }
563 }
564 else
565 {
566 if (!ResolveUserUuid(scene, parcel.OwnerID))
567 parcel.OwnerID = m_rootScene.RegionInfo.EstateSettings.EstateOwner;
568
569 if (!ResolveGroupUuid(parcel.GroupID))
570 parcel.GroupID = UUID.Zero;
563 } 571 }
564// else
565// {
566// m_log.DebugFormat("[ARCHIVE READ REQUEST]: Found group {0}", parcel.GroupID);
567// }
568 572
569 List<LandAccessEntry> accessList = new List<LandAccessEntry>(); 573 List<LandAccessEntry> accessList = new List<LandAccessEntry>();
570 foreach (LandAccessEntry entry in parcel.ParcelAccessList) 574 foreach (LandAccessEntry entry in parcel.ParcelAccessList)
@@ -576,8 +580,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver
576 parcel.ParcelAccessList = accessList; 580 parcel.ParcelAccessList = accessList;
577 581
578// m_log.DebugFormat( 582// m_log.DebugFormat(
579// "[ARCHIVER]: Adding parcel {0}, local id {1}, area {2}", 583// "[ARCHIVER]: Adding parcel {0}, local id {1}, owner {2}, group {3}, isGroupOwned {4}, area {5}",
580// parcel.Name, parcel.LocalID, parcel.Area); 584// parcel.Name, parcel.LocalID, parcel.OwnerID, parcel.GroupID, parcel.IsGroupOwned, parcel.Area);
581 585
582 landData.Add(parcel); 586 landData.Add(parcel);
583 } 587 }
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs
index d751b1c..7bdd65c 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs
@@ -167,7 +167,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver
167 } 167 }
168 scenesGroup.CalcSceneLocations(); 168 scenesGroup.CalcSceneLocations();
169 169
170
171 m_archiveWriter = new TarArchiveWriter(m_saveStream); 170 m_archiveWriter = new TarArchiveWriter(m_saveStream);
172 171
173 try 172 try
@@ -216,7 +215,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver
216 } 215 }
217 } 216 }
218 217
219
220 private void ArchiveOneRegion(Scene scene, string regionDir, Dictionary<UUID, AssetType> assetUuids) 218 private void ArchiveOneRegion(Scene scene, string regionDir, Dictionary<UUID, AssetType> assetUuids)
221 { 219 {
222 m_log.InfoFormat("[ARCHIVER]: Writing region {0}", scene.RegionInfo.RegionName); 220 m_log.InfoFormat("[ARCHIVER]: Writing region {0}", scene.RegionInfo.RegionName);
@@ -540,7 +538,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver
540 xtw.WriteElementString("size_in_meters", string.Format("{0},{1}", size.X, size.Y)); 538 xtw.WriteElementString("size_in_meters", string.Format("{0},{1}", size.X, size.Y));
541 } 539 }
542 540
543
544 protected void Save(Scene scene, List<SceneObjectGroup> sceneObjects, string regionDir) 541 protected void Save(Scene scene, List<SceneObjectGroup> sceneObjects, string regionDir)
545 { 542 {
546 if (regionDir != string.Empty) 543 if (regionDir != string.Empty)
@@ -560,8 +557,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver
560 foreach (ILandObject lo in landObjects) 557 foreach (ILandObject lo in landObjects)
561 { 558 {
562 LandData landData = lo.LandData; 559 LandData landData = lo.LandData;
563 string landDataPath = String.Format("{0}{1}{2}.xml", 560 string landDataPath
564 regionDir, ArchiveConstants.LANDDATA_PATH, landData.GlobalID.ToString()); 561 = String.Format("{0}{1}", regionDir, ArchiveConstants.CreateOarLandDataPath(landData));
565 m_archiveWriter.WriteFile(landDataPath, LandDataSerializer.Serialize(landData, m_options)); 562 m_archiveWriter.WriteFile(landDataPath, LandDataSerializer.Serialize(landData, m_options));
566 } 563 }
567 564
@@ -604,7 +601,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver
604 601
605 CloseArchive(String.Empty); 602 CloseArchive(String.Empty);
606 } 603 }
607
608 604
609 /// <summary> 605 /// <summary>
610 /// Closes the archive and notifies that we're done. 606 /// Closes the archive and notifies that we're done.
@@ -629,6 +625,5 @@ namespace OpenSim.Region.CoreModules.World.Archiver
629 625
630 m_rootScene.EventManager.TriggerOarFileSaved(m_requestId, errorMessage); 626 m_rootScene.EventManager.TriggerOarFileSaved(m_requestId, errorMessage);
631 } 627 }
632
633 } 628 }
634} 629} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
index 82f49b0..7cc3519 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
@@ -31,16 +31,19 @@ using System.IO;
31using System.Reflection; 31using System.Reflection;
32using System.Threading; 32using System.Threading;
33using log4net.Config; 33using log4net.Config;
34using Nini.Config;
34using NUnit.Framework; 35using NUnit.Framework;
35using OpenMetaverse; 36using OpenMetaverse;
36using OpenMetaverse.Assets; 37using OpenMetaverse.Assets;
37using OpenSim.Framework; 38using OpenSim.Framework;
38using OpenSim.Framework.Serialization; 39using OpenSim.Framework.Serialization;
39using OpenSim.Framework.Serialization.External; 40using OpenSim.Framework.Serialization.External;
41using OpenSim.Region.CoreModules.World.Land;
40using OpenSim.Region.CoreModules.World.Serialiser; 42using OpenSim.Region.CoreModules.World.Serialiser;
41using OpenSim.Region.CoreModules.World.Terrain; 43using OpenSim.Region.CoreModules.World.Terrain;
42using OpenSim.Region.Framework.Scenes; 44using OpenSim.Region.Framework.Scenes;
43using OpenSim.Region.Framework.Scenes.Serialization; 45using OpenSim.Region.Framework.Scenes.Serialization;
46using OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups;
44using OpenSim.Tests.Common; 47using OpenSim.Tests.Common;
45using OpenSim.Tests.Common.Mock; 48using OpenSim.Tests.Common.Mock;
46using ArchiveConstants = OpenSim.Framework.Serialization.ArchiveConstants; 49using ArchiveConstants = OpenSim.Framework.Serialization.ArchiveConstants;
@@ -127,6 +130,53 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
127 130
128 return new SceneObjectPart(ownerId, shape, groupPosition, rotationOffset, offsetPosition) { Name = partName }; 131 return new SceneObjectPart(ownerId, shape, groupPosition, rotationOffset, offsetPosition) { Name = partName };
129 } 132 }
133
134 private void CreateTestObjects(Scene scene, out SceneObjectGroup sog1, out SceneObjectGroup sog2, out UUID ncAssetUuid)
135 {
136 SceneObjectPart part1 = CreateSceneObjectPart1();
137 sog1 = new SceneObjectGroup(part1);
138 scene.AddNewSceneObject(sog1, false);
139
140 AssetNotecard nc = new AssetNotecard();
141 nc.BodyText = "Hello World!";
142 nc.Encode();
143 ncAssetUuid = UUID.Random();
144 UUID ncItemUuid = UUID.Random();
145 AssetBase ncAsset
146 = AssetHelpers.CreateAsset(ncAssetUuid, AssetType.Notecard, nc.AssetData, UUID.Zero);
147 m_scene.AssetService.Store(ncAsset);
148
149 TaskInventoryItem ncItem
150 = new TaskInventoryItem { Name = "ncItem", AssetID = ncAssetUuid, ItemID = ncItemUuid };
151 SceneObjectPart part2 = CreateSceneObjectPart2();
152 sog2 = new SceneObjectGroup(part2);
153 part2.Inventory.AddInventoryItem(ncItem, true);
154
155 scene.AddNewSceneObject(sog2, false);
156 }
157
158 private static void CreateSoundAsset(TarArchiveWriter tar, Assembly assembly, string soundDataResourceName, out byte[] soundData, out UUID soundUuid)
159 {
160 using (Stream resource = assembly.GetManifestResourceStream(soundDataResourceName))
161 {
162 using (BinaryReader br = new BinaryReader(resource))
163 {
164 // FIXME: Use the inspector instead
165 soundData = br.ReadBytes(99999999);
166 soundUuid = UUID.Parse("00000000-0000-0000-0000-000000000001");
167 string soundAssetFileName
168 = ArchiveConstants.ASSETS_PATH + soundUuid
169 + ArchiveConstants.ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.SoundWAV];
170 tar.WriteFile(soundAssetFileName, soundData);
171
172 /*
173 AssetBase soundAsset = AssetHelpers.CreateAsset(soundUuid, soundData);
174 scene.AssetService.Store(soundAsset);
175 asset1FileName = ArchiveConstants.ASSETS_PATH + soundUuid + ".wav";
176 */
177 }
178 }
179 }
130 180
131 /// <summary> 181 /// <summary>
132 /// Test saving an OpenSim Region Archive. 182 /// Test saving an OpenSim Region Archive.
@@ -204,30 +254,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
204 // TODO: Test presence of more files and contents of files. 254 // TODO: Test presence of more files and contents of files.
205 } 255 }
206 256
207 private void CreateTestObjects(Scene scene, out SceneObjectGroup sog1, out SceneObjectGroup sog2, out UUID ncAssetUuid)
208 {
209 SceneObjectPart part1 = CreateSceneObjectPart1();
210 sog1 = new SceneObjectGroup(part1);
211 scene.AddNewSceneObject(sog1, false);
212
213 AssetNotecard nc = new AssetNotecard();
214 nc.BodyText = "Hello World!";
215 nc.Encode();
216 ncAssetUuid = UUID.Random();
217 UUID ncItemUuid = UUID.Random();
218 AssetBase ncAsset
219 = AssetHelpers.CreateAsset(ncAssetUuid, AssetType.Notecard, nc.AssetData, UUID.Zero);
220 m_scene.AssetService.Store(ncAsset);
221
222 TaskInventoryItem ncItem
223 = new TaskInventoryItem { Name = "ncItem", AssetID = ncAssetUuid, ItemID = ncItemUuid };
224 SceneObjectPart part2 = CreateSceneObjectPart2();
225 sog2 = new SceneObjectGroup(part2);
226 part2.Inventory.AddInventoryItem(ncItem, true);
227
228 scene.AddNewSceneObject(sog2, false);
229 }
230
231 /// <summary> 257 /// <summary>
232 /// Test saving an OpenSim Region Archive with the no assets option 258 /// Test saving an OpenSim Region Archive with the no assets option
233 /// </summary> 259 /// </summary>
@@ -309,59 +335,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
309 } 335 }
310 336
311 /// <summary> 337 /// <summary>
312 /// Test loading an OpenSim Region Archive where the scene object parts are not ordered by link number (e.g.
313 /// 2 can come after 3).
314 /// </summary>
315 [Test]
316 public void TestLoadOarUnorderedParts()
317 {
318 TestHelpers.InMethod();
319
320 UUID ownerId = TestHelpers.ParseTail(0xaaaa);
321
322 MemoryStream archiveWriteStream = new MemoryStream();
323 TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream);
324
325 tar.WriteFile(
326 ArchiveConstants.CONTROL_FILE_PATH,
327 new ArchiveWriteRequest(m_scene, (Stream)null, Guid.Empty).CreateControlFile(new ArchiveScenesGroup()));
328
329 SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, ownerId, "obj1-", 0x11);
330 SceneObjectPart sop2
331 = SceneHelpers.CreateSceneObjectPart("obj1-Part2", TestHelpers.ParseTail(0x12), ownerId);
332 SceneObjectPart sop3
333 = SceneHelpers.CreateSceneObjectPart("obj1-Part3", TestHelpers.ParseTail(0x13), ownerId);
334
335 // Add the parts so they will be written out in reverse order to the oar
336 sog1.AddPart(sop3);
337 sop3.LinkNum = 3;
338 sog1.AddPart(sop2);
339 sop2.LinkNum = 2;
340
341 tar.WriteFile(
342 ArchiveConstants.CreateOarObjectPath(sog1.Name, sog1.UUID, sog1.AbsolutePosition),
343 SceneObjectSerializer.ToXml2Format(sog1));
344
345 tar.Close();
346
347 MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray());
348
349 lock (this)
350 {
351 m_scene.EventManager.OnOarFileLoaded += LoadCompleted;
352 m_archiverModule.DearchiveRegion(archiveReadStream);
353 }
354
355 Assert.That(m_lastErrorMessage, Is.Null);
356
357 SceneObjectPart part2 = m_scene.GetSceneObjectPart("obj1-Part2");
358 Assert.That(part2.LinkNum, Is.EqualTo(2));
359
360 SceneObjectPart part3 = m_scene.GetSceneObjectPart("obj1-Part3");
361 Assert.That(part3.LinkNum, Is.EqualTo(3));
362 }
363
364 /// <summary>
365 /// Test loading an OpenSim Region Archive. 338 /// Test loading an OpenSim Region Archive.
366 /// </summary> 339 /// </summary>
367 [Test] 340 [Test]
@@ -435,50 +408,57 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
435 TestLoadedRegion(part1, soundItemName, soundData); 408 TestLoadedRegion(part1, soundItemName, soundData);
436 } 409 }
437 410
438 private static void CreateSoundAsset(TarArchiveWriter tar, Assembly assembly, string soundDataResourceName, out byte[] soundData, out UUID soundUuid) 411 /// <summary>
412 /// Test loading an OpenSim Region Archive where the scene object parts are not ordered by link number (e.g.
413 /// 2 can come after 3).
414 /// </summary>
415 [Test]
416 public void TestLoadOarUnorderedParts()
439 { 417 {
440 using (Stream resource = assembly.GetManifestResourceStream(soundDataResourceName)) 418 TestHelpers.InMethod();
441 {
442 using (BinaryReader br = new BinaryReader(resource))
443 {
444 // FIXME: Use the inspector instead
445 soundData = br.ReadBytes(99999999);
446 soundUuid = UUID.Parse("00000000-0000-0000-0000-000000000001");
447 string soundAssetFileName
448 = ArchiveConstants.ASSETS_PATH + soundUuid
449 + ArchiveConstants.ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.SoundWAV];
450 tar.WriteFile(soundAssetFileName, soundData);
451 419
452 /* 420 UUID ownerId = TestHelpers.ParseTail(0xaaaa);
453 AssetBase soundAsset = AssetHelpers.CreateAsset(soundUuid, soundData);
454 scene.AssetService.Store(soundAsset);
455 asset1FileName = ArchiveConstants.ASSETS_PATH + soundUuid + ".wav";
456 */
457 }
458 }
459 }
460 421
461 private void TestLoadedRegion(SceneObjectPart part1, string soundItemName, byte[] soundData) 422 MemoryStream archiveWriteStream = new MemoryStream();
462 { 423 TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream);
463 SceneObjectPart object1PartLoaded = m_scene.GetSceneObjectPart(part1.Name);
464 424
465 Assert.That(object1PartLoaded, Is.Not.Null, "object1 was not loaded"); 425 tar.WriteFile(
466 Assert.That(object1PartLoaded.Name, Is.EqualTo(part1.Name), "object1 names not identical"); 426 ArchiveConstants.CONTROL_FILE_PATH,
467 Assert.That(object1PartLoaded.GroupPosition, Is.EqualTo(part1.GroupPosition), "object1 group position not equal"); 427 new ArchiveWriteRequest(m_scene, (Stream)null, Guid.Empty).CreateControlFile(new ArchiveScenesGroup()));
468 Assert.That(
469 object1PartLoaded.RotationOffset, Is.EqualTo(part1.RotationOffset), "object1 rotation offset not equal");
470 Assert.That(
471 object1PartLoaded.OffsetPosition, Is.EqualTo(part1.OffsetPosition), "object1 offset position not equal");
472 Assert.That(object1PartLoaded.SitTargetOrientation, Is.EqualTo(part1.SitTargetOrientation));
473 Assert.That(object1PartLoaded.SitTargetPosition, Is.EqualTo(part1.SitTargetPosition));
474 428
475 TaskInventoryItem loadedSoundItem = object1PartLoaded.Inventory.GetInventoryItems(soundItemName)[0]; 429 SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, ownerId, "obj1-", 0x11);
476 Assert.That(loadedSoundItem, Is.Not.Null, "loaded sound item was null"); 430 SceneObjectPart sop2
477 AssetBase loadedSoundAsset = m_scene.AssetService.Get(loadedSoundItem.AssetID.ToString()); 431 = SceneHelpers.CreateSceneObjectPart("obj1-Part2", TestHelpers.ParseTail(0x12), ownerId);
478 Assert.That(loadedSoundAsset, Is.Not.Null, "loaded sound asset was null"); 432 SceneObjectPart sop3
479 Assert.That(loadedSoundAsset.Data, Is.EqualTo(soundData), "saved and loaded sound data do not match"); 433 = SceneHelpers.CreateSceneObjectPart("obj1-Part3", TestHelpers.ParseTail(0x13), ownerId);
480 434
481 Assert.Greater(m_scene.LandChannel.AllParcels().Count, 0, "incorrect number of parcels"); 435 // Add the parts so they will be written out in reverse order to the oar
436 sog1.AddPart(sop3);
437 sop3.LinkNum = 3;
438 sog1.AddPart(sop2);
439 sop2.LinkNum = 2;
440
441 tar.WriteFile(
442 ArchiveConstants.CreateOarObjectPath(sog1.Name, sog1.UUID, sog1.AbsolutePosition),
443 SceneObjectSerializer.ToXml2Format(sog1));
444
445 tar.Close();
446
447 MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray());
448
449 lock (this)
450 {
451 m_scene.EventManager.OnOarFileLoaded += LoadCompleted;
452 m_archiverModule.DearchiveRegion(archiveReadStream);
453 }
454
455 Assert.That(m_lastErrorMessage, Is.Null);
456
457 SceneObjectPart part2 = m_scene.GetSceneObjectPart("obj1-Part2");
458 Assert.That(part2.LinkNum, Is.EqualTo(2));
459
460 SceneObjectPart part3 = m_scene.GetSceneObjectPart("obj1-Part3");
461 Assert.That(part3.LinkNum, Is.EqualTo(3));
482 } 462 }
483 463
484 /// <summary> 464 /// <summary>
@@ -563,6 +543,81 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
563 } 543 }
564 544
565 /// <summary> 545 /// <summary>
546 /// Test OAR loading where the land parcel is group deeded.
547 /// </summary>
548 /// <remarks>
549 /// In this situation, the owner ID is set to the group ID.
550 /// </remarks>
551 [Test]
552 public void TestLoadOarDeededLand()
553 {
554 TestHelpers.InMethod();
555 TestHelpers.EnableLogging();
556
557 UUID landID = TestHelpers.ParseTail(0x10);
558
559 MockGroupsServicesConnector groupsService = new MockGroupsServicesConnector();
560
561 IConfigSource configSource = new IniConfigSource();
562 IConfig config = configSource.AddConfig("Groups");
563 config.Set("Enabled", true);
564 config.Set("Module", "GroupsModule");
565 config.Set("DebugEnabled", true);
566 SceneHelpers.SetupSceneModules(
567 m_scene, configSource, new object[] { new GroupsModule(), groupsService, new LandManagementModule() });
568
569 // Create group in scene for loading
570 // FIXME: For now we'll put up with the issue that we'll get a group ID that varies across tests.
571 UUID groupID
572 = groupsService.CreateGroup(UUID.Zero, "group1", "", true, UUID.Zero, 3, true, true, true, UUID.Zero);
573
574 // Construct OAR
575 MemoryStream oarStream = new MemoryStream();
576 TarArchiveWriter tar = new TarArchiveWriter(oarStream);
577
578 tar.WriteDir(ArchiveConstants.LANDDATA_PATH);
579 tar.WriteFile(
580 ArchiveConstants.CONTROL_FILE_PATH,
581 new ArchiveWriteRequest(m_scene, (Stream)null, Guid.Empty).CreateControlFile(new ArchiveScenesGroup()));
582
583 LandObject lo = new LandObject(groupID, true, null);
584
585 // FIXME: We set directly rather than call SetLandBitmap in order not to do an AABB value update, which
586 // requests the terrain heightmap from an active scene. This is confusing and not a long-term solution.
587 //lo.LandBitmap = lo.BasicFullRegionLandBitmap();
588 lo.SetLandBitmap(lo.BasicFullRegionLandBitmap());
589
590 // FIXME: We have to make a separate call to update the LandData's copy of the land bitmap, even though this is
591 // identical to the LandObject copy. This should be changed so there's only one copy of the data if at all
592 // possible
593 //lo.UpdateLandBitmapByteArray();
594
595 LandData ld = lo.LandData;
596 ld.GlobalID = landID;
597
598 string ldPath = ArchiveConstants.CreateOarLandDataPath(ld);
599 tar.WriteFile(ldPath, LandDataSerializer.Serialize(ld, null));
600 tar.Close();
601
602 oarStream = new MemoryStream(oarStream.ToArray());
603
604 // Load OAR
605 lock (this)
606 {
607 m_scene.EventManager.OnOarFileLoaded += LoadCompleted;
608 m_archiverModule.DearchiveRegion(oarStream);
609 }
610
611 ILandObject rLo = m_scene.LandChannel.GetLandObject(16, 16);
612 LandData rLd = rLo.LandData;
613
614 Assert.That(rLd.GlobalID, Is.EqualTo(landID));
615 Assert.That(rLd.OwnerID, Is.EqualTo(groupID));
616 Assert.That(rLd.GroupID, Is.EqualTo(groupID));
617 Assert.That(rLd.IsGroupOwned, Is.EqualTo(true));
618 }
619
620 /// <summary>
566 /// Test loading the region settings of an OpenSim Region Archive. 621 /// Test loading the region settings of an OpenSim Region Archive.
567 /// </summary> 622 /// </summary>
568 [Test] 623 [Test]
@@ -781,9 +836,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
781 } 836 }
782 } 837 }
783 838
784
785 // Save OAR 839 // Save OAR
786
787 MemoryStream archiveWriteStream = new MemoryStream(); 840 MemoryStream archiveWriteStream = new MemoryStream();
788 m_scene.EventManager.OnOarFileSaved += SaveCompleted; 841 m_scene.EventManager.OnOarFileSaved += SaveCompleted;
789 842
@@ -800,7 +853,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
800 853
801 854
802 // Check that the OAR contains the expected data 855 // Check that the OAR contains the expected data
803
804 Assert.That(m_lastRequestId, Is.EqualTo(requestId)); 856 Assert.That(m_lastRequestId, Is.EqualTo(requestId));
805 857
806 byte[] archive = archiveWriteStream.ToArray(); 858 byte[] archive = archiveWriteStream.ToArray();
@@ -976,5 +1028,27 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
976 TestLoadedRegion(part1, soundItemName, soundData); 1028 TestLoadedRegion(part1, soundItemName, soundData);
977 } 1029 }
978 1030
1031 private void TestLoadedRegion(SceneObjectPart part1, string soundItemName, byte[] soundData)
1032 {
1033 SceneObjectPart object1PartLoaded = m_scene.GetSceneObjectPart(part1.Name);
1034
1035 Assert.That(object1PartLoaded, Is.Not.Null, "object1 was not loaded");
1036 Assert.That(object1PartLoaded.Name, Is.EqualTo(part1.Name), "object1 names not identical");
1037 Assert.That(object1PartLoaded.GroupPosition, Is.EqualTo(part1.GroupPosition), "object1 group position not equal");
1038 Assert.That(
1039 object1PartLoaded.RotationOffset, Is.EqualTo(part1.RotationOffset), "object1 rotation offset not equal");
1040 Assert.That(
1041 object1PartLoaded.OffsetPosition, Is.EqualTo(part1.OffsetPosition), "object1 offset position not equal");
1042 Assert.That(object1PartLoaded.SitTargetOrientation, Is.EqualTo(part1.SitTargetOrientation));
1043 Assert.That(object1PartLoaded.SitTargetPosition, Is.EqualTo(part1.SitTargetPosition));
1044
1045 TaskInventoryItem loadedSoundItem = object1PartLoaded.Inventory.GetInventoryItems(soundItemName)[0];
1046 Assert.That(loadedSoundItem, Is.Not.Null, "loaded sound item was null");
1047 AssetBase loadedSoundAsset = m_scene.AssetService.Get(loadedSoundItem.AssetID.ToString());
1048 Assert.That(loadedSoundAsset, Is.Not.Null, "loaded sound asset was null");
1049 Assert.That(loadedSoundAsset.Data, Is.EqualTo(soundData), "saved and loaded sound data do not match");
1050
1051 Assert.Greater(m_scene.LandChannel.AllParcels().Count, 0, "incorrect number of parcels");
1052 }
979 } 1053 }
980} 1054} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index 8682798..7149aad 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -1378,10 +1378,11 @@ namespace OpenSim.Region.CoreModules.World.Land
1378 1378
1379 public void EventManagerOnIncomingLandDataFromStorage(List<LandData> data) 1379 public void EventManagerOnIncomingLandDataFromStorage(List<LandData> data)
1380 { 1380 {
1381// m_log.DebugFormat(
1382// "[LAND MANAGMENT MODULE]: Processing {0} incoming parcels on {1}", data.Count, m_scene.Name);
1383
1381 for (int i = 0; i < data.Count; i++) 1384 for (int i = 0; i < data.Count; i++)
1382 {
1383 IncomingLandObjectFromStorage(data[i]); 1385 IncomingLandObjectFromStorage(data[i]);
1384 }
1385 } 1386 }
1386 1387
1387 public void IncomingLandObjectFromStorage(LandData data) 1388 public void IncomingLandObjectFromStorage(LandData data)
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
index 8829f27..5969d45 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
@@ -727,9 +727,10 @@ namespace OpenSim.Region.CoreModules.World.Land
727 int ty = min_y * 4; 727 int ty = min_y * 4;
728 if (ty > ((int)Constants.RegionSize - 1)) 728 if (ty > ((int)Constants.RegionSize - 1))
729 ty = ((int)Constants.RegionSize - 1); 729 ty = ((int)Constants.RegionSize - 1);
730
730 LandData.AABBMin = 731 LandData.AABBMin =
731 new Vector3((float) (min_x * 4), (float) (min_y * 4), 732 new Vector3(
732 (float) m_scene.Heightmap[tx, ty]); 733 (float)(min_x * 4), (float)(min_y * 4), m_scene != null ? (float)m_scene.Heightmap[tx, ty] : 0);
733 734
734 tx = max_x * 4; 735 tx = max_x * 4;
735 if (tx > ((int)Constants.RegionSize - 1)) 736 if (tx > ((int)Constants.RegionSize - 1))
@@ -737,9 +738,11 @@ namespace OpenSim.Region.CoreModules.World.Land
737 ty = max_y * 4; 738 ty = max_y * 4;
738 if (ty > ((int)Constants.RegionSize - 1)) 739 if (ty > ((int)Constants.RegionSize - 1))
739 ty = ((int)Constants.RegionSize - 1); 740 ty = ((int)Constants.RegionSize - 1);
740 LandData.AABBMax = 741
741 new Vector3((float) (max_x * 4), (float) (max_y * 4), 742 LandData.AABBMax
742 (float) m_scene.Heightmap[tx, ty]); 743 = new Vector3(
744 (float)(max_x * 4), (float)(max_y * 4), m_scene != null ? (float)m_scene.Heightmap[tx, ty] : 0);
745
743 LandData.Area = tempArea; 746 LandData.Area = tempArea;
744 } 747 }
745 748
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs
index 6d26075..6b5b40a 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs
@@ -36,7 +36,22 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
36 { 36 {
37 UUID CreateGroup(UUID RequestingAgentID, string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish, UUID founderID); 37 UUID CreateGroup(UUID RequestingAgentID, string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish, UUID founderID);
38 void UpdateGroup(UUID RequestingAgentID, UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish); 38 void UpdateGroup(UUID RequestingAgentID, UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish);
39
40 /// <summary>
41 /// Get the group record.
42 /// </summary>
43 /// <returns></returns>
44 /// <param name='RequestingAgentID'>The UUID of the user making the request.</param>
45 /// <param name='GroupID'>
46 /// The ID of the record to retrieve.
47 /// GroupName may be specified instead, in which case this parameter will be UUID.Zero
48 /// </param>
49 /// <param name='GroupName'>
50 /// The name of the group to retrieve.
51 /// GroupID may be specified instead, in which case this parmeter will be null.
52 /// </param>
39 GroupRecord GetGroupRecord(UUID RequestingAgentID, UUID GroupID, string GroupName); 53 GroupRecord GetGroupRecord(UUID RequestingAgentID, UUID GroupID, string GroupName);
54
40 List<DirGroupsReplyData> FindGroups(UUID RequestingAgentID, string search); 55 List<DirGroupsReplyData> FindGroups(UUID RequestingAgentID, string search);
41 List<GroupMembersData> GetGroupMembers(UUID RequestingAgentID, UUID GroupID); 56 List<GroupMembersData> GetGroupMembers(UUID RequestingAgentID, UUID GroupID);
42 57
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs
index d0c3ea5..1101851 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs
@@ -54,13 +54,62 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
54 54
55 private bool m_debugEnabled = false; 55 private bool m_debugEnabled = false;
56 56
57 public const GroupPowers m_DefaultEveryonePowers = GroupPowers.AllowSetHome | 57 public const GroupPowers DefaultEveryonePowers
58 GroupPowers.Accountable | 58 = GroupPowers.AllowSetHome
59 GroupPowers.JoinChat | 59 | GroupPowers.Accountable
60 GroupPowers.AllowVoiceChat | 60 | GroupPowers.JoinChat
61 GroupPowers.ReceiveNotices | 61 | GroupPowers.AllowVoiceChat
62 GroupPowers.StartProposal | 62 | GroupPowers.ReceiveNotices
63 GroupPowers.VoteOnProposal; 63 | GroupPowers.StartProposal
64 | GroupPowers.VoteOnProposal;
65
66 // Would this be cleaner as (GroupPowers)ulong.MaxValue?
67 public const GroupPowers DefaultOwnerPowers
68 = GroupPowers.Accountable
69 | GroupPowers.AllowEditLand
70 | GroupPowers.AllowFly
71 | GroupPowers.AllowLandmark
72 | GroupPowers.AllowRez
73 | GroupPowers.AllowSetHome
74 | GroupPowers.AllowVoiceChat
75 | GroupPowers.AssignMember
76 | GroupPowers.AssignMemberLimited
77 | GroupPowers.ChangeActions
78 | GroupPowers.ChangeIdentity
79 | GroupPowers.ChangeMedia
80 | GroupPowers.ChangeOptions
81 | GroupPowers.CreateRole
82 | GroupPowers.DeedObject
83 | GroupPowers.DeleteRole
84 | GroupPowers.Eject
85 | GroupPowers.FindPlaces
86 | GroupPowers.Invite
87 | GroupPowers.JoinChat
88 | GroupPowers.LandChangeIdentity
89 | GroupPowers.LandDeed
90 | GroupPowers.LandDivideJoin
91 | GroupPowers.LandEdit
92 | GroupPowers.LandEjectAndFreeze
93 | GroupPowers.LandGardening
94 | GroupPowers.LandManageAllowed
95 | GroupPowers.LandManageBanned
96 | GroupPowers.LandManagePasses
97 | GroupPowers.LandOptions
98 | GroupPowers.LandRelease
99 | GroupPowers.LandSetSale
100 | GroupPowers.ModerateChat
101 | GroupPowers.ObjectManipulate
102 | GroupPowers.ObjectSetForSale
103 | GroupPowers.ReceiveNotices
104 | GroupPowers.RemoveMember
105 | GroupPowers.ReturnGroupOwned
106 | GroupPowers.ReturnGroupSet
107 | GroupPowers.ReturnNonGroup
108 | GroupPowers.RoleProperties
109 | GroupPowers.SendNotices
110 | GroupPowers.SetLandingPoint
111 | GroupPowers.StartProposal
112 | GroupPowers.VoteOnProposal;
64 113
65 private bool m_connectorEnabled = false; 114 private bool m_connectorEnabled = false;
66 115
@@ -219,59 +268,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
219 param["AllowPublish"] = allowPublish == true ? 1 : 0; 268 param["AllowPublish"] = allowPublish == true ? 1 : 0;
220 param["MaturePublish"] = maturePublish == true ? 1 : 0; 269 param["MaturePublish"] = maturePublish == true ? 1 : 0;
221 param["FounderID"] = founderID.ToString(); 270 param["FounderID"] = founderID.ToString();
222 param["EveryonePowers"] = ((ulong)m_DefaultEveryonePowers).ToString(); 271 param["EveryonePowers"] = ((ulong)DefaultEveryonePowers).ToString();
223 param["OwnerRoleID"] = OwnerRoleID.ToString(); 272 param["OwnerRoleID"] = OwnerRoleID.ToString();
224 273 param["OwnersPowers"] = ((ulong)DefaultOwnerPowers).ToString();
225 // Would this be cleaner as (GroupPowers)ulong.MaxValue;
226 GroupPowers OwnerPowers = GroupPowers.Accountable
227 | GroupPowers.AllowEditLand
228 | GroupPowers.AllowFly
229 | GroupPowers.AllowLandmark
230 | GroupPowers.AllowRez
231 | GroupPowers.AllowSetHome
232 | GroupPowers.AllowVoiceChat
233 | GroupPowers.AssignMember
234 | GroupPowers.AssignMemberLimited
235 | GroupPowers.ChangeActions
236 | GroupPowers.ChangeIdentity
237 | GroupPowers.ChangeMedia
238 | GroupPowers.ChangeOptions
239 | GroupPowers.CreateRole
240 | GroupPowers.DeedObject
241 | GroupPowers.DeleteRole
242 | GroupPowers.Eject
243 | GroupPowers.FindPlaces
244 | GroupPowers.Invite
245 | GroupPowers.JoinChat
246 | GroupPowers.LandChangeIdentity
247 | GroupPowers.LandDeed
248 | GroupPowers.LandDivideJoin
249 | GroupPowers.LandEdit
250 | GroupPowers.LandEjectAndFreeze
251 | GroupPowers.LandGardening
252 | GroupPowers.LandManageAllowed
253 | GroupPowers.LandManageBanned
254 | GroupPowers.LandManagePasses
255 | GroupPowers.LandOptions
256 | GroupPowers.LandRelease
257 | GroupPowers.LandSetSale
258 | GroupPowers.ModerateChat
259 | GroupPowers.ObjectManipulate
260 | GroupPowers.ObjectSetForSale
261 | GroupPowers.ReceiveNotices
262 | GroupPowers.RemoveMember
263 | GroupPowers.ReturnGroupOwned
264 | GroupPowers.ReturnGroupSet
265 | GroupPowers.ReturnNonGroup
266 | GroupPowers.RoleProperties
267 | GroupPowers.SendNotices
268 | GroupPowers.SetLandingPoint
269 | GroupPowers.StartProposal
270 | GroupPowers.VoteOnProposal;
271 param["OwnersPowers"] = ((ulong)OwnerPowers).ToString();
272
273
274
275 274
276 Hashtable respData = XmlRpcCall(requestingAgentID, "groups.createGroup", param); 275 Hashtable respData = XmlRpcCall(requestingAgentID, "groups.createGroup", param);
277 276
@@ -612,8 +611,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
612 } 611 }
613 612
614 return Roles; 613 return Roles;
615
616
617 } 614 }
618 615
619 public List<GroupRolesData> GetGroupRoles(UUID requestingAgentID, UUID GroupID) 616 public List<GroupRolesData> GetGroupRoles(UUID requestingAgentID, UUID GroupID)
@@ -676,7 +673,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
676 } 673 }
677 674
678 return members; 675 return members;
679
680 } 676 }
681 677
682 public List<GroupRoleMembersData> GetGroupRoleMembers(UUID requestingAgentID, UUID GroupID) 678 public List<GroupRoleMembersData> GetGroupRoleMembers(UUID requestingAgentID, UUID GroupID)
@@ -727,9 +723,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
727 values.Add(data); 723 values.Add(data);
728 } 724 }
729 } 725 }
730 return values;
731 726
727 return values;
732 } 728 }
729
733 public GroupNoticeInfo GetGroupNotice(UUID requestingAgentID, UUID noticeID) 730 public GroupNoticeInfo GetGroupNotice(UUID requestingAgentID, UUID noticeID)
734 { 731 {
735 Hashtable param = new Hashtable(); 732 Hashtable param = new Hashtable();
@@ -737,7 +734,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
737 734
738 Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroupNotice", param); 735 Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroupNotice", param);
739 736
740
741 if (respData.Contains("error")) 737 if (respData.Contains("error"))
742 { 738 {
743 return null; 739 return null;
@@ -761,6 +757,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
761 757
762 return data; 758 return data;
763 } 759 }
760
764 public void AddGroupNotice(UUID requestingAgentID, UUID groupID, UUID noticeID, string fromName, string subject, string message, byte[] binaryBucket) 761 public void AddGroupNotice(UUID requestingAgentID, UUID groupID, UUID noticeID, string fromName, string subject, string message, byte[] binaryBucket)
765 { 762 {
766 string binBucket = OpenMetaverse.Utils.BytesToHexString(binaryBucket, ""); 763 string binBucket = OpenMetaverse.Utils.BytesToHexString(binaryBucket, "");
@@ -777,8 +774,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
777 XmlRpcCall(requestingAgentID, "groups.addGroupNotice", param); 774 XmlRpcCall(requestingAgentID, "groups.addGroupNotice", param);
778 } 775 }
779 776
780
781
782 #endregion 777 #endregion
783 778
784 #region GroupSessionTracking 779 #region GroupSessionTracking