From aaf912586948a3d0d9bb918952766ba48e90fd18 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 14 Apr 2011 17:33:55 +0100 Subject: simplify coalesced object tests by using existing scene object set up utils this change makes it possible to set an absolute position on a group before it is put into a scene. --- .../Tests/InventoryAccessModuleTests.cs | 40 ++++------------------ .../Region/Framework/Scenes/SceneObjectGroup.cs | 21 ++++++++---- 2 files changed, 20 insertions(+), 41 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs index c76a30a..9fc77a7 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs @@ -87,41 +87,13 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests // log4net.Config.XmlConfigurator.Configure(); // Create asset - SceneObjectGroup object1; - { - string partName = "Object1"; - UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040"); - PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere(); - Vector3 groupPosition = new Vector3(10, 20, 30); - Quaternion rotationOffset = Quaternion.Identity; - Vector3 offsetPosition = new Vector3(5, 10, 15); - - SceneObjectPart part1 - = new SceneObjectPart( - ownerId, shape, groupPosition, rotationOffset, offsetPosition); - part1.Scale = new Vector3(1, 1, 1); - part1.Name = partName; - - object1 = new SceneObjectGroup(part1); - } + SceneObjectGroup object1 = SceneSetupHelpers.CreateSceneObject(1, m_userId, "Object1", 0x20); + object1.AbsolutePosition = new Vector3(15, 30, 45); + object1.Parts[0].Scale = new Vector3(1, 1, 1); - SceneObjectGroup object2; - { - string partName = "Object2"; - UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040"); - PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere(); - Vector3 groupPosition = new Vector3(20, 40, 60); - Quaternion rotationOffset = Quaternion.Identity; - Vector3 offsetPosition = new Vector3(5, 10, 15); - - SceneObjectPart part1 - = new SceneObjectPart( - ownerId, shape, groupPosition, rotationOffset, offsetPosition); - part1.Scale = new Vector3(1, 1, 1); - part1.Name = partName; - - object2 = new SceneObjectGroup(part1); - } + SceneObjectGroup object2 = SceneSetupHelpers.CreateSceneObject(1, m_userId, "Object2", 0x40); + object2.AbsolutePosition = new Vector3(25, 50, 75); + object2.Parts[0].Scale = new Vector3(1, 1, 1); CoalescedSceneObjects coa = new CoalescedSceneObjects(m_userId, object1, object2); diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index ca7d9d9..9bb50db 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -296,11 +296,14 @@ namespace OpenSim.Region.Framework.Scenes { Vector3 val = value; - if ((m_scene.TestBorderCross(val - Vector3.UnitX, Cardinals.E) || m_scene.TestBorderCross(val + Vector3.UnitX, Cardinals.W) - || m_scene.TestBorderCross(val - Vector3.UnitY, Cardinals.N) || m_scene.TestBorderCross(val + Vector3.UnitY, Cardinals.S)) - && !IsAttachmentCheckFull() && (!m_scene.LoadingPrims)) + if (Scene != null) { - m_scene.CrossPrimGroupIntoNewRegion(val, this, true); + if ((Scene.TestBorderCross(val - Vector3.UnitX, Cardinals.E) || Scene.TestBorderCross(val + Vector3.UnitX, Cardinals.W) + || Scene.TestBorderCross(val - Vector3.UnitY, Cardinals.N) || Scene.TestBorderCross(val + Vector3.UnitY, Cardinals.S)) + && !IsAttachmentCheckFull() && (!Scene.LoadingPrims)) + { + m_scene.CrossPrimGroupIntoNewRegion(val, this, true); + } } if (RootPart.GetStatusSandbox()) @@ -308,8 +311,11 @@ namespace OpenSim.Region.Framework.Scenes if (Util.GetDistanceTo(RootPart.StatusSandboxPos, value) > 10) { RootPart.ScriptSetPhysicsStatus(false); - Scene.SimChat(Utils.StringToBytes("Hit Sandbox Limit"), - ChatTypeEnum.DebugChannel, 0x7FFFFFFF, RootPart.AbsolutePosition, Name, UUID, false); + + if (Scene != null) + Scene.SimChat(Utils.StringToBytes("Hit Sandbox Limit"), + ChatTypeEnum.DebugChannel, 0x7FFFFFFF, RootPart.AbsolutePosition, Name, UUID, false); + return; } } @@ -326,7 +332,8 @@ namespace OpenSim.Region.Framework.Scenes //m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor); //} - m_scene.EventManager.TriggerParcelPrimCountTainted(); + if (Scene != null) + Scene.EventManager.TriggerParcelPrimCountTainted(); } } -- cgit v1.1 From c644ab6a2c902c829a0dc88d08780a4411b4cd29 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 14 Apr 2011 20:21:44 +0100 Subject: Make scene object parts created by the test utils unit sized. --- .../Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs | 4 +--- OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs index 9fc77a7..60a932d 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs @@ -89,11 +89,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests // Create asset SceneObjectGroup object1 = SceneSetupHelpers.CreateSceneObject(1, m_userId, "Object1", 0x20); object1.AbsolutePosition = new Vector3(15, 30, 45); - object1.Parts[0].Scale = new Vector3(1, 1, 1); SceneObjectGroup object2 = SceneSetupHelpers.CreateSceneObject(1, m_userId, "Object2", 0x40); - object2.AbsolutePosition = new Vector3(25, 50, 75); - object2.Parts[0].Scale = new Vector3(1, 1, 1); + object2.AbsolutePosition = new Vector3(25, 50, 75); CoalescedSceneObjects coa = new CoalescedSceneObjects(m_userId, object1, object2); diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs index 709dd78..eb08b62 100644 --- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs +++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs @@ -472,10 +472,10 @@ namespace OpenSim.Tests.Common.Setup /// /// public static SceneObjectPart CreateSceneObjectPart(string name, UUID id, UUID ownerId) - { + { return new SceneObjectPart( ownerId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) - { Name = name, UUID = id }; + { Name = name, UUID = id, Scale = new Vector3(1, 1, 1) }; } /// -- cgit v1.1 From e4392648248d11699772aac42db753ae4f84495f Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 14 Apr 2011 20:23:48 +0100 Subject: simplify TestRezObject() --- .../Tests/InventoryAccessModuleTests.cs | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs index 60a932d..7a7a8c2 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs @@ -143,23 +143,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests // log4net.Config.XmlConfigurator.Configure(); // Create asset - SceneObjectGroup object1; - SceneObjectPart part1; - { - string partName = "My Little Dog Object"; - UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040"); - PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere(); - Vector3 groupPosition = new Vector3(10, 20, 30); - Quaternion rotationOffset = new Quaternion(20, 30, 40, 50); - Vector3 offsetPosition = new Vector3(5, 10, 15); - - part1 - = new SceneObjectPart( - ownerId, shape, groupPosition, rotationOffset, offsetPosition); - part1.Name = partName; - - object1 = new SceneObjectGroup(part1); - } + SceneObjectGroup object1 = SceneSetupHelpers.CreateSceneObject(1, m_userId, "My Little Dog Object", 0x40); UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060"); AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1); -- cgit v1.1 From 1569148b49f188f3c46f9fd8ffa096efc70f72fa Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 14 Apr 2011 20:32:27 +0100 Subject: simplify TestSaveItemToIarV0_1() --- .../Archiver/Tests/InventoryArchiverTests.cs | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index 7f156f8..9e3e7d4 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs @@ -84,24 +84,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests UserProfileTestUtils.CreateUserWithInventory(m_scene, userFirstName, userLastName, userId, userPassword); // Create asset - SceneObjectGroup object1; - SceneObjectPart part1; - { - string partName = "My Little Dog Object"; - UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040"); - PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere(); - Vector3 groupPosition = new Vector3(10, 20, 30); - Quaternion rotationOffset = new Quaternion(20, 30, 40, 50); - Vector3 offsetPosition = new Vector3(5, 10, 15); - - part1 - = new SceneObjectPart( - ownerId, shape, groupPosition, rotationOffset, offsetPosition); - part1.Name = partName; - - object1 = new SceneObjectGroup(part1); - m_scene.AddNewSceneObject(object1, false); - } + UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040"); + SceneObjectGroup object1 = SceneSetupHelpers.CreateSceneObject(1, ownerId, "My Little Dog Object", 0x50); UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060"); AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1); -- cgit v1.1 From 55387542eaae8ab27c4709ae5b923d9d2d2a4431 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 14 Apr 2011 20:35:00 +0100 Subject: simplify InventoryArchiveTestCase setup --- .../Archiver/Tests/InventoryArchiveTestCase.cs | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs index e5127a0..7ee6f28 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs @@ -105,24 +105,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests MemoryStream archiveWriteStream = new MemoryStream(); // Create asset - SceneObjectGroup object1; - SceneObjectPart part1; - { - string partName = "Ray Gun Object"; - UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040"); - PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere(); - Vector3 groupPosition = new Vector3(10, 20, 30); - Quaternion rotationOffset = new Quaternion(20, 30, 40, 50); - Vector3 offsetPosition = new Vector3(5, 10, 15); - - part1 - = new SceneObjectPart( - ownerId, shape, groupPosition, rotationOffset, offsetPosition); - part1.Name = partName; - - object1 = new SceneObjectGroup(part1); - scene.AddNewSceneObject(object1, false); - } + UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040"); + SceneObjectGroup object1 = SceneSetupHelpers.CreateSceneObject(1, ownerId, "Ray Gun Object", 0x50); UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060"); AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1); -- cgit v1.1 From 821e67fb950721c0bb8105318e41d7982cf986f2 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 14 Apr 2011 20:59:52 +0100 Subject: implement stub TestLoadCoalesecedItem(). Doesn't do what it's meant to do yet. --- .../Archiver/Tests/InventoryArchiveTestCase.cs | 35 +++++++++++++++++++--- .../Archiver/Tests/InventoryArchiverTests.cs | 17 +++++++++++ OpenSim/Tests/Common/Setup/AssetHelpers.cs | 18 +++++++++-- 3 files changed, 64 insertions(+), 6 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs index 7ee6f28..f2d050c 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs @@ -68,17 +68,21 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000555"), FirstName = "Mr", LastName = "Tiddles" }; + protected UserAccount m_uaLL1 = new UserAccount { PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000666"), FirstName = "Lord", LastName = "Lucan" }; + protected UserAccount m_uaLL2 = new UserAccount { PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000777"), FirstName = "Lord", - LastName = "Lucan" }; + LastName = "Lucan" }; + protected string m_item1Name = "Ray Gun Item"; + protected string m_coaItemName = "Coalesced Item"; [SetUp] public virtual void SetUp() @@ -104,7 +108,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests MemoryStream archiveWriteStream = new MemoryStream(); - // Create asset + // Create scene object asset UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040"); SceneObjectGroup object1 = SceneSetupHelpers.CreateSceneObject(1, ownerId, "Ray Gun Object", 0x50); @@ -112,7 +116,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1); scene.AssetService.Store(asset1); - // Create item + // Create scene object item InventoryItemBase item1 = new InventoryItemBase(); item1.Name = m_item1Name; item1.ID = UUID.Parse("00000000-0000-0000-0000-000000000020"); @@ -123,8 +127,31 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests item1.Folder = scene.InventoryService.GetRootFolder(m_uaLL1.PrincipalID).ID; scene.AddInventoryItem(item1); + // Create coalesced objects asset + SceneObjectGroup cobj1 = SceneSetupHelpers.CreateSceneObject(1, m_uaLL1.PrincipalID, "Object1", 0x120); + cobj1.AbsolutePosition = new Vector3(15, 30, 45); + + SceneObjectGroup cobj2 = SceneSetupHelpers.CreateSceneObject(1, m_uaLL1.PrincipalID, "Object2", 0x140); + cobj2.AbsolutePosition = new Vector3(25, 50, 75); + + CoalescedSceneObjects coa = new CoalescedSceneObjects(m_uaLL1.PrincipalID, cobj1, cobj2); + + AssetBase coaAsset = AssetHelpers.CreateAsset(0x160, coa); + scene.AssetService.Store(coaAsset); + + // Create coalesced objects inventory item + InventoryItemBase coaItem = new InventoryItemBase(); + coaItem.Name = m_coaItemName; + coaItem.ID = UUID.Parse("00000000-0000-0000-0000-000000000180"); + coaItem.AssetID = asset1.FullID; + coaItem.GroupID = UUID.Random(); + coaItem.CreatorIdAsUuid = m_uaLL1.PrincipalID; + coaItem.Owner = m_uaLL1.PrincipalID; + coaItem.Folder = scene.InventoryService.GetRootFolder(m_uaLL1.PrincipalID).ID; + scene.AddInventoryItem(coaItem); + archiverModule.ArchiveInventory( - Guid.NewGuid(), m_uaLL1.FirstName, m_uaLL1.LastName, m_item1Name, "hampshire", archiveWriteStream); + Guid.NewGuid(), m_uaLL1.FirstName, m_uaLL1.LastName, "/*", "hampshire", archiveWriteStream); m_iarStreamBytes = archiveWriteStream.ToArray(); } diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index 9e3e7d4..0c4e364 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs @@ -257,5 +257,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests Assert.That(sog1.RootPart.CreatorID, Is.EqualTo(m_uaMT.PrincipalID)); } + + [Test] + public void TestLoadCoalesecedItem() + { + TestHelper.InMethod(); +// log4net.Config.XmlConfigurator.Configure(); + + UserProfileTestUtils.CreateUserWithInventory(m_scene, m_uaLL1, "password"); + m_archiverModule.DearchiveInventory(m_uaLL1.FirstName, m_uaLL1.LastName, "/", "password", m_iarStream); + + InventoryItemBase coaItem + = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_uaLL1.PrincipalID, m_coaItemName); + + Assert.That(coaItem, Is.Not.Null, "Didn't find loaded item 1"); + + // TODO: Check that the loaded coalesence is valid and that the required scene object assets are around + } } } \ No newline at end of file diff --git a/OpenSim/Tests/Common/Setup/AssetHelpers.cs b/OpenSim/Tests/Common/Setup/AssetHelpers.cs index af66d7f..971c6bc 100644 --- a/OpenSim/Tests/Common/Setup/AssetHelpers.cs +++ b/OpenSim/Tests/Common/Setup/AssetHelpers.cs @@ -55,7 +55,7 @@ namespace OpenSim.Tests.Common AssetBase asset = CreateAsset(UUID.Random(), AssetType.Notecard, "hello", creatorId); scene.AssetService.Store(asset); return asset; - } + } /// /// Create an asset from the given scene object. @@ -75,6 +75,20 @@ namespace OpenSim.Tests.Common /// /// Create an asset from the given scene object. /// + /// + /// The hexadecimal last part of the UUID for the asset created. A UUID of the form "00000000-0000-0000-0000-{0:XD12}" + /// will be used. + /// + /// + /// + public static AssetBase CreateAsset(int assetUuidTail, CoalescedSceneObjects coa) + { + return CreateAsset(new UUID(string.Format("00000000-0000-0000-0000-{0:X12}", assetUuidTail)), coa); + } + + /// + /// Create an asset from the given scene object. + /// /// /// /// @@ -85,7 +99,7 @@ namespace OpenSim.Tests.Common AssetType.Object, Encoding.ASCII.GetBytes(CoalescedSceneObjectsSerializer.ToXml(coa)), coa.CreatorId); - } + } /// /// Create an asset from the given data. -- cgit v1.1 From a0d80140f2d0ad6dd63970a3a3d5c0da8320ae75 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 15 Apr 2011 00:42:06 +0100 Subject: Make all the objects in a coalescence reappears after being loaded from an IAR. This still doesn't work proprerly since some required textures/contained item assets might be missing. From pure code inspection, it looks like the uuid gatherer may get most asset uuids because the scene object serializer naively pulls non-root parts from all contained scene objects into one mega-object. However, root part uuids may well still be missing, and there may be other odd artifacts from this bug. It appears that storing the size of the coalescence and the offsets is redundant, since one can work out this information from the position data already in the scene object groups. --- .../Archiver/InventoryArchiveReadRequest.cs | 28 +++++++++---- .../Archiver/Tests/InventoryArchiveTestCase.cs | 2 +- .../Archiver/Tests/InventoryArchiverTests.cs | 43 +++++++++++--------- .../Asset/LocalAssetServiceConnector.cs | 2 + .../CoalescedSceneObjectsSerializer.cs | 47 +++++++++++++++++++--- OpenSim/Services/AssetService/AssetService.cs | 10 ++++- OpenSim/Services/Interfaces/IAssetService.cs | 5 +++ OpenSim/Tests/Common/Mock/MockAssetService.cs | 22 ++++++++-- OpenSim/Tests/Common/Setup/AssetHelpers.cs | 7 ++++ OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs | 7 +++- 10 files changed, 134 insertions(+), 39 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index 01170aa..f3d2f26 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs @@ -471,16 +471,30 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver if (m_creatorIdForAssetId.ContainsKey(assetId)) { string xmlData = Utils.BytesToString(data); - SceneObjectGroup sog = SceneObjectSerializer.FromOriginalXmlFormat(xmlData); - foreach (SceneObjectPart sop in sog.Parts) + List sceneObjects = new List(); + + CoalescedSceneObjects coa = null; + if (CoalescedSceneObjectsSerializer.TryFromXml(xmlData, out coa)) + { +// m_log.DebugFormat( +// "[INVENTORY ARCHIVER]: Loaded coalescence {0} has {1} objects", assetId, coa.Count); + + sceneObjects.AddRange(coa.Objects); + } + else { - if (sop.CreatorData == null || sop.CreatorData == "") - { - sop.CreatorID = m_creatorIdForAssetId[assetId]; - } + sceneObjects.Add(SceneObjectSerializer.FromOriginalXmlFormat(xmlData)); } - data = Utils.StringToBytes(SceneObjectSerializer.ToOriginalXmlFormat(sog)); + foreach (SceneObjectGroup sog in sceneObjects) + foreach (SceneObjectPart sop in sog.Parts) + if (sop.CreatorData == null || sop.CreatorData == "") + sop.CreatorID = m_creatorIdForAssetId[assetId]; + + if (coa != null) + data = Utils.StringToBytes(CoalescedSceneObjectsSerializer.ToXml(coa)); + else + data = Utils.StringToBytes(SceneObjectSerializer.ToOriginalXmlFormat(sceneObjects[0])); } } diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs index f2d050c..e2316f0 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs @@ -143,7 +143,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests InventoryItemBase coaItem = new InventoryItemBase(); coaItem.Name = m_coaItemName; coaItem.ID = UUID.Parse("00000000-0000-0000-0000-000000000180"); - coaItem.AssetID = asset1.FullID; + coaItem.AssetID = coaAsset.FullID; coaItem.GroupID = UUID.Random(); coaItem.CreatorIdAsUuid = m_uaLL1.PrincipalID; coaItem.Owner = m_uaLL1.PrincipalID; diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index 0c4e364..f747c89 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs @@ -62,9 +62,33 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests SerialiserModule serialiserModule = new SerialiserModule(); m_archiverModule = new InventoryArchiverModule(); - m_scene = SceneSetupHelpers.SetupScene("Inventory"); + m_scene = SceneSetupHelpers.SetupScene("asset inventory"); SceneSetupHelpers.SetupSceneModules(m_scene, serialiserModule, m_archiverModule); } + + [Test] + public void TestLoadCoalesecedItem() + { + TestHelper.InMethod(); +// log4net.Config.XmlConfigurator.Configure(); + + UserProfileTestUtils.CreateUserWithInventory(m_scene, m_uaLL1, "password"); + m_archiverModule.DearchiveInventory(m_uaLL1.FirstName, m_uaLL1.LastName, "/", "password", m_iarStream); + + InventoryItemBase coaItem + = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_uaLL1.PrincipalID, m_coaItemName); + + Assert.That(coaItem, Is.Not.Null, "Didn't find loaded item 1"); + + string assetXml = AssetHelpers.ReadAssetAsString(m_scene.AssetService, coaItem.AssetID); + + CoalescedSceneObjects coa; + bool readResult = CoalescedSceneObjectsSerializer.TryFromXml(assetXml, out coa); + + Assert.That(readResult, Is.True); + + // TODO: Check that the loaded coalesence is valid and that the required scene object assets are around + } /// /// Test saving a single inventory item to a V0.1 OpenSim Inventory Archive @@ -257,22 +281,5 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests Assert.That(sog1.RootPart.CreatorID, Is.EqualTo(m_uaMT.PrincipalID)); } - - [Test] - public void TestLoadCoalesecedItem() - { - TestHelper.InMethod(); -// log4net.Config.XmlConfigurator.Configure(); - - UserProfileTestUtils.CreateUserWithInventory(m_scene, m_uaLL1, "password"); - m_archiverModule.DearchiveInventory(m_uaLL1.FirstName, m_uaLL1.LastName, "/", "password", m_iarStream); - - InventoryItemBase coaItem - = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_uaLL1.PrincipalID, m_coaItemName); - - Assert.That(coaItem, Is.Not.Null, "Didn't find loaded item 1"); - - // TODO: Check that the loaded coalesence is valid and that the required scene object assets are around - } } } \ No newline at end of file diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs index 1b3419d..51d1d59 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs @@ -195,6 +195,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset public byte[] GetData(string id) { +// m_log.DebugFormat("[LOCAL ASSET SERVICES CONNECTOR]: Requesting data for asset {0}", id); + AssetBase asset = m_Cache.Get(id); if (asset != null) diff --git a/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs index a0e120a..babcb54 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs @@ -55,11 +55,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization /// /// public static string ToXml(CoalescedSceneObjects coa) - { - // TODO: Should probably return an empty xml serialization rather than a blank string - if (!coa.HasObjects) - return ""; - + { using (StringWriter sw = new StringWriter()) { using (XmlTextWriter writer = new XmlTextWriter(sw)) @@ -105,10 +101,49 @@ namespace OpenSim.Region.Framework.Scenes.Serialization string output = sw.ToString(); -// m_log.Debug(output); +// Console.WriteLine(output); return output; } } + + public static bool TryFromXml(string xml, out CoalescedSceneObjects coa) + { +// m_log.DebugFormat("[COALESCED SCENE OBJECTS SERIALIZER]: TryFromXml() deserializing {0}", xml); + + coa = null; + + using (StringReader sr = new StringReader(xml)) + { + using (XmlTextReader reader = new XmlTextReader(sr)) + { + reader.Read(); + if (reader.Name != "CoalescedObject") + { +// m_log.DebugFormat( +// "[COALESCED SCENE OBJECTS SERIALIZER]: TryFromXml() root element was {0} so returning false", +// reader.Name); + + return false; + } + + coa = new CoalescedSceneObjects(UUID.Zero); + reader.Read(); + + while (reader.NodeType != XmlNodeType.EndElement && reader.Name != "CoalescedObject") + { + if (reader.Name == "SceneObjectGroup") + { + string soXml = reader.ReadOuterXml(); + coa.Add(SceneObjectSerializer.FromOriginalXmlFormat(soXml)); + } + } + + reader.ReadEndElement(); // CoalescedObject + } + } + + return true; + } } } \ No newline at end of file diff --git a/OpenSim/Services/AssetService/AssetService.cs b/OpenSim/Services/AssetService/AssetService.cs index a81af43..e1f90b6 100644 --- a/OpenSim/Services/AssetService/AssetService.cs +++ b/OpenSim/Services/AssetService/AssetService.cs @@ -89,6 +89,8 @@ namespace OpenSim.Services.AssetService public virtual AssetBase Get(string id) { +// m_log.DebugFormat("[ASSET SERVICE]: Get asset for {0}", id); + UUID assetID; if (!UUID.TryParse(id, out assetID)) @@ -107,6 +109,8 @@ namespace OpenSim.Services.AssetService public virtual AssetMetadata GetMetadata(string id) { +// m_log.DebugFormat("[ASSET SERVICE]: Get asset metadata for {0}", id); + UUID assetID; if (!UUID.TryParse(id, out assetID)) @@ -121,6 +125,8 @@ namespace OpenSim.Services.AssetService public virtual byte[] GetData(string id) { +// m_log.DebugFormat("[ASSET SERVICE]: Get asset data for {0}", id); + UUID assetID; if (!UUID.TryParse(id, out assetID)) @@ -150,7 +156,9 @@ namespace OpenSim.Services.AssetService public virtual string Store(AssetBase asset) { - //m_log.DebugFormat("[ASSET SERVICE]: Store asset {0} {1}", asset.Name, asset.ID); +// m_log.DebugFormat( +// "[ASSET SERVICE]: Storing asset {0} {1}, bytes {2}", asset.Name, asset.ID, asset.Data.Length); + m_Database.StoreAsset(asset); return asset.ID; diff --git a/OpenSim/Services/Interfaces/IAssetService.cs b/OpenSim/Services/Interfaces/IAssetService.cs index 3be6815..1ac1cec 100644 --- a/OpenSim/Services/Interfaces/IAssetService.cs +++ b/OpenSim/Services/Interfaces/IAssetService.cs @@ -48,6 +48,11 @@ namespace OpenSim.Services.Interfaces /// AssetMetadata GetMetadata(string id); + /// + /// Get an asset's data, ignoring the metadata. + /// + /// + /// null if there is no such asset byte[] GetData(string id); /// diff --git a/OpenSim/Tests/Common/Mock/MockAssetService.cs b/OpenSim/Tests/Common/Mock/MockAssetService.cs index 4118308..9d7c5e2 100644 --- a/OpenSim/Tests/Common/Mock/MockAssetService.cs +++ b/OpenSim/Tests/Common/Mock/MockAssetService.cs @@ -54,13 +54,19 @@ namespace OpenSim.Tests.Common.Mock public AssetBase Get(string id) { - m_log.DebugFormat("[MOCK ASSET SERVICE]: Getting asset with id {0}", id); +// m_log.DebugFormat("[MOCK ASSET SERVICE]: Getting asset with id {0}", id); AssetBase asset; if (Assets.ContainsKey(id)) + { asset = Assets[id]; +// m_log.DebugFormat( +// "[MOCK ASSET SERVICE]: Got asset {0} {1}, bytes {2}", asset.Name, asset.ID, asset.Data.Length); + } else - asset = null; + { + asset = null; + } return asset; } @@ -77,7 +83,14 @@ namespace OpenSim.Tests.Common.Mock public byte[] GetData(string id) { - throw new System.NotImplementedException(); +// m_log.DebugFormat("[MOCK ASSET SERVICE]: Requesting data for asset {0}", id); + + AssetBase asset = Get(id); + + if (asset == null) + return null; + else + return asset.Data; } public bool Get(string id, object sender, AssetRetrieved handler) @@ -89,7 +102,8 @@ namespace OpenSim.Tests.Common.Mock public string Store(AssetBase asset) { - m_log.DebugFormat("[MOCK ASSET SERVICE]: Storing asset {0}", asset.ID); +// m_log.DebugFormat( +// "[MOCK ASSET SERVICE]: Storing asset {0} {1}, bytes {2}", asset.Name, asset.ID, asset.Data.Length); Assets[asset.ID] = asset; diff --git a/OpenSim/Tests/Common/Setup/AssetHelpers.cs b/OpenSim/Tests/Common/Setup/AssetHelpers.cs index 971c6bc..d572249 100644 --- a/OpenSim/Tests/Common/Setup/AssetHelpers.cs +++ b/OpenSim/Tests/Common/Setup/AssetHelpers.cs @@ -30,6 +30,7 @@ using OpenMetaverse; using OpenSim.Framework; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes.Serialization; +using OpenSim.Services.Interfaces; namespace OpenSim.Tests.Common { @@ -118,5 +119,11 @@ namespace OpenSim.Tests.Common asset.Data = data; return asset; } + + public static string ReadAssetAsString(IAssetService assetService, UUID uuid) + { + byte[] assetData = assetService.GetData(uuid.ToString()); + return Encoding.ASCII.GetString(assetData); + } } } diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs index eb08b62..837f4e2 100644 --- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs +++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs @@ -168,14 +168,17 @@ namespace OpenSim.Tests.Common.Setup { LocalAssetServicesConnector assetService = new LocalAssetServicesConnector(); IConfigSource config = new IniConfigSource(); - config.AddConfig("Modules"); - config.AddConfig("AssetService"); + config.AddConfig("Modules"); config.Configs["Modules"].Set("AssetServices", "LocalAssetServicesConnector"); + + config.AddConfig("AssetService"); if (real) config.Configs["AssetService"].Set("LocalServiceModule", "OpenSim.Services.AssetService.dll:AssetService"); else config.Configs["AssetService"].Set("LocalServiceModule", "OpenSim.Tests.Common.dll:MockAssetService"); + config.Configs["AssetService"].Set("StorageProvider", "OpenSim.Tests.Common.dll"); + assetService.Initialise(config); assetService.AddRegion(testScene); assetService.RegionLoaded(testScene); -- cgit v1.1 From ad70cddcfc48182f75be7643297cea2a9d20ac91 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 15 Apr 2011 00:56:40 +0100 Subject: extend TestLoadCoalesecedItem() to check loaded object ids and positions --- .../Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index f747c89..69c5dcd 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs @@ -86,8 +86,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests bool readResult = CoalescedSceneObjectsSerializer.TryFromXml(assetXml, out coa); Assert.That(readResult, Is.True); + Assert.That(coa.Count, Is.EqualTo(2)); - // TODO: Check that the loaded coalesence is valid and that the required scene object assets are around + List coaObjects = coa.Objects; + Assert.That(coaObjects[0].UUID, Is.EqualTo(UUID.Parse("00000000-0000-0000-0000-000000000120"))); + Assert.That(coaObjects[0].AbsolutePosition, Is.EqualTo(new Vector3(15, 30, 45))); + + Assert.That(coaObjects[1].UUID, Is.EqualTo(UUID.Parse("00000000-0000-0000-0000-000000000140"))); + Assert.That(coaObjects[1].AbsolutePosition, Is.EqualTo(new Vector3(25, 50, 75))); } /// -- cgit v1.1 From 79bd430e08b9e8612194d9b02504f8f4acd889f6 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 15 Apr 2011 01:10:26 +0100 Subject: Remove the mock inventory service for tests and just use the real one all the time with an in-memory data plugin --- OpenSim/Tests/Common/Mock/MockInventoryService.cs | 186 ---------------------- OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs | 19 +-- 2 files changed, 6 insertions(+), 199 deletions(-) delete mode 100644 OpenSim/Tests/Common/Mock/MockInventoryService.cs (limited to 'OpenSim') diff --git a/OpenSim/Tests/Common/Mock/MockInventoryService.cs b/OpenSim/Tests/Common/Mock/MockInventoryService.cs deleted file mode 100644 index 4ac1078..0000000 --- a/OpenSim/Tests/Common/Mock/MockInventoryService.cs +++ /dev/null @@ -1,186 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; -using System.Text; -using OpenSim.Framework; -using OpenMetaverse; -using OpenSim.Services.Interfaces; -using Nini.Config; - -namespace OpenSim.Tests.Common.Mock -{ - public class MockInventoryService : IInventoryService - { - public MockInventoryService() {} - - public MockInventoryService(IConfigSource config) {} - - /// - /// - /// - /// - /// - public bool CreateUserInventory(UUID userId) - { - return false; - } - - /// - /// - /// - /// - /// - public List GetInventorySkeleton(UUID userId) - { - List folders = new List(); - InventoryFolderBase folder = new InventoryFolderBase(); - folder.ID = UUID.Random(); - folder.Owner = userId; - folders.Add(folder); - return folders; - } - - public InventoryFolderBase GetRootFolder(UUID userID) - { - return new InventoryFolderBase(); - } - - public InventoryCollection GetFolderContent(UUID userID, UUID folderID) - { - return null; - } - - public InventoryFolderBase GetFolderForType(UUID userID, AssetType type) - { - return null; - } - - /// - /// Returns a list of all the active gestures in a user's inventory. - /// - /// - /// The of the user - /// - /// - /// A flat list of the gesture items. - /// - public List GetActiveGestures(UUID userId) - { - return null; - } - - public InventoryCollection GetUserInventory(UUID userID) - { - return null; - } - - public void GetUserInventory(UUID userID, OpenSim.Services.Interfaces.InventoryReceiptCallback callback) - { - } - - public List GetFolderItems(UUID userID, UUID folderID) - { - return null; - } - - public bool AddFolder(InventoryFolderBase folder) - { - return false; - } - - public bool UpdateFolder(InventoryFolderBase folder) - { - return false; - } - - public bool MoveFolder(InventoryFolderBase folder) - { - return false; - } - - public bool DeleteFolders(UUID ownerID, List ids) - { - return false; - } - - public bool PurgeFolder(InventoryFolderBase folder) - { - return false; - } - - public bool AddItem(InventoryItemBase item) - { - return true; - } - - public bool UpdateItem(InventoryItemBase item) - { - return false; - } - - public bool MoveItems(UUID ownerID, List items) - { - return false; - } - - public bool DeleteItems(UUID ownerID, List itemIDs) - { - return false; - } - - public InventoryItemBase GetItem(InventoryItemBase item) - { - return null; - } - - public InventoryFolderBase GetFolder(InventoryFolderBase folder) - { - return null; - } - - public bool HasInventoryForUser(UUID userID) - { - return false; - } - - public InventoryFolderBase RequestRootFolder(UUID userID) - { - InventoryFolderBase root = new InventoryFolderBase(); - root.ID = UUID.Random(); - root.Owner = userID; - root.ParentID = UUID.Zero; - return root; - } - - public int GetAssetPermissions(UUID userID, UUID assetID) - { - return 1; - } - } -} \ No newline at end of file diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs index 837f4e2..97d4ace 100644 --- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs +++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs @@ -137,7 +137,7 @@ namespace OpenSim.Tests.Common.Setup // For now, always started a 'real' authentication service StartAuthenticationService(testScene, true); - LocalInventoryServicesConnector inventoryService = StartInventoryService(testScene, realServices.Contains("inventory")); + LocalInventoryServicesConnector inventoryService = StartInventoryService(testScene); StartGridService(testScene, true); LocalUserAccountServicesConnector userAccountService = StartUserAccountService(testScene); LocalPresenceServicesConnector presenceService = StartPresenceService(testScene); @@ -208,24 +208,17 @@ namespace OpenSim.Tests.Common.Setup //m_authenticationService = service; } - private static LocalInventoryServicesConnector StartInventoryService(Scene testScene, bool real) + private static LocalInventoryServicesConnector StartInventoryService(Scene testScene) { LocalInventoryServicesConnector inventoryService = new LocalInventoryServicesConnector(); - IConfigSource config = new IniConfigSource(); + + IConfigSource config = new IniConfigSource(); config.AddConfig("Modules"); config.AddConfig("InventoryService"); config.Configs["Modules"].Set("InventoryServices", "LocalInventoryServicesConnector"); - - if (real) - { - config.Configs["InventoryService"].Set("LocalServiceModule", "OpenSim.Services.InventoryService.dll:InventoryService"); - } - else - { - config.Configs["InventoryService"].Set("LocalServiceModule", "OpenSim.Tests.Common.dll:MockInventoryService"); - } - + config.Configs["InventoryService"].Set("LocalServiceModule", "OpenSim.Services.InventoryService.dll:InventoryService"); config.Configs["InventoryService"].Set("StorageProvider", "OpenSim.Tests.Common.dll"); + inventoryService.Initialise(config); inventoryService.AddRegion(testScene); inventoryService.RegionLoaded(testScene); -- cgit v1.1 From 54e885581989ddfaf525753ede12c4d4d797cba0 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 15 Apr 2011 01:23:26 +0100 Subject: remove mock asset service for tests in favour of always using the real one --- .../Framework/Scenes/Tests/UuidGathererTests.cs | 4 +- OpenSim/Tests/Common/Mock/MockAssetService.cs | 123 --------------------- OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs | 14 +-- 3 files changed, 8 insertions(+), 133 deletions(-) delete mode 100644 OpenSim/Tests/Common/Mock/MockAssetService.cs (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs index 6b70865..dbf9e0f 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs @@ -47,7 +47,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests [SetUp] public void Init() { - m_assetService = new MockAssetService(); + // FIXME: We don't need a full scene here - it would be enough to set up the asset service. + Scene scene = SceneSetupHelpers.SetupScene(); + m_assetService = scene.AssetService; m_uuidGatherer = new UuidGatherer(m_assetService); } diff --git a/OpenSim/Tests/Common/Mock/MockAssetService.cs b/OpenSim/Tests/Common/Mock/MockAssetService.cs deleted file mode 100644 index 9d7c5e2..0000000 --- a/OpenSim/Tests/Common/Mock/MockAssetService.cs +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; -using System.Reflection; -using log4net; -using OpenMetaverse; -using OpenSim.Framework; -using OpenSim.Data; -using OpenSim.Services.Interfaces; -using Nini.Config; - -namespace OpenSim.Tests.Common.Mock -{ - public class MockAssetService : IAssetService - { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - private readonly Dictionary Assets = new Dictionary(); - - public MockAssetService() {} - - /// - /// This constructor is required if the asset service is being created reflectively (which is the case in some - /// tests). - /// - /// - public MockAssetService(IConfigSource config) {} - - public AssetBase Get(string id) - { -// m_log.DebugFormat("[MOCK ASSET SERVICE]: Getting asset with id {0}", id); - - AssetBase asset; - if (Assets.ContainsKey(id)) - { - asset = Assets[id]; -// m_log.DebugFormat( -// "[MOCK ASSET SERVICE]: Got asset {0} {1}, bytes {2}", asset.Name, asset.ID, asset.Data.Length); - } - else - { - asset = null; - } - - return asset; - } - - public AssetBase GetCached(string id) - { - return Get(id); - } - - public AssetMetadata GetMetadata(string id) - { - throw new System.NotImplementedException(); - } - - public byte[] GetData(string id) - { -// m_log.DebugFormat("[MOCK ASSET SERVICE]: Requesting data for asset {0}", id); - - AssetBase asset = Get(id); - - if (asset == null) - return null; - else - return asset.Data; - } - - public bool Get(string id, object sender, AssetRetrieved handler) - { - handler(id, sender, Get(id)); - - return true; - } - - public string Store(AssetBase asset) - { -// m_log.DebugFormat( -// "[MOCK ASSET SERVICE]: Storing asset {0} {1}, bytes {2}", asset.Name, asset.ID, asset.Data.Length); - - Assets[asset.ID] = asset; - - return asset.ID; - } - - public bool UpdateContent(string id, byte[] data) - { - throw new System.NotImplementedException(); - } - - public bool Delete(string id) - { - throw new System.NotImplementedException(); - } - } -} \ No newline at end of file diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs index 97d4ace..484a97d 100644 --- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs +++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs @@ -132,7 +132,7 @@ namespace OpenSim.Tests.Common.Setup testScene.AddModule(godsModule.Name, godsModule); realServices = realServices.ToLower(); - LocalAssetServicesConnector assetService = StartAssetService(testScene, realServices.Contains("asset")); + LocalAssetServicesConnector assetService = StartAssetService(testScene); // For now, always started a 'real' authentication service StartAuthenticationService(testScene, true); @@ -164,19 +164,15 @@ namespace OpenSim.Tests.Common.Setup return testScene; } - private static LocalAssetServicesConnector StartAssetService(Scene testScene, bool real) + private static LocalAssetServicesConnector StartAssetService(Scene testScene) { LocalAssetServicesConnector assetService = new LocalAssetServicesConnector(); IConfigSource config = new IniConfigSource(); - config.AddConfig("Modules"); - config.Configs["Modules"].Set("AssetServices", "LocalAssetServicesConnector"); + config.AddConfig("Modules"); + config.Configs["Modules"].Set("AssetServices", "LocalAssetServicesConnector"); config.AddConfig("AssetService"); - if (real) - config.Configs["AssetService"].Set("LocalServiceModule", "OpenSim.Services.AssetService.dll:AssetService"); - else - config.Configs["AssetService"].Set("LocalServiceModule", "OpenSim.Tests.Common.dll:MockAssetService"); - + config.Configs["AssetService"].Set("LocalServiceModule", "OpenSim.Services.AssetService.dll:AssetService"); config.Configs["AssetService"].Set("StorageProvider", "OpenSim.Tests.Common.dll"); assetService.Initialise(config); -- cgit v1.1 From ba73df39a3824a91ffc848d9b6dc2356d1b307cf Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 15 Apr 2011 01:26:07 +0100 Subject: remove any reference to a mock authentication service since it doesn't exist and we don't use it --- OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs index 484a97d..b819581 100644 --- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs +++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs @@ -132,11 +132,8 @@ namespace OpenSim.Tests.Common.Setup testScene.AddModule(godsModule.Name, godsModule); realServices = realServices.ToLower(); - LocalAssetServicesConnector assetService = StartAssetService(testScene); - - // For now, always started a 'real' authentication service - StartAuthenticationService(testScene, true); - + LocalAssetServicesConnector assetService = StartAssetService(testScene); + StartAuthenticationService(testScene); LocalInventoryServicesConnector inventoryService = StartInventoryService(testScene); StartGridService(testScene, true); LocalUserAccountServicesConnector userAccountService = StartUserAccountService(testScene); @@ -183,20 +180,18 @@ namespace OpenSim.Tests.Common.Setup return assetService; } - private static void StartAuthenticationService(Scene testScene, bool real) + private static void StartAuthenticationService(Scene testScene) { ISharedRegionModule service = new LocalAuthenticationServicesConnector(); IConfigSource config = new IniConfigSource(); + config.AddConfig("Modules"); config.AddConfig("AuthenticationService"); config.Configs["Modules"].Set("AuthenticationServices", "LocalAuthenticationServicesConnector"); - if (real) - config.Configs["AuthenticationService"].Set( - "LocalServiceModule", "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService"); - else - config.Configs["AuthenticationService"].Set( - "LocalServiceModule", "OpenSim.Tests.Common.dll:MockAuthenticationService"); + config.Configs["AuthenticationService"].Set( + "LocalServiceModule", "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService"); config.Configs["AuthenticationService"].Set("StorageProvider", "OpenSim.Data.Null.dll"); + service.Initialise(config); service.AddRegion(testScene); service.RegionLoaded(testScene); -- cgit v1.1 From 631654a38d2ace833f8cd2dc3b6b3860352f8b13 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 15 Apr 2011 01:30:49 +0100 Subject: remove old code for a mock grid service, which got removed some time back --- OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs index b819581..5d08764 100644 --- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs +++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs @@ -135,7 +135,7 @@ namespace OpenSim.Tests.Common.Setup LocalAssetServicesConnector assetService = StartAssetService(testScene); StartAuthenticationService(testScene); LocalInventoryServicesConnector inventoryService = StartInventoryService(testScene); - StartGridService(testScene, true); + StartGridService(testScene); LocalUserAccountServicesConnector userAccountService = StartUserAccountService(testScene); LocalPresenceServicesConnector presenceService = StartPresenceService(testScene); @@ -218,24 +218,19 @@ namespace OpenSim.Tests.Common.Setup return inventoryService; } - private static LocalGridServicesConnector StartGridService(Scene testScene, bool real) + private static LocalGridServicesConnector StartGridService(Scene testScene) { IConfigSource config = new IniConfigSource(); config.AddConfig("Modules"); config.AddConfig("GridService"); config.Configs["Modules"].Set("GridServices", "LocalGridServicesConnector"); config.Configs["GridService"].Set("StorageProvider", "OpenSim.Data.Null.dll:NullRegionData"); - if (real) - config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Services.GridService.dll:GridService"); + config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Services.GridService.dll:GridService"); LocalGridServicesConnector gridService = new LocalGridServicesConnector(); gridService.Initialise(config); - - //else - // config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Tests.Common.dll:TestGridService"); gridService.AddRegion(testScene); gridService.RegionLoaded(testScene); - //testScene.AddRegionModule(m_gridService.Name, m_gridService); return gridService; } -- cgit v1.1 From 66a62678e5da89b0fa004eca3a370d202c239884 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 15 Apr 2011 01:37:27 +0100 Subject: get rid of all traces of the now used mock service infrastructure --- .../Archiver/Tests/InventoryArchiveTestCase.cs | 2 +- .../Archiver/Tests/InventoryArchiverTests.cs | 2 +- .../Avatar/Inventory/Archiver/Tests/PathTests.cs | 14 +++++----- .../Tests/InventoryAccessModuleTests.cs | 2 +- .../World/Serialiser/Tests/SerialiserTests.cs | 2 +- .../Scenes/Tests/StandaloneTeleportTests.cs | 4 +-- .../Framework/Scenes/Tests/TaskInventoryTests.cs | 4 +-- OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs | 32 ++-------------------- 8 files changed, 17 insertions(+), 45 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs index e2316f0..5ba08ee 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs @@ -101,7 +101,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests // log4net.Config.XmlConfigurator.Configure(); InventoryArchiverModule archiverModule = new InventoryArchiverModule(); - Scene scene = SceneSetupHelpers.SetupScene("Inventory"); + Scene scene = SceneSetupHelpers.SetupScene(); SceneSetupHelpers.SetupSceneModules(scene, archiverModule); UserProfileTestUtils.CreateUserWithInventory(scene, m_uaLL1, "hampshire"); diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index 69c5dcd..d03f6da 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs @@ -62,7 +62,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests SerialiserModule serialiserModule = new SerialiserModule(); m_archiverModule = new InventoryArchiverModule(); - m_scene = SceneSetupHelpers.SetupScene("asset inventory"); + m_scene = SceneSetupHelpers.SetupScene(); SceneSetupHelpers.SetupSceneModules(m_scene, serialiserModule, m_archiverModule); } diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/PathTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/PathTests.cs index 0e8f647..c7dae52 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/PathTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/PathTests.cs @@ -63,7 +63,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests InventoryArchiverModule archiverModule = new InventoryArchiverModule(); - Scene scene = SceneSetupHelpers.SetupScene("Inventory"); + Scene scene = SceneSetupHelpers.SetupScene(); SceneSetupHelpers.SetupSceneModules(scene, archiverModule); // Create user @@ -180,7 +180,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests InventoryArchiverModule archiverModule = new InventoryArchiverModule(); // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene - Scene scene = SceneSetupHelpers.SetupScene("inventory"); + Scene scene = SceneSetupHelpers.SetupScene(); SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); @@ -223,7 +223,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests SerialiserModule serialiserModule = new SerialiserModule(); InventoryArchiverModule archiverModule = new InventoryArchiverModule(); - Scene scene = SceneSetupHelpers.SetupScene("inventory"); + Scene scene = SceneSetupHelpers.SetupScene(); SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); UserProfileTestUtils.CreateUserWithInventory(scene, m_uaMT, "password"); @@ -248,7 +248,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests InventoryArchiverModule archiverModule = new InventoryArchiverModule(); - Scene scene = SceneSetupHelpers.SetupScene("Inventory"); + Scene scene = SceneSetupHelpers.SetupScene(); SceneSetupHelpers.SetupSceneModules(scene, archiverModule); // Create user @@ -327,7 +327,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests TestHelper.InMethod(); // log4net.Config.XmlConfigurator.Configure(); - Scene scene = SceneSetupHelpers.SetupScene("inventory"); + Scene scene = SceneSetupHelpers.SetupScene(); UserAccount ua1 = UserProfileTestUtils.CreateUserWithInventory(scene); Dictionary foldersCreated = new Dictionary(); @@ -394,7 +394,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests TestHelper.InMethod(); //log4net.Config.XmlConfigurator.Configure(); - Scene scene = SceneSetupHelpers.SetupScene("inventory"); + Scene scene = SceneSetupHelpers.SetupScene(); UserAccount ua1 = UserProfileTestUtils.CreateUserWithInventory(scene); string folder1ExistingName = "a"; @@ -445,7 +445,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests TestHelper.InMethod(); // log4net.Config.XmlConfigurator.Configure(); - Scene scene = SceneSetupHelpers.SetupScene("inventory"); + Scene scene = SceneSetupHelpers.SetupScene(); UserAccount ua1 = UserProfileTestUtils.CreateUserWithInventory(scene); string folder1ExistingName = "a"; diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs index 7a7a8c2..8d53cf1 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs @@ -66,7 +66,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests config.AddConfig("Modules"); config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule"); - m_scene = SceneSetupHelpers.SetupScene("Inventory"); + m_scene = SceneSetupHelpers.SetupScene(); SceneSetupHelpers.SetupSceneModules(m_scene, config, m_iam); // Create user diff --git a/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs b/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs index dafaa0c..a866fd9 100644 --- a/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs +++ b/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs @@ -237,7 +237,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests public void Init() { m_serialiserModule = new SerialiserModule(); - m_scene = SceneSetupHelpers.SetupScene(""); + m_scene = SceneSetupHelpers.SetupScene(); SceneSetupHelpers.SetupSceneModules(m_scene, m_serialiserModule); } diff --git a/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs index 8588f7f..dd28416 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs @@ -117,11 +117,11 @@ namespace OpenSim.Region.Framework.Scenes.Tests ISharedRegionModule interregionComms = new LocalSimulationConnectorModule(); - Scene sceneB = SceneSetupHelpers.SetupScene("sceneB", sceneBId, 1010, 1010, "grid"); + Scene sceneB = SceneSetupHelpers.SetupScene("sceneB", sceneBId, 1010, 1010); SceneSetupHelpers.SetupSceneModules(sceneB, new IniConfigSource(), interregionComms); sceneB.RegisterRegionWithGrid(); - Scene sceneA = SceneSetupHelpers.SetupScene("sceneA", sceneAId, 1000, 1000, "grid"); + Scene sceneA = SceneSetupHelpers.SetupScene("sceneA", sceneAId, 1000, 1000); SceneSetupHelpers.SetupSceneModules(sceneA, new IniConfigSource(), interregionComms); sceneA.RegisterRegionWithGrid(); diff --git a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs index 8138bcc..2aef4b0 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs @@ -101,7 +101,7 @@ namespace OpenSim.Region.Framework.Tests TestHelper.InMethod(); // log4net.Config.XmlConfigurator.Configure(); - Scene scene = SceneSetupHelpers.SetupScene("inventory"); + Scene scene = SceneSetupHelpers.SetupScene(); UserAccount user1 = CreateUser(scene); SceneObjectGroup sog1 = CreateSO1(scene, user1.PrincipalID); SceneObjectPart sop1 = sog1.RootPart; @@ -127,7 +127,7 @@ namespace OpenSim.Region.Framework.Tests TestHelper.InMethod(); // log4net.Config.XmlConfigurator.Configure(); - Scene scene = SceneSetupHelpers.SetupScene("inventory"); + Scene scene = SceneSetupHelpers.SetupScene(); UserAccount user1 = CreateUser(scene); SceneObjectGroup sog1 = CreateSO1(scene, user1.PrincipalID); SceneObjectPart sop1 = sog1.RootPart; diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs index 5d08764..99517d2 100644 --- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs +++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs @@ -66,32 +66,7 @@ namespace OpenSim.Tests.Common.Setup /// public static TestScene SetupScene() { - return SetupScene(""); - } - - /// - /// Set up a test scene - /// - /// - /// Starts real inventory and asset services, as opposed to mock ones, if true - /// - public static TestScene SetupScene(String realServices) - { - return SetupScene("Unit test region", UUID.Random(), 1000, 1000, realServices); - } - - /// - /// Set up a test scene - /// - /// Name of the region - /// ID of the region - /// X co-ordinate of the region - /// Y co-ordinate of the region - /// This should be the same if simulating two scenes within a standalone - /// - public static TestScene SetupScene(string name, UUID id, uint x, uint y) - { - return SetupScene(name, id, x, y, ""); + return SetupScene("Unit test region", UUID.Random(), 1000, 1000); } /// @@ -103,10 +78,8 @@ namespace OpenSim.Tests.Common.Setup /// X co-ordinate of the region /// Y co-ordinate of the region /// This should be the same if simulating two scenes within a standalone - /// Starts real inventory and asset services, as opposed to mock ones, if true /// - public static TestScene SetupScene( - string name, UUID id, uint x, uint y, String realServices) + public static TestScene SetupScene(string name, UUID id, uint x, uint y) { Console.WriteLine("Setting up test scene {0}", name); @@ -130,7 +103,6 @@ namespace OpenSim.Tests.Common.Setup IRegionModule godsModule = new GodsModule(); godsModule.Initialise(testScene, new IniConfigSource()); testScene.AddModule(godsModule.Name, godsModule); - realServices = realServices.ToLower(); LocalAssetServicesConnector assetService = StartAssetService(testScene); StartAuthenticationService(testScene); -- cgit v1.1 From 40bf417da7705711f33c64b82611203ff2a0adad Mon Sep 17 00:00:00 2001 From: BlueWall Date: Wed, 13 Apr 2011 16:10:18 -0400 Subject: Add ColladaMesh switch --- OpenSim/Region/CoreModules/Avatar/Assets/GetMeshModule.cs | 13 +++++++++++-- .../Assets/NewFileAgentInventoryVariablePriceModule.cs | 11 ++++++++++- 2 files changed, 21 insertions(+), 3 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Avatar/Assets/GetMeshModule.cs b/OpenSim/Region/CoreModules/Avatar/Assets/GetMeshModule.cs index 878242a..d2278bc 100644 --- a/OpenSim/Region/CoreModules/Avatar/Assets/GetMeshModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Assets/GetMeshModule.cs @@ -54,6 +54,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Assets private Scene m_scene; private IAssetService m_assetService; + private bool m_enabled = true; #region IRegionModuleBase Members @@ -65,7 +66,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Assets public void Initialise(IConfigSource source) { - + IConfig startupConfig = source.Configs["Startup"]; + if (startupConfig == null) + return; + + if (!startupConfig.GetBoolean("ColladaMesh",true)) + m_enabled = false; } public void AddRegion(Scene pScene) @@ -101,16 +107,19 @@ namespace OpenSim.Region.CoreModules.Avatar.Assets public void RegisterCaps(UUID agentID, Caps caps) { + if(!m_enabled) + return; + UUID capID = UUID.Random(); // m_log.Info("[GETMESH]: /CAPS/" + capID); + caps.RegisterHandler("GetMesh", new RestHTTPHandler("GET", "/CAPS/" + capID, delegate(Hashtable m_dhttpMethod) { return ProcessGetMesh(m_dhttpMethod, agentID, caps); })); - } #endregion diff --git a/OpenSim/Region/CoreModules/Avatar/Assets/NewFileAgentInventoryVariablePriceModule.cs b/OpenSim/Region/CoreModules/Avatar/Assets/NewFileAgentInventoryVariablePriceModule.cs index 4a42c93..fb07cc9 100644 --- a/OpenSim/Region/CoreModules/Avatar/Assets/NewFileAgentInventoryVariablePriceModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Assets/NewFileAgentInventoryVariablePriceModule.cs @@ -56,6 +56,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Assets private Scene m_scene; // private IAssetService m_assetService; private bool m_dumpAssetsToFile = false; + private bool m_enabled = true; #region IRegionModuleBase Members @@ -67,7 +68,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Assets public void Initialise(IConfigSource source) { - + IConfig startupConfig = source.Configs["Startup"]; + if (startupConfig == null) + return; + + if (!startupConfig.GetBoolean("ColladaMesh",true)) + m_enabled = false; } public void AddRegion(Scene pScene) @@ -103,6 +109,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Assets public void RegisterCaps(UUID agentID, Caps caps) { + if(!m_enabled) + return; + UUID capID = UUID.Random(); // m_log.Debug("[NEW FILE AGENT INVENTORY VARIABLE PRICE]: /CAPS/" + capID); -- cgit v1.1 From 52d92303926c8be46af734707274e6d8ecd70602 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 15 Apr 2011 22:47:47 +0100 Subject: refactor: split out some rez code into a separate CreateItemForObject() method --- .../InventoryAccess/InventoryAccessModule.cs | 302 +++++++++++---------- 1 file changed, 159 insertions(+), 143 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index c0946f4..0f2b9a6 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs @@ -274,154 +274,22 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess foreach (SceneObjectGroup objectGroup in objlist) objectGroup.AbsolutePosition = originalPositions[objectGroup.UUID]; - // Get the user info of the item destination - // - UUID userID = UUID.Zero; - - if (action == DeRezAction.Take || action == DeRezAction.TakeCopy || - action == DeRezAction.SaveToExistingUserInventoryItem) - { - // Take or take copy require a taker - // Saving changes requires a local user - // - if (remoteClient == null) - return UUID.Zero; - - userID = remoteClient.AgentId; - } - else - { - // All returns / deletes go to the object owner - // - userID = objlist[0].RootPart.OwnerID; - } - - if (userID == UUID.Zero) // Can't proceed - { + InventoryItemBase item = CreateItemForObject(action, remoteClient, objlist[0], folderID); + if (item == null) return UUID.Zero; - } - - // If we're returning someone's item, it goes back to the - // owner's Lost And Found folder. - // Delete is treated like return in this case - // Deleting your own items makes them go to trash - // - - InventoryFolderBase folder = null; - InventoryItemBase item = null; - - if (DeRezAction.SaveToExistingUserInventoryItem == action) + + // Can't know creator is the same, so null it in inventory + if (objlist.Count > 1) { - item = new InventoryItemBase(objlist[0].RootPart.FromUserInventoryItemID, userID); - item = m_Scene.InventoryService.GetItem(item); - - //item = userInfo.RootFolder.FindItem( - // objectGroup.RootPart.FromUserInventoryItemID); - - if (null == item) - { - m_log.DebugFormat( - "[AGENT INVENTORY]: Object {0} {1} scheduled for save to inventory has already been deleted.", - objlist[0].Name, objlist[0].UUID); - return UUID.Zero; - } + item.CreatorId = UUID.Zero.ToString(); + item.Flags = (uint)InventoryItemFlags.ObjectHasMultipleItems; } else { - // Folder magic - // - if (action == DeRezAction.Delete) - { - // Deleting someone else's item - // - if (remoteClient == null || - objlist[0].OwnerID != remoteClient.AgentId) - { - - folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); - } - else - { - folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.TrashFolder); - } - } - else if (action == DeRezAction.Return) - { - - // Dump to lost + found unconditionally - // - folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); - } - - if (folderID == UUID.Zero && folder == null) - { - if (action == DeRezAction.Delete) - { - // Deletes go to trash by default - // - folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.TrashFolder); - } - else - { - if (remoteClient == null || - objlist[0].OwnerID != remoteClient.AgentId) - { - // Taking copy of another person's item. Take to - // Objects folder. - folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.Object); - } - else - { - // Catch all. Use lost & found - // - - folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); - } - } - } - - // Override and put into where it came from, if it came - // from anywhere in inventory - // - if (action == DeRezAction.Take || action == DeRezAction.TakeCopy) - { - if (objlist[0].RootPart.FromFolderID != UUID.Zero) - { - InventoryFolderBase f = new InventoryFolderBase(objlist[0].RootPart.FromFolderID, userID); - folder = m_Scene.InventoryService.GetFolder(f); - } - } - - if (folder == null) // None of the above - { - folder = new InventoryFolderBase(folderID); - - if (folder == null) // Nowhere to put it - { - return UUID.Zero; - } - } - - item = new InventoryItemBase(); - // Can't know creator is the same, so null it in inventory - if (objlist.Count > 1) - item.CreatorId = UUID.Zero.ToString(); - else - item.CreatorId = objlist[0].RootPart.CreatorID.ToString(); - item.ID = UUID.Random(); - item.InvType = (int)InventoryType.Object; - item.Folder = folder.ID; - item.Owner = userID; - if (objlist.Count > 1) - { - item.Flags = (uint)InventoryItemFlags.ObjectHasMultipleItems; - } - else - { - item.SaleType = objlist[0].RootPart.ObjectSaleType; - item.SalePrice = objlist[0].RootPart.SalePrice; - } - } + item.CreatorId = objlist[0].RootPart.CreatorID.ToString(); + item.SaleType = objlist[0].RootPart.ObjectSaleType; + item.SalePrice = objlist[0].RootPart.SalePrice; + } AssetBase asset = CreateAsset( objlist[0].GetPartName(objlist[0].RootPart.LocalId), @@ -505,8 +373,156 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess } } } + return assetID; } + + /// + /// Create an item using details for the given scene object. + /// + /// + /// + /// + /// + /// + protected InventoryItemBase CreateItemForObject( + DeRezAction action, IClientAPI remoteClient, SceneObjectGroup so, UUID folderID) + { + // Get the user info of the item destination + // + UUID userID = UUID.Zero; + + if (action == DeRezAction.Take || action == DeRezAction.TakeCopy || + action == DeRezAction.SaveToExistingUserInventoryItem) + { + // Take or take copy require a taker + // Saving changes requires a local user + // + if (remoteClient == null) + return null; + + userID = remoteClient.AgentId; + } + else + { + // All returns / deletes go to the object owner + // + userID = so.RootPart.OwnerID; + } + + if (userID == UUID.Zero) // Can't proceed + { + return null; + } + + // If we're returning someone's item, it goes back to the + // owner's Lost And Found folder. + // Delete is treated like return in this case + // Deleting your own items makes them go to trash + // + + InventoryFolderBase folder = null; + InventoryItemBase item = null; + + if (DeRezAction.SaveToExistingUserInventoryItem == action) + { + item = new InventoryItemBase(so.RootPart.FromUserInventoryItemID, userID); + item = m_Scene.InventoryService.GetItem(item); + + //item = userInfo.RootFolder.FindItem( + // objectGroup.RootPart.FromUserInventoryItemID); + + if (null == item) + { + m_log.DebugFormat( + "[AGENT INVENTORY]: Object {0} {1} scheduled for save to inventory has already been deleted.", + so.Name, so.UUID); + + return null; + } + } + else + { + // Folder magic + // + if (action == DeRezAction.Delete) + { + // Deleting someone else's item + // + if (remoteClient == null || + so.OwnerID != remoteClient.AgentId) + { + folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); + } + else + { + folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.TrashFolder); + } + } + else if (action == DeRezAction.Return) + { + // Dump to lost + found unconditionally + // + folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); + } + + if (folderID == UUID.Zero && folder == null) + { + if (action == DeRezAction.Delete) + { + // Deletes go to trash by default + // + folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.TrashFolder); + } + else + { + if (remoteClient == null || so.OwnerID != remoteClient.AgentId) + { + // Taking copy of another person's item. Take to + // Objects folder. + folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.Object); + } + else + { + // Catch all. Use lost & found + // + + folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); + } + } + } + + // Override and put into where it came from, if it came + // from anywhere in inventory + // + if (action == DeRezAction.Take || action == DeRezAction.TakeCopy) + { + if (so.RootPart.FromFolderID != UUID.Zero) + { + InventoryFolderBase f = new InventoryFolderBase(so.RootPart.FromFolderID, userID); + folder = m_Scene.InventoryService.GetFolder(f); + } + } + + if (folder == null) // None of the above + { + folder = new InventoryFolderBase(folderID); + + if (folder == null) // Nowhere to put it + { + return null; + } + } + + item = new InventoryItemBase(); + item.ID = UUID.Random(); + item.InvType = (int)InventoryType.Object; + item.Folder = folder.ID; + item.Owner = userID; + } + + return item; + } /// /// Rez an object into the scene from the user's inventory -- cgit v1.1 From 9c7f14bf366eaa113ca7a89d3b40a42529e7726e Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 15 Apr 2011 23:07:23 +0100 Subject: minor: remove a small amount of code duplication --- .../CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 0f2b9a6..5d19025 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs @@ -298,17 +298,16 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess Utils.StringToBytes(itemXml), objlist[0].OwnerID.ToString()); m_Scene.AssetService.Store(asset); - assetID = asset.FullID; + + item.AssetID = asset.FullID; + assetID = asset.FullID; if (DeRezAction.SaveToExistingUserInventoryItem == action) { - item.AssetID = asset.FullID; m_Scene.InventoryService.UpdateItem(item); } else { - item.AssetID = asset.FullID; - uint effectivePerms = (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify | PermissionMask.Move) | 7; foreach (SceneObjectGroup grp in objlist) effectivePerms &= grp.GetEffectivePermissions(); -- cgit v1.1 From fc365f2a31d46b9c6517159330c7f6953eb60e9f Mon Sep 17 00:00:00 2001 From: BlueWall Date: Fri, 15 Apr 2011 18:23:37 -0400 Subject: Thanks Snoopy for a patch that allows setting of perms on items given to new avatars --- .../RemoteController/RemoteAdminPlugin.cs | 35 +++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index 1b4d1ea..c6b34f9 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs @@ -1587,6 +1587,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController { InventoryItemBase destinationItem = new InventoryItemBase(UUID.Random(), destination); destinationItem.Name = item.Name; + destinationItem.Owner = destination; destinationItem.Description = item.Description; destinationItem.InvType = item.InvType; destinationItem.CreatorId = item.CreatorId; @@ -1606,6 +1607,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController destinationItem.Flags = item.Flags; destinationItem.CreationDate = item.CreationDate; destinationItem.Folder = destinationFolder.ID; + ApplyNextOwnerPermissions(destinationItem); m_application.SceneManager.CurrentOrFirstScene.AddInventoryItem(destinationItem); m_log.DebugFormat("[RADMIN]: Added item {0} to folder {1}", destinationItem.ID, destinationFolder.ID); @@ -1640,6 +1642,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController { InventoryItemBase destinationItem = new InventoryItemBase(UUID.Random(), destination); destinationItem.Name = item.Name; + destinationItem.Owner = destination; destinationItem.Description = item.Description; destinationItem.InvType = item.InvType; destinationItem.CreatorId = item.CreatorId; @@ -1659,6 +1662,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController destinationItem.Flags = item.Flags; destinationItem.CreationDate = item.CreationDate; destinationItem.Folder = destinationFolder.ID; + ApplyNextOwnerPermissions(destinationItem); m_application.SceneManager.CurrentOrFirstScene.AddInventoryItem(destinationItem); m_log.DebugFormat("[RADMIN]: Added item {0} to folder {1}", destinationItem.ID, destinationFolder.ID); @@ -1716,7 +1720,11 @@ namespace OpenSim.ApplicationPlugins.RemoteController { destinationFolder = new InventoryFolderBase(); destinationFolder.ID = UUID.Random(); - destinationFolder.Name = assetType.ToString(); + if (assetType == AssetType.Clothing) { + destinationFolder.Name = "Clothing"; + } else { + destinationFolder.Name = "Body Parts"; + } destinationFolder.Owner = destination; destinationFolder.Type = (short)assetType; destinationFolder.ParentID = inventoryService.GetRootFolder(destination).ID; @@ -1748,6 +1756,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController { InventoryItemBase destinationItem = new InventoryItemBase(UUID.Random(), destination); destinationItem.Name = item.Name; + destinationItem.Owner = destination; destinationItem.Description = item.Description; destinationItem.InvType = item.InvType; destinationItem.CreatorId = item.CreatorId; @@ -1767,6 +1776,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController destinationItem.Flags = item.Flags; destinationItem.CreationDate = item.CreationDate; destinationItem.Folder = extraFolder.ID; + ApplyNextOwnerPermissions(destinationItem); m_application.SceneManager.CurrentOrFirstScene.AddInventoryItem(destinationItem); inventoryMap.Add(item.ID, destinationItem.ID); @@ -1784,6 +1794,29 @@ namespace OpenSim.ApplicationPlugins.RemoteController } /// + /// Apply next owner permissions. + /// + + private void ApplyNextOwnerPermissions(InventoryItemBase item) + { + if (item.InvType == (int)InventoryType.Object && (item.CurrentPermissions & 7) != 0) + { + if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0) + item.CurrentPermissions &= ~(uint)PermissionMask.Copy; + if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0) + item.CurrentPermissions &= ~(uint)PermissionMask.Transfer; + if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0) + item.CurrentPermissions &= ~(uint)PermissionMask.Modify; + } + item.CurrentPermissions &= item.NextPermissions; + item.BasePermissions &= item.NextPermissions; + item.EveryOnePermissions &= item.NextPermissions; + // item.OwnerChanged = true; + // item.PermsMask = 0; + // item.PermsGranter = UUID.Zero; + } + + /// /// This method is called if a given model avatar name can not be found. If the external /// file has already been loaded once, then control returns immediately. If not, then it /// looks for a default appearance file. This file contains XML definitions of zero or more named -- cgit v1.1 From 1dba671f45b691bcf024e9ffd5568e8a7ea2165c Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 15 Apr 2011 23:32:46 +0100 Subject: refactor: separate out code that adds permissions --- .../InventoryAccess/InventoryAccessModule.cs | 101 ++++++++++++--------- 1 file changed, 59 insertions(+), 42 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 5d19025..8b68dbe 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs @@ -308,48 +308,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess } else { - uint effectivePerms = (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify | PermissionMask.Move) | 7; - foreach (SceneObjectGroup grp in objlist) - effectivePerms &= grp.GetEffectivePermissions(); - effectivePerms |= (uint)PermissionMask.Move; - - if (remoteClient != null && (remoteClient.AgentId != objlist[0].RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions()) - { - uint perms = effectivePerms; - uint nextPerms = (perms & 7) << 13; - if ((nextPerms & (uint)PermissionMask.Copy) == 0) - perms &= ~(uint)PermissionMask.Copy; - if ((nextPerms & (uint)PermissionMask.Transfer) == 0) - perms &= ~(uint)PermissionMask.Transfer; - if ((nextPerms & (uint)PermissionMask.Modify) == 0) - perms &= ~(uint)PermissionMask.Modify; - - item.BasePermissions = perms & objlist[0].RootPart.NextOwnerMask; - item.CurrentPermissions = item.BasePermissions; - item.NextPermissions = perms & objlist[0].RootPart.NextOwnerMask; - item.EveryOnePermissions = objlist[0].RootPart.EveryoneMask & objlist[0].RootPart.NextOwnerMask; - item.GroupPermissions = objlist[0].RootPart.GroupMask & objlist[0].RootPart.NextOwnerMask; - - // Magic number badness. Maybe this deserves an enum. - // bit 4 (16) is the "Slam" bit, it means treat as passed - // and apply next owner perms on rez - item.CurrentPermissions |= 16; // Slam! - } - else - { - item.BasePermissions = effectivePerms; - item.CurrentPermissions = effectivePerms; - item.NextPermissions = objlist[0].RootPart.NextOwnerMask & effectivePerms; - item.EveryOnePermissions = objlist[0].RootPart.EveryoneMask & effectivePerms; - item.GroupPermissions = objlist[0].RootPart.GroupMask & effectivePerms; - - item.CurrentPermissions &= - ((uint)PermissionMask.Copy | - (uint)PermissionMask.Transfer | - (uint)PermissionMask.Modify | - (uint)PermissionMask.Move | - 7); // Preserve folded permissions - } + AddPermissions(item, objlist[0], objlist, remoteClient); item.CreationDate = Util.UnixTimeSinceEpoch(); item.Description = asset.Description; @@ -377,6 +336,64 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess } /// + /// Add relevant permissions for an object to the item. + /// + /// + /// + /// + /// + /// + protected InventoryItemBase AddPermissions( + InventoryItemBase item, SceneObjectGroup so, List objsForEffectivePermissions, + IClientAPI remoteClient) + { + uint effectivePerms = (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify | PermissionMask.Move) | 7; + foreach (SceneObjectGroup grp in objsForEffectivePermissions) + effectivePerms &= grp.GetEffectivePermissions(); + effectivePerms |= (uint)PermissionMask.Move; + + if (remoteClient != null && (remoteClient.AgentId != so.RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions()) + { + uint perms = effectivePerms; + uint nextPerms = (perms & 7) << 13; + if ((nextPerms & (uint)PermissionMask.Copy) == 0) + perms &= ~(uint)PermissionMask.Copy; + if ((nextPerms & (uint)PermissionMask.Transfer) == 0) + perms &= ~(uint)PermissionMask.Transfer; + if ((nextPerms & (uint)PermissionMask.Modify) == 0) + perms &= ~(uint)PermissionMask.Modify; + + item.BasePermissions = perms & so.RootPart.NextOwnerMask; + item.CurrentPermissions = item.BasePermissions; + item.NextPermissions = perms & so.RootPart.NextOwnerMask; + item.EveryOnePermissions = so.RootPart.EveryoneMask & so.RootPart.NextOwnerMask; + item.GroupPermissions = so.RootPart.GroupMask & so.RootPart.NextOwnerMask; + + // Magic number badness. Maybe this deserves an enum. + // bit 4 (16) is the "Slam" bit, it means treat as passed + // and apply next owner perms on rez + item.CurrentPermissions |= 16; // Slam! + } + else + { + item.BasePermissions = effectivePerms; + item.CurrentPermissions = effectivePerms; + item.NextPermissions = so.RootPart.NextOwnerMask & effectivePerms; + item.EveryOnePermissions = so.RootPart.EveryoneMask & effectivePerms; + item.GroupPermissions = so.RootPart.GroupMask & effectivePerms; + + item.CurrentPermissions &= + ((uint)PermissionMask.Copy | + (uint)PermissionMask.Transfer | + (uint)PermissionMask.Modify | + (uint)PermissionMask.Move | + 7); // Preserve folded permissions + } + + return item; + } + + /// /// Create an item using details for the given scene object. /// /// -- cgit v1.1 From ed74be65995afe192ce03177325c98b0100ab157 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 15 Apr 2011 23:54:30 +0100 Subject: Make remote admin error messages more helpful on windows. Also, make log messages conform more with convention. --- .../RemoteController/RemoteAdminPlugin.cs | 161 ++++++++++----------- 1 file changed, 73 insertions(+), 88 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index c6b34f9..dc4309f 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs @@ -94,7 +94,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController public void Initialise() { - m_log.Info("[RADMIN]: " + Name + " cannot be default-initialized!"); + m_log.Error("[RADMIN]: " + Name + " cannot be default-initialized!"); throw new PluginNotInitialisedException(Name); } @@ -111,7 +111,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController else { m_config = m_configSource.Configs["RemoteAdmin"]; - m_log.Info("[RADMIN]: Remote Admin Plugin Enabled"); + m_log.Debug("[RADMIN]: Remote Admin Plugin Enabled"); m_requiredPassword = m_config.GetString("access_password", String.Empty); int port = m_config.GetInt("port", 0); @@ -230,8 +230,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController } catch (Exception e) { - m_log.ErrorFormat("[RADMIN]: Restart region: failed: {0}", e.Message); - m_log.DebugFormat("[RADMIN]: Restart region: failed: {0}", e.ToString()); + m_log.ErrorFormat("[RADMIN]: Restart region: failed: {0} {1}", e.Message, e.StackTrace); responseData["accepted"] = false; responseData["success"] = false; responseData["rebooting"] = false; @@ -277,8 +276,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController } catch (Exception e) { - m_log.ErrorFormat("[RADMIN]: Broadcasting: failed: {0}", e.Message); - m_log.DebugFormat("[RADMIN]: Broadcasting: failed: {0}", e.ToString()); + m_log.ErrorFormat("[RADMIN]: Broadcasting: failed: {0}", e.Message, e.StackTrace); responseData["accepted"] = false; responseData["success"] = false; @@ -301,7 +299,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController { Hashtable requestData = (Hashtable) request.Params[0]; - m_log.DebugFormat("[RADMIN]: Load Terrain: XmlRpc {0}", request.ToString()); + m_log.DebugFormat("[RADMIN]: Load Terrain: XmlRpc {0}", request); // foreach (string k in requestData.Keys) // { // m_log.DebugFormat("[RADMIN]: Load Terrain: XmlRpc {0}: >{1}< {2}", @@ -348,8 +346,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController } catch (Exception e) { - m_log.ErrorFormat("[RADMIN]: Terrain Loading: failed: {0}", e.Message); - m_log.DebugFormat("[RADMIN]: Terrain Loading: failed: {0}", e.ToString()); + m_log.ErrorFormat("[RADMIN]: Terrain Loading: failed: {0} {1}", e.Message, e.StackTrace); responseData["success"] = false; responseData["error"] = e.Message; @@ -417,14 +414,14 @@ namespace OpenSim.ApplicationPlugins.RemoteController } catch (Exception e) { - m_log.ErrorFormat("[RADMIN] Shutdown: failed: {0}", e.Message); - m_log.DebugFormat("[RADMIN] Shutdown: failed: {0}", e.ToString()); + m_log.ErrorFormat("[RADMIN]: Shutdown: failed: {0} {1}", e.Message, e.StackTrace); responseData["accepted"] = false; responseData["error"] = e.Message; response.Value = responseData; } + m_log.Info("[RADMIN]: Shutdown Administrator Request complete"); return response; } @@ -725,8 +722,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController } catch (Exception e) { - m_log.ErrorFormat("[RADMIN] CreateRegion: failed {0}", e.Message); - m_log.DebugFormat("[RADMIN] CreateRegion: failed {0}", e.ToString()); + m_log.ErrorFormat("[RADMIN] CreateRegion: failed {0} {1}", e.Message, e.StackTrace); responseData["success"] = false; responseData["error"] = e.Message; @@ -792,8 +788,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController } catch (Exception e) { - m_log.ErrorFormat("[RADMIN] DeleteRegion: failed {0}", e.Message); - m_log.DebugFormat("[RADMIN] DeleteRegion: failed {0}", e.ToString()); + m_log.ErrorFormat("[RADMIN] DeleteRegion: failed {0} {1}", e.Message, e.StackTrace); responseData["success"] = false; responseData["error"] = e.Message; @@ -884,8 +879,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController } catch (Exception e) { - m_log.ErrorFormat("[RADMIN] CloseRegion: failed {0}", e.Message); - m_log.DebugFormat("[RADMIN] CloseRegion: failed {0}", e.ToString()); + m_log.ErrorFormat("[RADMIN]: CloseRegion: failed {0} {1}", e.Message, e.StackTrace); responseData["success"] = false; responseData["error"] = e.Message; @@ -982,8 +976,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController } catch (Exception e) { - m_log.ErrorFormat("[RADMIN] ModifyRegion: failed {0}", e.Message); - m_log.DebugFormat("[RADMIN] ModifyRegion: failed {0}", e.ToString()); + m_log.ErrorFormat("[RADMIN] ModifyRegion: failed {0} {1}", e.Message, e.StackTrace); responseData["success"] = false; responseData["error"] = e.Message; @@ -1106,8 +1099,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController } catch (Exception e) { - m_log.ErrorFormat("[RADMIN] CreateUser: failed: {0}", e.Message); - m_log.DebugFormat("[RADMIN] CreateUser: failed: {0}", e.ToString()); + m_log.ErrorFormat("[RADMIN]: CreateUser: failed: {0} {1}", e.Message, e.StackTrace); responseData["success"] = false; responseData["avatar_uuid"] = UUID.Zero.ToString(); @@ -1198,8 +1190,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController } catch (Exception e) { - m_log.ErrorFormat("[RADMIN] UserExists: failed: {0}", e.Message); - m_log.DebugFormat("[RADMIN] UserExists: failed: {0}", e.ToString()); + m_log.ErrorFormat("[RADMIN]: UserExists: failed: {0} {1}", e.Message, e.StackTrace); responseData["success"] = false; responseData["error"] = e.Message; @@ -1372,9 +1363,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController } catch (Exception e) { - - m_log.ErrorFormat("[RADMIN] UpdateUserAccount: failed: {0}", e.Message); - m_log.DebugFormat("[RADMIN] UpdateUserAccount: failed: {0}", e.ToString()); + m_log.ErrorFormat("[RADMIN] UpdateUserAccount: failed: {0} {1}", e.Message, e.StackTrace); responseData["success"] = false; responseData["avatar_uuid"] = UUID.Zero.ToString(); @@ -1382,6 +1371,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController response.Value = responseData; } + m_log.Info("[RADMIN]: UpdateUserAccount: request complete"); return response; } @@ -1397,7 +1387,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController private void UpdateUserAppearance(Hashtable responseData, Hashtable requestData, UUID userid) { - m_log.DebugFormat("[RADMIN] updateUserAppearance"); + m_log.DebugFormat("[RADMIN]: updateUserAppearance"); string defaultMale = m_config.GetString("default_male", "Default Male"); string defaultFemale = m_config.GetString("default_female", "Default Female"); @@ -1437,16 +1427,16 @@ namespace OpenSim.ApplicationPlugins.RemoteController if (String.IsNullOrEmpty(model)) { - m_log.DebugFormat("[RADMIN] Appearance update not requested"); + m_log.DebugFormat("[RADMIN]: Appearance update not requested"); return; } - m_log.DebugFormat("[RADMIN] Setting appearance for avatar {0}, using model <{1}>", userid, model); + m_log.DebugFormat("[RADMIN]: Setting appearance for avatar {0}, using model <{1}>", userid, model); string[] modelSpecifiers = model.Split(); if (modelSpecifiers.Length != 2) { - m_log.WarnFormat("[RADMIN] User appearance not set for {0}. Invalid model name : <{1}>", userid, model); + m_log.WarnFormat("[RADMIN]: User appearance not set for {0}. Invalid model name : <{1}>", userid, model); // modelSpecifiers = dmodel.Split(); return; } @@ -1457,7 +1447,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController if (modelProfile == null) { - m_log.WarnFormat("[RADMIN] Requested model ({0}) not found. Appearance unchanged", model); + m_log.WarnFormat("[RADMIN]: Requested model ({0}) not found. Appearance unchanged", model); return; } @@ -1467,7 +1457,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController EstablishAppearance(userid, modelProfile.PrincipalID); - m_log.DebugFormat("[RADMIN] Finished setting appearance for avatar {0}, using model {1}", + m_log.DebugFormat("[RADMIN]: Finished setting appearance for avatar {0}, using model {1}", userid, model); } @@ -1479,7 +1469,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController private void EstablishAppearance(UUID destination, UUID source) { - m_log.DebugFormat("[RADMIN] Initializing inventory for {0} from {1}", destination, source); + m_log.DebugFormat("[RADMIN]: Initializing inventory for {0} from {1}", destination, source); Scene scene = m_application.SceneManager.CurrentOrFirstScene; // If the model has no associated appearance we're done. @@ -1501,7 +1491,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController } catch (Exception e) { - m_log.WarnFormat("[RADMIN] Error transferring appearance for {0} : {1}", + m_log.WarnFormat("[RADMIN]: Error transferring appearance for {0} : {1}", destination, e.Message); } @@ -1532,7 +1522,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController } catch (Exception e) { - m_log.WarnFormat("[RADMIN] Error transferring appearance for {0} : {1}", + m_log.WarnFormat("[RADMIN]: Error transferring appearance for {0} : {1}", destination, e.Message); } @@ -1567,7 +1557,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController destinationFolder.ParentID = inventoryService.GetRootFolder(destination).ID; destinationFolder.Version = 1; inventoryService.AddFolder(destinationFolder); // store base record - m_log.ErrorFormat("[RADMIN] Created folder for destination {0}", source); + m_log.ErrorFormat("[RADMIN]: Created folder for destination {0}", source); } // Wearables @@ -1730,7 +1720,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController destinationFolder.ParentID = inventoryService.GetRootFolder(destination).ID; destinationFolder.Version = 1; inventoryService.AddFolder(destinationFolder); // store base record - m_log.ErrorFormat("[RADMIN] Created folder for destination {0}", source); + m_log.ErrorFormat("[RADMIN]: Created folder for destination {0}", source); } InventoryFolderBase extraFolder; @@ -1748,7 +1738,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController extraFolder.ParentID = destinationFolder.ID; inventoryService.AddFolder(extraFolder); - m_log.DebugFormat("[RADMIN] Added folder {0} to folder {1}", extraFolder.ID, sourceFolder.ID); + m_log.DebugFormat("[RADMIN]: Added folder {0} to folder {1}", extraFolder.ID, sourceFolder.ID); List items = inventoryService.GetFolderContent(source, folder.ID).Items; @@ -1825,7 +1815,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController /// indicate which outfit is the default, and this outfit will be automatically worn. The /// other outfits are provided to allow "real" avatars a way to easily change their outfits. /// - private bool CreateDefaultAvatars() { // Only load once @@ -1834,7 +1823,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController return false; } - m_log.DebugFormat("[RADMIN] Creating default avatar entries"); + m_log.DebugFormat("[RADMIN]: Creating default avatar entries"); m_defaultAvatarsLoaded = true; @@ -1890,7 +1879,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController foreach (XmlElement avatar in avatars) { - m_log.DebugFormat("[RADMIN] Loading appearance for {0}, gender = {1}", + m_log.DebugFormat("[RADMIN]: Loading appearance for {0}, gender = {1}", GetStringAttribute(avatar,"name","?"), GetStringAttribute(avatar,"gender","?")); // Create the user identified by the avatar entry @@ -1912,7 +1901,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController account = CreateUser(scopeID, names[0], names[1], password, email); if (null == account) { - m_log.ErrorFormat("[RADMIN] Avatar {0} {1} was not created", names[0], names[1]); + m_log.ErrorFormat("[RADMIN]: Avatar {0} {1} was not created", names[0], names[1]); return false; } } @@ -1930,12 +1919,12 @@ namespace OpenSim.ApplicationPlugins.RemoteController ID = account.PrincipalID; - m_log.DebugFormat("[RADMIN] User {0}[{1}] created or retrieved", name, ID); + m_log.DebugFormat("[RADMIN]: User {0}[{1}] created or retrieved", name, ID); include = true; } catch (Exception e) { - m_log.DebugFormat("[RADMIN] Error creating user {0} : {1}", name, e.Message); + m_log.DebugFormat("[RADMIN]: Error creating user {0} : {1}", name, e.Message); include = false; } @@ -1975,7 +1964,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController clothingFolder.ParentID = inventoryService.GetRootFolder(ID).ID; clothingFolder.Version = 1; inventoryService.AddFolder(clothingFolder); // store base record - m_log.ErrorFormat("[RADMIN] Created clothing folder for {0}/{1}", name, ID); + m_log.ErrorFormat("[RADMIN]: Created clothing folder for {0}/{1}", name, ID); } // OK, now we have an inventory for the user, read in the outfits from the @@ -1988,7 +1977,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController foreach (XmlElement outfit in outfits) { - m_log.DebugFormat("[RADMIN] Loading outfit {0} for {1}", + m_log.DebugFormat("[RADMIN]: Loading outfit {0} for {1}", GetStringAttribute(outfit,"name","?"), GetStringAttribute(avatar,"name","?")); outfitName = GetStringAttribute(outfit,"name",""); @@ -2012,7 +2001,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController // Otherwise, we must create the folder. if (extraFolder == null) { - m_log.DebugFormat("[RADMIN] Creating outfit folder {0} for {1}", outfitName, name); + m_log.DebugFormat("[RADMIN]: Creating outfit folder {0} for {1}", outfitName, name); extraFolder = new InventoryFolderBase(); extraFolder.ID = UUID.Random(); extraFolder.Name = outfitName; @@ -2021,7 +2010,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController extraFolder.Version = 1; extraFolder.ParentID = clothingFolder.ID; inventoryService.AddFolder(extraFolder); - m_log.DebugFormat("[RADMIN] Adding outfile folder {0} to folder {1}", extraFolder.ID, clothingFolder.ID); + m_log.DebugFormat("[RADMIN]: Adding outfile folder {0} to folder {1}", extraFolder.ID, clothingFolder.ID); } // Now get the pieces that make up the outfit @@ -2036,7 +2025,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController switch (child.Name) { case "Permissions" : - m_log.DebugFormat("[RADMIN] Permissions specified"); + m_log.DebugFormat("[RADMIN]: Permissions specified"); perms = child; break; case "Asset" : @@ -2086,7 +2075,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController inventoryItem.Folder = extraFolder.ID; // Parent folder m_application.SceneManager.CurrentOrFirstScene.AddInventoryItem(inventoryItem); - m_log.DebugFormat("[RADMIN] Added item {0} to folder {1}", inventoryItem.ID, extraFolder.ID); + m_log.DebugFormat("[RADMIN]: Added item {0} to folder {1}", inventoryItem.ID, extraFolder.ID); } // Attach item, if attachpoint is specified @@ -2094,7 +2083,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController if (attachpoint != 0) { avatarAppearance.SetAttachment(attachpoint, inventoryItem.ID, inventoryItem.AssetID); - m_log.DebugFormat("[RADMIN] Attached {0}", inventoryItem.ID); + m_log.DebugFormat("[RADMIN]: Attached {0}", inventoryItem.ID); } // Record whether or not the item is to be initially worn @@ -2107,32 +2096,32 @@ namespace OpenSim.ApplicationPlugins.RemoteController } catch (Exception e) { - m_log.WarnFormat("[RADMIN] Error wearing item {0} : {1}", inventoryItem.ID, e.Message); + m_log.WarnFormat("[RADMIN]: Error wearing item {0} : {1}", inventoryItem.ID, e.Message); } } // foreach item in outfit - m_log.DebugFormat("[RADMIN] Outfit {0} load completed", outfitName); + m_log.DebugFormat("[RADMIN]: Outfit {0} load completed", outfitName); } // foreach outfit - m_log.DebugFormat("[RADMIN] Inventory update complete for {0}", name); + m_log.DebugFormat("[RADMIN]: Inventory update complete for {0}", name); scene.AvatarService.SetAppearance(ID, avatarAppearance); } catch (Exception e) { - m_log.WarnFormat("[RADMIN] Inventory processing incomplete for user {0} : {1}", + m_log.WarnFormat("[RADMIN]: Inventory processing incomplete for user {0} : {1}", name, e.Message); } } // End of include } - m_log.DebugFormat("[RADMIN] Default avatar loading complete"); + m_log.DebugFormat("[RADMIN]: Default avatar loading complete"); } else { - m_log.DebugFormat("[RADMIN] No default avatar information available"); + m_log.DebugFormat("[RADMIN]: No default avatar information available"); return false; } } catch (Exception e) { - m_log.WarnFormat("[RADMIN] Exception whilst loading default avatars ; {0}", e.Message); + m_log.WarnFormat("[RADMIN]: Exception whilst loading default avatars ; {0}", e.Message); return false; } @@ -2227,8 +2216,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController } catch (Exception e) { - m_log.InfoFormat("[RADMIN] LoadOAR: {0}", e.Message); - m_log.DebugFormat("[RADMIN] LoadOAR: {0}", e.ToString()); + m_log.ErrorFormat("[RADMIN]: LoadOAR: {0} {1}", e.Message, e.StackTrace); responseData["loaded"] = false; responseData["error"] = e.Message; @@ -2333,8 +2321,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController } catch (Exception e) { - m_log.InfoFormat("[RADMIN] SaveOAR: {0}", e.Message); - m_log.DebugFormat("[RADMIN] SaveOAR: {0}", e.ToString()); + m_log.ErrorFormat("[RADMIN]: SaveOAR: {0} {1}", e.Message, e.StackTrace); responseData["saved"] = false; responseData["error"] = e.Message; @@ -2348,7 +2335,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController private void RemoteAdminOarSaveCompleted(Guid uuid, string name) { - m_log.DebugFormat("[RADMIN] File processing complete for {0}", name); + m_log.DebugFormat("[RADMIN]: File processing complete for {0}", name); lock (m_saveOarLock) Monitor.Pulse(m_saveOarLock); } @@ -2386,14 +2373,14 @@ namespace OpenSim.ApplicationPlugins.RemoteController UUID region_uuid = (UUID) (string) requestData["region_uuid"]; if (!m_application.SceneManager.TrySetCurrentScene(region_uuid)) throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); - m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString()); + m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_uuid.ToString()); } else if (requestData.Contains("region_name")) { string region_name = (string) requestData["region_name"]; if (!m_application.SceneManager.TrySetCurrentScene(region_name)) throw new Exception(String.Format("failed to switch to region {0}", region_name)); - m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name); + m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_name); } else throw new Exception("neither region_name nor region_uuid given"); @@ -2424,8 +2411,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController } catch (Exception e) { - m_log.InfoFormat("[RADMIN] LoadXml: {0}", e.Message); - m_log.DebugFormat("[RADMIN] LoadXml: {0}", e.ToString()); + m_log.ErrorFormat("[RADMIN] LoadXml: {0} {1}", e.Message, e.StackTrace); responseData["loaded"] = false; responseData["switched"] = false; @@ -2471,14 +2457,14 @@ namespace OpenSim.ApplicationPlugins.RemoteController UUID region_uuid = (UUID) (string) requestData["region_uuid"]; if (!m_application.SceneManager.TrySetCurrentScene(region_uuid)) throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); - m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString()); + m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_uuid.ToString()); } else if (requestData.Contains("region_name")) { string region_name = (string) requestData["region_name"]; if (!m_application.SceneManager.TrySetCurrentScene(region_name)) throw new Exception(String.Format("failed to switch to region {0}", region_name)); - m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name); + m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_name); } else throw new Exception("neither region_name nor region_uuid given"); @@ -2510,8 +2496,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController } catch (Exception e) { - m_log.InfoFormat("[RADMIN] SaveXml: {0}", e.Message); - m_log.DebugFormat("[RADMIN] SaveXml: {0}", e.ToString()); + m_log.ErrorFormat("[RADMIN]: SaveXml: {0} {1}", e.Message, e.StackTrace); responseData["saved"] = false; responseData["switched"] = false; @@ -2550,14 +2535,14 @@ namespace OpenSim.ApplicationPlugins.RemoteController UUID region_uuid = (UUID) (string) requestData["region_uuid"]; if (!m_application.SceneManager.TrySetCurrentScene(region_uuid)) throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); - m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString()); + m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_uuid.ToString()); } else if (requestData.Contains("region_name")) { string region_name = (string) requestData["region_name"]; if (!m_application.SceneManager.TrySetCurrentScene(region_name)) throw new Exception(String.Format("failed to switch to region {0}", region_name)); - m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name); + m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_name); } else throw new Exception("neither region_name nor region_uuid given"); @@ -2569,7 +2554,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController } catch (Exception e) { - m_log.InfoFormat("[RADMIN] RegionQuery: {0}", e.Message); + m_log.InfoFormat("[RADMIN]: RegionQuery: {0}", e.Message); responseData["success"] = false; responseData["error"] = e.Message; @@ -2610,7 +2595,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController } catch (Exception e) { - m_log.InfoFormat("[RADMIN] ConsoleCommand: {0}", e.Message); + m_log.InfoFormat("[RADMIN]: ConsoleCommand: {0}", e.Message); responseData["success"] = false; responseData["error"] = e.Message; @@ -2647,14 +2632,14 @@ namespace OpenSim.ApplicationPlugins.RemoteController UUID region_uuid = (UUID) (string) requestData["region_uuid"]; if (!m_application.SceneManager.TrySetCurrentScene(region_uuid)) throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); - m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString()); + m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_uuid.ToString()); } else if (requestData.Contains("region_name")) { string region_name = (string) requestData["region_name"]; if (!m_application.SceneManager.TrySetCurrentScene(region_name)) throw new Exception(String.Format("failed to switch to region {0}", region_name)); - m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name); + m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_name); } else throw new Exception("neither region_name nor region_uuid given"); @@ -2665,7 +2650,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController } catch (Exception e) { - m_log.InfoFormat("[RADMIN] Access List Clear Request: {0}", e.Message); + m_log.ErrorFormat("[RADMIN]: Access List Clear Request: {0} {1}", e.Message, e.StackTrace); responseData["success"] = false; responseData["error"] = e.Message; @@ -2704,14 +2689,14 @@ namespace OpenSim.ApplicationPlugins.RemoteController UUID region_uuid = (UUID) (string) requestData["region_uuid"]; if (!m_application.SceneManager.TrySetCurrentScene(region_uuid)) throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); - m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString()); + m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_uuid.ToString()); } else if (requestData.Contains("region_name")) { string region_name = (string) requestData["region_name"]; if (!m_application.SceneManager.TrySetCurrentScene(region_name)) throw new Exception(String.Format("failed to switch to region {0}", region_name)); - m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name); + m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_name); } else throw new Exception("neither region_name nor region_uuid given"); @@ -2731,7 +2716,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController if (account != null) { uuids.Add(account.PrincipalID); - m_log.DebugFormat("[RADMIN] adding \"{0}\" to ACL for \"{1}\"", name, scene.RegionInfo.RegionName); + m_log.DebugFormat("[RADMIN]: adding \"{0}\" to ACL for \"{1}\"", name, scene.RegionInfo.RegionName); } } List accessControlList = new List(scene.RegionInfo.EstateSettings.EstateAccess); @@ -2752,7 +2737,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController } catch (Exception e) { - m_log.InfoFormat("[RADMIN] Access List Add Request: {0}", e.Message); + m_log.ErrorFormat("[RADMIN]: Access List Add Request: {0} {1}", e.Message, e.StackTrace); responseData["success"] = false; responseData["error"] = e.Message; @@ -2791,14 +2776,14 @@ namespace OpenSim.ApplicationPlugins.RemoteController UUID region_uuid = (UUID) (string) requestData["region_uuid"]; if (!m_application.SceneManager.TrySetCurrentScene(region_uuid)) throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); - m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString()); + m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_uuid.ToString()); } else if (requestData.Contains("region_name")) { string region_name = (string) requestData["region_name"]; if (!m_application.SceneManager.TrySetCurrentScene(region_name)) throw new Exception(String.Format("failed to switch to region {0}", region_name)); - m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name); + m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_name); } else throw new Exception("neither region_name nor region_uuid given"); @@ -2839,7 +2824,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController } catch (Exception e) { - m_log.InfoFormat("[RADMIN] Access List Remove Request: {0}", e.Message); + m_log.ErrorFormat("[RADMIN]: Access List Remove Request: {0} {1}", e.Message, e.StackTrace); responseData["success"] = false; responseData["error"] = e.Message; @@ -2878,14 +2863,14 @@ namespace OpenSim.ApplicationPlugins.RemoteController UUID region_uuid = (UUID) (string) requestData["region_uuid"]; if (!m_application.SceneManager.TrySetCurrentScene(region_uuid)) throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); - m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString()); + m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_uuid.ToString()); } else if (requestData.Contains("region_name")) { string region_name = (string) requestData["region_name"]; if (!m_application.SceneManager.TrySetCurrentScene(region_name)) throw new Exception(String.Format("failed to switch to region {0}", region_name)); - m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name); + m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_name); } else throw new Exception("neither region_name nor region_uuid given"); @@ -2907,7 +2892,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController } catch (Exception e) { - m_log.InfoFormat("[RADMIN] Acces List List: {0}", e.Message); + m_log.ErrorFormat("[RADMIN]: Access List List: {0} {1}", e.Message, e.StackTrace); responseData["success"] = false; responseData["error"] = e.Message; -- cgit v1.1 From cd6dce11086a4e8a06257659c19eaa66d3b1a951 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 15 Apr 2011 16:42:40 -0700 Subject: Fixes mantis #5431 -- coalesced objects in HG-enabled regions. Needs more testing to make sure HG inventory isn't broken by this (it shouldn't). --- .../InventoryAccess/HGInventoryAccessModule.cs | 27 +++------------------- .../InventoryAccess/InventoryAccessModule.cs | 10 +++++++- 2 files changed, 12 insertions(+), 25 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs index 4565d10..8c99983 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs @@ -129,35 +129,14 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess } /// - /// DeleteToInventory + /// Used in DeleteToInventory /// - public override UUID DeleteToInventory(DeRezAction action, UUID folderID, List objectGroups, IClientAPI remoteClient) + protected override void ExportAsset(UUID agentID, UUID assetID) { - UUID ret = UUID.Zero; - - // HACK: Only works for lists of length one. - // Intermediate version, just to make things compile - foreach (SceneObjectGroup g in objectGroups) - ret = DeleteToInventory(action, folderID, g, remoteClient); - - return ret; - } - - // DO NOT OVERRIDE THE BASE METHOD - public new virtual UUID DeleteToInventory(DeRezAction action, UUID folderID, - SceneObjectGroup objectGroup, IClientAPI remoteClient) - { - UUID assetID = base.DeleteToInventory(action, folderID, new List() {objectGroup}, remoteClient); - if (!assetID.Equals(UUID.Zero)) - { - if (remoteClient != null) - UploadInventoryItem(remoteClient.AgentId, assetID, "", 0); - } + UploadInventoryItem(agentID, assetID, "", 0); else m_log.Debug("[HGScene]: Scene.Inventory did not create asset"); - - return assetID; } /// diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 8b68dbe..a716326 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs @@ -330,11 +330,19 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess } } } + + // This is a hook to do some per-asset post-processing for subclasses that need that + ExportAsset(remoteClient.AgentId, assetID); } return assetID; } - + + protected virtual void ExportAsset(UUID agentID, UUID assetID) + { + // nothing to do here + } + /// /// Add relevant permissions for an object to the item. /// -- cgit v1.1 From 70084c5e3a34e681357baf5506bd0c8f9815049b Mon Sep 17 00:00:00 2001 From: Dan Lake Date: Sat, 16 Apr 2011 15:29:28 -0700 Subject: More descriptive debug msg for ServiceOSDRequest failures. --- OpenSim/Framework/WebUtil.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index 64cd014..9d70f63 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs @@ -222,8 +222,8 @@ namespace OpenSim.Framework m_log.InfoFormat("[WEB UTIL]: osd request <{0}> (URI:{1}, METHOD:{2}) took {3}ms overall, {4}ms writing", reqnum,url,method,tickdiff,tickdata); } - - m_log.WarnFormat("[WEB UTIL] <{0}> osd request failed: {1}",reqnum,errorMessage); + + m_log.WarnFormat("[WEB UTIL]: <{0}> osd request for {1}, method {2} FAILED: {3}", reqnum, url, method, errorMessage); return ErrorResponseMap(errorMessage); } -- cgit v1.1 From 03e725ad87916965ebcd8cb264f7a614342da9b7 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 17 Apr 2011 21:43:16 +0100 Subject: Mantis #5442: Add admin_save_heightmap --- .../RemoteController/RemoteAdminPlugin.cs | 56 ++++++++++++++++++++++ 1 file changed, 56 insertions(+) (limited to 'OpenSim') diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index dc4309f..5a011ce 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs @@ -130,6 +130,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController availableMethods["admin_broadcast"] = XmlRpcAlertMethod; availableMethods["admin_restart"] = XmlRpcRestartMethod; availableMethods["admin_load_heightmap"] = XmlRpcLoadHeightmapMethod; + availableMethods["admin_save_heightmap"] = XmlRpcSaveHeightmapMethod; // User management availableMethods["admin_create_user"] = XmlRpcCreateUserMethod; availableMethods["admin_create_user_email"] = XmlRpcCreateUserMethod; @@ -357,6 +358,61 @@ namespace OpenSim.ApplicationPlugins.RemoteController return response; } + public XmlRpcResponse XmlRpcSaveHeightmapMethod(XmlRpcRequest request, IPEndPoint remoteClient) + + { + XmlRpcResponse response = new XmlRpcResponse(); + Hashtable responseData = new Hashtable(); + + m_log.Info("[RADMIN]: Save height maps request started"); + + try + { + Hashtable requestData = (Hashtable)request.Params[0]; + + m_log.DebugFormat("[RADMIN]: Save Terrain: XmlRpc {0}", request.ToString()); + + CheckStringParameters(request, new string[] { "password", "filename", "regionid" }); + + if (m_requiredPassword != String.Empty && + (!requestData.Contains("password") || (string)requestData["password"] != m_requiredPassword)) + throw new Exception("wrong password"); + + string file = (string)requestData["filename"]; + UUID regionID = (UUID)(string)requestData["regionid"]; + m_log.InfoFormat("[RADMIN]: Terrain Saving: {0}", file); + + responseData["accepted"] = true; + + Scene region = null; + + if (!m_application.SceneManager.TryGetScene(regionID, out region)) + throw new Exception("1: unable to get a scene with that name"); + + ITerrainModule terrainModule = region.RequestModuleInterface(); + if (null == terrainModule) throw new Exception("terrain module not available"); + + terrainModule.SaveToFile(file); + + responseData["success"] = false; + + response.Value = responseData; + } + catch (Exception e) + { + m_log.ErrorFormat("[RADMIN]: Terrain Saving: failed: {0}", e.Message); + m_log.DebugFormat("[RADMIN]: Terrain Saving: failed: {0}", e.ToString()); + + responseData["success"] = false; + responseData["error"] = e.Message; + + } + + m_log.Info("[RADMIN]: Save height maps request complete"); + + return response; + } + public XmlRpcResponse XmlRpcShutdownMethod(XmlRpcRequest request, IPEndPoint remoteClient) { m_log.Info("[RADMIN]: Received Shutdown Administrator Request"); -- cgit v1.1