From 5e4d6cab00cb29cd088ab7b62ab13aff103b64cb Mon Sep 17 00:00:00 2001 From: onefang Date: Sun, 19 May 2019 21:24:15 +1000 Subject: Dump OpenSim 0.9.0.1 into it's own branch. --- OpenSim/Tests/Common/Helpers/AssetHelpers.cs | 32 +++++----- .../Common/Helpers/BaseRequestHandlerHelpers.cs | 2 +- OpenSim/Tests/Common/Helpers/ClientStackHelpers.cs | 6 +- .../Tests/Common/Helpers/EntityTransferHelpers.cs | 12 ++-- OpenSim/Tests/Common/Helpers/SceneHelpers.cs | 74 ++++++++++++---------- .../Tests/Common/Helpers/TaskInventoryHelpers.cs | 12 ++-- OpenSim/Tests/Common/Helpers/UserAccountHelpers.cs | 4 +- .../Tests/Common/Helpers/UserInventoryHelpers.cs | 20 +++--- 8 files changed, 85 insertions(+), 77 deletions(-) (limited to 'OpenSim/Tests/Common/Helpers') diff --git a/OpenSim/Tests/Common/Helpers/AssetHelpers.cs b/OpenSim/Tests/Common/Helpers/AssetHelpers.cs index 7af8bed..974da4c 100644 --- a/OpenSim/Tests/Common/Helpers/AssetHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/AssetHelpers.cs @@ -66,7 +66,7 @@ namespace OpenSim.Tests.Common { return CreateAsset(assetId, AssetType.Notecard, text, UUID.Random()); } - + // /// // /// Create and store a notecard asset with a random uuid and dummy text. // /// @@ -92,7 +92,7 @@ namespace OpenSim.Tests.Common { return CreateAsset(new UUID(string.Format("00000000-0000-0000-0000-{0:X12}", assetUuidTail)), sog); } - + /// /// Create an asset from the given object. /// @@ -102,12 +102,12 @@ namespace OpenSim.Tests.Common public static AssetBase CreateAsset(UUID assetUuid, SceneObjectGroup sog) { return CreateAsset( - assetUuid, - AssetType.Object, - Encoding.ASCII.GetBytes(SceneObjectSerializer.ToOriginalXmlFormat(sog)), + assetUuid, + AssetType.Object, + Encoding.ASCII.GetBytes(SceneObjectSerializer.ToOriginalXmlFormat(sog)), sog.OwnerID); } - + /// /// Create an asset from the given scene object. /// @@ -120,8 +120,8 @@ namespace OpenSim.Tests.Common 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. /// @@ -131,12 +131,12 @@ namespace OpenSim.Tests.Common public static AssetBase CreateAsset(UUID assetUuid, CoalescedSceneObjects coa) { return CreateAsset( - assetUuid, - AssetType.Object, - Encoding.ASCII.GetBytes(CoalescedSceneObjectsSerializer.ToXml(coa)), + assetUuid, + AssetType.Object, + Encoding.ASCII.GetBytes(CoalescedSceneObjectsSerializer.ToXml(coa)), coa.CreatorId); - } - + } + /// /// Create an asset from the given data. /// @@ -148,7 +148,7 @@ namespace OpenSim.Tests.Common return CreateAsset(assetUuid, assetType, anc.AssetData, creatorID); } - + /// /// Create an asset from the given data. /// @@ -158,9 +158,9 @@ 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/Helpers/BaseRequestHandlerHelpers.cs b/OpenSim/Tests/Common/Helpers/BaseRequestHandlerHelpers.cs index 82ecf9a..b27c719 100644 --- a/OpenSim/Tests/Common/Helpers/BaseRequestHandlerHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/BaseRequestHandlerHelpers.cs @@ -59,7 +59,7 @@ namespace OpenSim.Tests.Common Assert.AreEqual(m_emptyStringArray, handler.SplitParams(null), "Failed on null."); Assert.AreEqual(m_emptyStringArray, handler.SplitParams(""), "Failed on empty path."); Assert.AreEqual(m_emptyStringArray, handler.SplitParams("corruptUrl"), "Failed on corrupt url."); - + Assert.AreEqual(m_emptyStringArray, handler.SplitParams(assetsPath), "Failed on empty params."); Assert.AreEqual(m_emptyStringArray, handler.SplitParams(assetsPath + "/"), "Failed on single slash."); diff --git a/OpenSim/Tests/Common/Helpers/ClientStackHelpers.cs b/OpenSim/Tests/Common/Helpers/ClientStackHelpers.cs index 33cd8a2..753830f 100644 --- a/OpenSim/Tests/Common/Helpers/ClientStackHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/ClientStackHelpers.cs @@ -48,7 +48,7 @@ namespace OpenSim.Tests.Common { public static ScenePresence AddChildClient( Scene scene, LLUDPServer udpServer, UUID agentId, UUID sessionId, uint circuitCode) - { + { IPEndPoint testEp = new IPEndPoint(IPAddress.Loopback, 999); UseCircuitCodePacket uccp = new UseCircuitCodePacket(); @@ -86,10 +86,10 @@ namespace OpenSim.Tests.Common uint port = 0; AgentCircuitManager acm = scene.AuthenticateHandler; - TestLLUDPServer udpServer = new TestLLUDPServer(IPAddress.Any, ref port, 0, false, configSource, acm); + TestLLUDPServer udpServer = new TestLLUDPServer(IPAddress.Any, ref port, 0, configSource, acm); udpServer.AddScene(scene); return udpServer; } } -} \ No newline at end of file +} diff --git a/OpenSim/Tests/Common/Helpers/EntityTransferHelpers.cs b/OpenSim/Tests/Common/Helpers/EntityTransferHelpers.cs index b215f1e..b0c9596 100644 --- a/OpenSim/Tests/Common/Helpers/EntityTransferHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/EntityTransferHelpers.cs @@ -56,7 +56,7 @@ namespace OpenSim.Tests.Common /// /// /// - /// A list that will be populated with any TestClients set up in response to + /// A list that will be populated with any TestClients set up in response to /// being informed about a destination region. /// public static void SetupInformClientOfNeighbourTriggersNeighbourClientCreate( @@ -71,7 +71,7 @@ namespace OpenSim.Tests.Common Util.RegionHandleToRegionLoc(neighbourHandle, out x, out y); m_log.DebugFormat( - "[TEST CLIENT]: Processing inform client of neighbour located at {0},{1} at {2}", + "[TEST CLIENT]: Processing inform client of neighbour located at {0},{1} at {2}", x, y, neighbourExternalEndPoint); AgentCircuitData newAgent = tc.RequestClientInfo(); @@ -91,20 +91,20 @@ namespace OpenSim.Tests.Common /// /// /// - /// A list that will be populated with any TestClients set up in response to + /// A list that will be populated with any TestClients set up in response to /// being informed about a destination region. /// public static void SetupSendRegionTeleportTriggersDestinationClientCreateAndCompleteMovement( TestClient client, List destinationClients) { - client.OnTestClientSendRegionTeleport + client.OnTestClientSendRegionTeleport += (regionHandle, simAccess, regionExternalEndPoint, locationID, flags, capsURL) => { uint x, y; Util.RegionHandleToRegionLoc(regionHandle, out x, out y); m_log.DebugFormat( - "[TEST CLIENT]: Processing send region teleport for destination at {0},{1} at {2}", + "[TEST CLIENT]: Processing send region teleport for destination at {0},{1} at {2}", x, y, regionExternalEndPoint); AgentCircuitData newAgent = client.RequestClientInfo(); @@ -120,4 +120,4 @@ namespace OpenSim.Tests.Common }; } } -} \ No newline at end of file +} diff --git a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs index df8b14c..7902fb1 100644 --- a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs @@ -102,7 +102,7 @@ namespace OpenSim.Tests.Common m_physicsScene = StartPhysicsScene(); - SimDataService + SimDataService = OpenSim.Server.Base.ServerUtils.LoadPlugin("OpenSim.Tests.Common.dll", null); } @@ -146,7 +146,7 @@ namespace OpenSim.Tests.Common // We must set up a console otherwise setup of some modules may fail MainConsole.Instance = new MockConsole(); - + RegionInfo regInfo = new RegionInfo(x, y, new IPEndPoint(IPAddress.Loopback, 9000), "127.0.0.1"); regInfo.RegionName = name; regInfo.RegionID = id; @@ -156,6 +156,9 @@ namespace OpenSim.Tests.Common TestScene testScene = new TestScene( regInfo, m_acm, SimDataService, m_estateDataService, configSource, null); + testScene.RegionInfo.EstateSettings = new EstateSettings(); + testScene.RegionInfo.EstateSettings.EstateOwner = UUID.Random(); + INonSharedRegionModule godsModule = new GodsModule(); godsModule.Initialise(new IniConfigSource()); godsModule.AddRegion(testScene); @@ -196,14 +199,13 @@ namespace OpenSim.Tests.Common m_presenceService.AddRegion(testScene); m_presenceService.RegionLoaded(testScene); testScene.AddRegionModule(m_presenceService.Name, m_presenceService); - - testScene.RegionInfo.EstateSettings.EstateOwner = UUID.Random(); + + testScene.SetModuleInterfaces(); testScene.LandChannel = new TestLandChannel(testScene); - testScene.LoadWorldMap(); + testScene.LoadWorldMap(); - testScene.RegionInfo.EstateSettings = new EstateSettings(); testScene.LoginsEnabled = true; testScene.RegisterRegionWithGrid(); @@ -215,10 +217,10 @@ namespace OpenSim.Tests.Common private static LocalAssetServicesConnector StartAssetService(CoreAssetCache cache) { 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"); - config.Configs["AssetService"].Set("LocalServiceModule", "OpenSim.Services.AssetService.dll:AssetService"); + config.Configs["AssetService"].Set("LocalServiceModule", "OpenSim.Services.AssetService.dll:AssetService"); config.Configs["AssetService"].Set("StorageProvider", "OpenSim.Tests.Common.dll"); LocalAssetServicesConnector assetService = new LocalAssetServicesConnector(); @@ -233,7 +235,7 @@ namespace OpenSim.Tests.Common cache.Initialise(cacheConfig); } - + return assetService; } @@ -255,7 +257,7 @@ namespace OpenSim.Tests.Common private static LocalInventoryServicesConnector StartInventoryService() { - IConfigSource config = new IniConfigSource(); + IConfigSource config = new IniConfigSource(); config.AddConfig("Modules"); config.AddConfig("InventoryService"); config.Configs["Modules"].Set("InventoryServices", "LocalInventoryServicesConnector"); @@ -264,8 +266,8 @@ namespace OpenSim.Tests.Common LocalInventoryServicesConnector inventoryService = new LocalInventoryServicesConnector(); inventoryService.Initialise(config); - - return inventoryService; + + return inventoryService; } private static LocalGridServicesConnector StartGridService() @@ -280,7 +282,7 @@ namespace OpenSim.Tests.Common LocalGridServicesConnector gridService = new LocalGridServicesConnector(); gridService.Initialise(config); - + return gridService; } @@ -301,7 +303,7 @@ namespace OpenSim.Tests.Common LocalUserAccountServicesConnector userAccountService = new LocalUserAccountServicesConnector(); userAccountService.Initialise(config); - + return userAccountService; } @@ -326,7 +328,7 @@ namespace OpenSim.Tests.Common LocalPresenceServicesConnector presenceService = new LocalPresenceServicesConnector(); presenceService.Initialise(config); - + return presenceService; } @@ -382,8 +384,8 @@ namespace OpenSim.Tests.Common /// /// /// If called directly, then all the modules must be shared modules. - /// - /// We are emulating here the normal calls made to setup region modules + /// + /// We are emulating here the normal calls made to setup region modules /// (Initialise(), PostInitialise(), AddRegion, RegionLoaded()). /// TODO: Need to reuse normal runtime module code. /// @@ -606,7 +608,7 @@ namespace OpenSim.Tests.Common /// public static SceneObjectGroup AddSceneObject(Scene scene) { - return AddSceneObject(scene, "Test Object", UUID.Zero); + return AddSceneObject(scene, "Test Object", UUID.Random()); } /// @@ -624,6 +626,7 @@ namespace OpenSim.Tests.Common //part.ObjectFlags |= (uint)PrimFlags.Phantom; scene.AddNewSceneObject(so, true); + so.InvalidateDeepEffectivePerms(); return so; } @@ -650,10 +653,11 @@ namespace OpenSim.Tests.Common SceneObjectGroup so = CreateSceneObject(parts, ownerId, partNamePrefix, uuidTail); scene.AddNewSceneObject(so, false); + so.InvalidateDeepEffectivePerms(); return so; } - + /// /// Create a scene object part. /// @@ -662,10 +666,10 @@ namespace OpenSim.Tests.Common /// /// 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, Scale = new Vector3(1, 1, 1) }; + ownerId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) + { Name = name, UUID = id, Scale = new Vector3(1, 1, 1) }; } /// @@ -680,10 +684,10 @@ namespace OpenSim.Tests.Common /// /// public static SceneObjectGroup CreateSceneObject(int parts, UUID ownerId) - { + { return CreateSceneObject(parts, ownerId, 0x1); } - + /// /// Create a scene object but do not add it to the scene. /// @@ -695,10 +699,10 @@ namespace OpenSim.Tests.Common /// /// public static SceneObjectGroup CreateSceneObject(int parts, UUID ownerId, int uuidTail) - { + { return CreateSceneObject(parts, ownerId, "", uuidTail); - } - + } + /// /// Create a scene object but do not add it to the scene. /// @@ -716,22 +720,22 @@ namespace OpenSim.Tests.Common /// /// public static SceneObjectGroup CreateSceneObject(int parts, UUID ownerId, string partNamePrefix, int uuidTail) - { + { string rawSogId = string.Format("00000000-0000-0000-0000-{0:X12}", uuidTail); - - SceneObjectGroup sog + + SceneObjectGroup sog = new SceneObjectGroup( CreateSceneObjectPart(string.Format("{0}Part1", partNamePrefix), new UUID(rawSogId), ownerId)); - + if (parts > 1) for (int i = 2; i <= parts; i++) sog.AddPart( CreateSceneObjectPart( - string.Format("{0}Part{1}", partNamePrefix, i), + string.Format("{0}Part{1}", partNamePrefix, i), new UUID(string.Format("00000000-0000-0000-0000-{0:X12}", uuidTail + i - 1)), ownerId)); - + return sog; - } + } } } diff --git a/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs b/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs index 3a3b33a..e3110f6 100644 --- a/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs @@ -78,12 +78,12 @@ namespace OpenSim.Tests.Common = AssetHelpers.CreateAsset(assetID, AssetType.Notecard, nc.AssetData, UUID.Zero); assetService.Store(ncAsset); - TaskInventoryItem ncItem - = new TaskInventoryItem + TaskInventoryItem ncItem + = new TaskInventoryItem { Name = itemName, AssetID = assetID, ItemID = itemID, Type = (int)AssetType.Notecard, InvType = (int)InventoryType.Notecard }; - part.Inventory.AddInventoryItem(ncItem, true); - + part.Inventory.AddInventoryItem(ncItem, true); + return ncItem; } @@ -119,7 +119,7 @@ namespace OpenSim.Tests.Common { return AddScript(assetService, part, UUID.Random(), UUID.Random(), scriptName, scriptSource); } - + /// /// Add a simple script to the given part. /// @@ -145,7 +145,7 @@ namespace OpenSim.Tests.Common = AssetHelpers.CreateAsset(assetId, AssetType.LSLText, ast.AssetData, UUID.Zero); assetService.Store(asset); TaskInventoryItem item - = new TaskInventoryItem + = new TaskInventoryItem { Name = scriptName, AssetID = assetId, ItemID = itemId, Type = (int)AssetType.LSLText, InvType = (int)InventoryType.LSL }; part.Inventory.AddInventoryItem(item, true); diff --git a/OpenSim/Tests/Common/Helpers/UserAccountHelpers.cs b/OpenSim/Tests/Common/Helpers/UserAccountHelpers.cs index c62b58e..e6af34b 100644 --- a/OpenSim/Tests/Common/Helpers/UserAccountHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/UserAccountHelpers.cs @@ -83,7 +83,7 @@ namespace OpenSim.Tests.Common // /// // /// // public static CachedUserInfo CreateUserWithInventory( -// CommunicationsManager commsManager, string firstName, string lastName, +// CommunicationsManager commsManager, string firstName, string lastName, // UUID userId, OnInventoryReceivedDelegate callback) // { // return CreateUserWithInventory(commsManager, firstName, lastName, "troll", userId, callback); @@ -147,7 +147,7 @@ namespace OpenSim.Tests.Common CreateUserWithInventory(scene, ua, pw); return ua; } - + public static void CreateUserWithInventory(Scene scene, UserAccount ua, string pw) { // FIXME: This should really be set up by UserAccount itself diff --git a/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs b/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs index 5a36332..e188665 100644 --- a/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs @@ -101,7 +101,7 @@ namespace OpenSim.Tests.Common Scene scene, string itemName, UUID itemId, InventoryType itemType, AssetBase asset, UUID userId) { return AddInventoryItem( - scene, itemName, itemId, itemType, asset, userId, + scene, itemName, itemId, itemType, asset, userId, scene.InventoryService.GetFolderForType(userId, (FolderType)asset.Type).Name); } @@ -128,6 +128,10 @@ namespace OpenSim.Tests.Common item.Owner = userId; item.AssetType = asset.Type; item.InvType = (int)itemType; + item.BasePermissions = (uint)OpenMetaverse.PermissionMask.All | + (uint)(Framework.PermissionMask.FoldedMask | Framework.PermissionMask.FoldedCopy | Framework.PermissionMask.FoldedModify | Framework.PermissionMask.FoldedTransfer); + item.CurrentPermissions = (uint)OpenMetaverse.PermissionMask.All | + (uint)(Framework.PermissionMask.FoldedMask | Framework.PermissionMask.FoldedCopy | Framework.PermissionMask.FoldedModify | Framework.PermissionMask.FoldedTransfer); InventoryFolderBase folder = InventoryArchiveUtils.FindFoldersByPath(scene.InventoryService, userId, path)[0]; @@ -207,7 +211,7 @@ namespace OpenSim.Tests.Common /// /// /// If true, then folders in the path which already the same name are - /// used. This applies to the terminal folder as well. + /// used. This applies to the terminal folder as well. /// If false, then all folders in the path are created, even if there is already a folder at a particular /// level with the same name. /// @@ -232,7 +236,7 @@ namespace OpenSim.Tests.Common /// /// /// If true, then folders in the path which already the same name are - /// used. This applies to the terminal folder as well. + /// used. This applies to the terminal folder as well. /// If false, then all folders in the path are created, even if there is already a folder at a particular /// level with the same name. /// @@ -255,7 +259,7 @@ namespace OpenSim.Tests.Common /// Create inventory folders starting from a given parent folder /// /// - /// If any stem of the path names folders that already exist then these are not recreated. This includes the + /// If any stem of the path names folders that already exist then these are not recreated. This includes the /// final folder. /// TODO: May need to make it an option to create duplicate folders. /// @@ -267,7 +271,7 @@ namespace OpenSim.Tests.Common /// /// /// If true, then folders in the path which already the same name are - /// used. This applies to the terminal folder as well. + /// used. This applies to the terminal folder as well. /// If false, then all folders in the path are created, even if there is already a folder at a particular /// level with the same name. /// @@ -295,10 +299,10 @@ namespace OpenSim.Tests.Common else folderIdForCreate = folderId; - folder + folder = new InventoryFolderBase( folderIdForCreate, components[0], parentFolder.Owner, (short)AssetType.Unknown, parentFolder.ID, 0); - + inventoryService.AddFolder(folder); } // else @@ -367,4 +371,4 @@ namespace OpenSim.Tests.Common return InventoryArchiveUtils.FindItemsByPath(inventoryService, userId, path); } } -} \ No newline at end of file +} -- cgit v1.1