mirror of
https://github.com/opensim/opensim.git
synced 2026-08-08 18:25:33 +08:00
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
This commit is contained in:
@@ -47,7 +47,7 @@ namespace OpenSim.Region.CoreModules.Asset.Tests
|
||||
/// At the moment we're only test the in-memory part of the FlotsamAssetCache. This is a considerable weakness.
|
||||
/// </summary>
|
||||
[TestFixture]
|
||||
public class FlotsamAssetCacheTests
|
||||
public class FlotsamAssetCacheTests : OpenSimTestCase
|
||||
{
|
||||
protected TestScene m_scene;
|
||||
protected FlotsamAssetCache m_cache;
|
||||
|
||||
@@ -39,7 +39,7 @@ using OpenSim.Tests.Common.Mock;
|
||||
namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
||||
{
|
||||
[TestFixture]
|
||||
public class AvatarFactoryModuleTests
|
||||
public class AvatarFactoryModuleTests : OpenSimTestCase
|
||||
{
|
||||
/// <summary>
|
||||
/// Only partial right now since we don't yet test that it's ended up in the avatar appearance service.
|
||||
|
||||
@@ -40,7 +40,7 @@ using OpenSim.Tests.Common.Mock;
|
||||
namespace OpenSim.Region.CoreModules.Avatar.Friends.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class FriendsModuleTests
|
||||
public class FriendsModuleTests : OpenSimTestCase
|
||||
{
|
||||
private FriendsModule m_fm;
|
||||
private TestScene m_scene;
|
||||
|
||||
@@ -49,7 +49,7 @@ using OpenSim.Tests.Common.Mock;
|
||||
namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class InventoryAccessModuleTests
|
||||
public class InventoryAccessModuleTests : OpenSimTestCase
|
||||
{
|
||||
protected TestScene m_scene;
|
||||
protected BasicInventoryAccessModule m_iam;
|
||||
|
||||
@@ -0,0 +1,137 @@
|
||||
/*
|
||||
* 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 Mono.Addins;
|
||||
using Nini.Config;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Server.Base;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using PresenceInfo = OpenSim.Services.Interfaces.PresenceInfo;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence
|
||||
{
|
||||
public class BasePresenceServiceConnector : IPresenceService
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
protected bool m_Enabled;
|
||||
|
||||
protected PresenceDetector m_PresenceDetector;
|
||||
|
||||
/// <summary>
|
||||
/// Underlying presence service. Do not use directly.
|
||||
/// </summary>
|
||||
public IPresenceService m_PresenceService;
|
||||
|
||||
public Type ReplaceableInterface
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
public void AddRegion(Scene scene)
|
||||
{
|
||||
if (!m_Enabled)
|
||||
return;
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[LOCAL PRESENCE CONNECTOR]: Registering IPresenceService to scene {0}", scene.RegionInfo.RegionName);
|
||||
|
||||
scene.RegisterModuleInterface<IPresenceService>(this);
|
||||
m_PresenceDetector.AddRegion(scene);
|
||||
|
||||
m_log.InfoFormat("[BASE PRESENCE SERVICE CONNECTOR]: Enabled for region {0}", scene.Name);
|
||||
}
|
||||
|
||||
public void RemoveRegion(Scene scene)
|
||||
{
|
||||
if (!m_Enabled)
|
||||
return;
|
||||
|
||||
m_PresenceDetector.RemoveRegion(scene);
|
||||
}
|
||||
|
||||
public void RegionLoaded(Scene scene)
|
||||
{
|
||||
if (!m_Enabled)
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
public void PostInitialise()
|
||||
{
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
}
|
||||
|
||||
#region IPresenceService
|
||||
|
||||
public bool LoginAgent(string userID, UUID sessionID, UUID secureSessionID)
|
||||
{
|
||||
m_log.Warn("[BASE PRESENCE SERVICE CONNECTOR]: LoginAgent connector not implemented at the simulators");
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool LogoutAgent(UUID sessionID)
|
||||
{
|
||||
return m_PresenceService.LogoutAgent(sessionID);
|
||||
}
|
||||
|
||||
public bool LogoutRegionAgents(UUID regionID)
|
||||
{
|
||||
return m_PresenceService.LogoutRegionAgents(regionID);
|
||||
}
|
||||
|
||||
public bool ReportAgent(UUID sessionID, UUID regionID)
|
||||
{
|
||||
return m_PresenceService.ReportAgent(sessionID, regionID);
|
||||
}
|
||||
|
||||
public PresenceInfo GetAgent(UUID sessionID)
|
||||
{
|
||||
return m_PresenceService.GetAgent(sessionID);
|
||||
}
|
||||
|
||||
public PresenceInfo[] GetAgents(string[] userIDs)
|
||||
{
|
||||
// Don't bother potentially making a useless network call if we not going to ask for any users anyway.
|
||||
if (userIDs.Length == 0)
|
||||
return new PresenceInfo[0];
|
||||
|
||||
return m_PresenceService.GetAgents(userIDs);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -24,53 +24,29 @@
|
||||
* (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 Mono.Addins;
|
||||
using Nini.Config;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Server.Base;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using PresenceInfo = OpenSim.Services.Interfaces.PresenceInfo;
|
||||
|
||||
using OpenMetaverse;
|
||||
using log4net;
|
||||
using Mono.Addins;
|
||||
using Nini.Config;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence
|
||||
{
|
||||
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LocalPresenceServicesConnector")]
|
||||
public class LocalPresenceServicesConnector : ISharedRegionModule, IPresenceService
|
||||
public class LocalPresenceServicesConnector : BasePresenceServiceConnector, ISharedRegionModule, IPresenceService
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private bool m_Enabled = false;
|
||||
|
||||
private PresenceDetector m_PresenceDetector;
|
||||
|
||||
/// <summary>
|
||||
/// Underlying presence service. Do not use directly.
|
||||
/// </summary>
|
||||
public IPresenceService m_PresenceService;
|
||||
|
||||
public LocalPresenceServicesConnector()
|
||||
{
|
||||
}
|
||||
|
||||
public LocalPresenceServicesConnector(IConfigSource source)
|
||||
{
|
||||
Initialise(source);
|
||||
}
|
||||
|
||||
#region ISharedRegionModule
|
||||
|
||||
public Type ReplaceableInterface
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return "LocalPresenceServicesConnector"; }
|
||||
@@ -121,81 +97,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence
|
||||
}
|
||||
}
|
||||
|
||||
public void PostInitialise()
|
||||
{
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
}
|
||||
|
||||
public void AddRegion(Scene scene)
|
||||
{
|
||||
if (!m_Enabled)
|
||||
return;
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[LOCAL PRESENCE CONNECTOR]: Registering IPresenceService to scene {0}", scene.RegionInfo.RegionName);
|
||||
|
||||
scene.RegisterModuleInterface<IPresenceService>(this);
|
||||
m_PresenceDetector.AddRegion(scene);
|
||||
|
||||
m_log.InfoFormat("[LOCAL PRESENCE CONNECTOR]: Enabled local presence for region {0}", scene.RegionInfo.RegionName);
|
||||
|
||||
}
|
||||
|
||||
public void RemoveRegion(Scene scene)
|
||||
{
|
||||
if (!m_Enabled)
|
||||
return;
|
||||
|
||||
m_PresenceDetector.RemoveRegion(scene);
|
||||
}
|
||||
|
||||
public void RegionLoaded(Scene scene)
|
||||
{
|
||||
if (!m_Enabled)
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IPresenceService
|
||||
|
||||
public bool LoginAgent(string userID, UUID sessionID, UUID secureSessionID)
|
||||
{
|
||||
m_log.Warn("[LOCAL PRESENCE CONNECTOR]: LoginAgent connector not implemented at the simulators");
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool LogoutAgent(UUID sessionID)
|
||||
{
|
||||
return m_PresenceService.LogoutAgent(sessionID);
|
||||
}
|
||||
|
||||
|
||||
public bool LogoutRegionAgents(UUID regionID)
|
||||
{
|
||||
return m_PresenceService.LogoutRegionAgents(regionID);
|
||||
}
|
||||
|
||||
public bool ReportAgent(UUID sessionID, UUID regionID)
|
||||
{
|
||||
return m_PresenceService.ReportAgent(sessionID, regionID);
|
||||
}
|
||||
|
||||
public PresenceInfo GetAgent(UUID sessionID)
|
||||
{
|
||||
return m_PresenceService.GetAgent(sessionID);
|
||||
}
|
||||
|
||||
public PresenceInfo[] GetAgents(string[] userIDs)
|
||||
{
|
||||
return m_PresenceService.GetAgents(userIDs);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -43,22 +43,12 @@ using Nini.Config;
|
||||
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence
|
||||
{
|
||||
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "RemotePresenceServicesConnector")]
|
||||
public class RemotePresenceServicesConnector : ISharedRegionModule, IPresenceService
|
||||
public class RemotePresenceServicesConnector : BasePresenceServiceConnector, ISharedRegionModule
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
#region ISharedRegionModule
|
||||
|
||||
private bool m_Enabled = false;
|
||||
|
||||
private PresenceDetector m_PresenceDetector;
|
||||
private IPresenceService m_RemoteConnector;
|
||||
|
||||
public Type ReplaceableInterface
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return "RemotePresenceServicesConnector"; }
|
||||
@@ -72,7 +62,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence
|
||||
string name = moduleConfig.GetString("PresenceServices", "");
|
||||
if (name == Name)
|
||||
{
|
||||
m_RemoteConnector = new PresenceServicesConnector(source);
|
||||
m_PresenceService = new PresenceServicesConnector(source);
|
||||
|
||||
m_Enabled = true;
|
||||
|
||||
@@ -81,81 +71,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence
|
||||
m_log.Info("[REMOTE PRESENCE CONNECTOR]: Remote presence enabled");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void PostInitialise()
|
||||
{
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
}
|
||||
|
||||
public void AddRegion(Scene scene)
|
||||
{
|
||||
if (!m_Enabled)
|
||||
return;
|
||||
|
||||
scene.RegisterModuleInterface<IPresenceService>(this);
|
||||
m_PresenceDetector.AddRegion(scene);
|
||||
|
||||
m_log.InfoFormat("[REMOTE PRESENCE CONNECTOR]: Enabled remote presence for region {0}", scene.RegionInfo.RegionName);
|
||||
|
||||
}
|
||||
|
||||
public void RemoveRegion(Scene scene)
|
||||
{
|
||||
if (!m_Enabled)
|
||||
return;
|
||||
|
||||
m_PresenceDetector.RemoveRegion(scene);
|
||||
}
|
||||
|
||||
public void RegionLoaded(Scene scene)
|
||||
{
|
||||
if (!m_Enabled)
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IPresenceService
|
||||
|
||||
public bool LoginAgent(string userID, UUID sessionID, UUID secureSessionID)
|
||||
{
|
||||
m_log.Warn("[REMOTE PRESENCE CONNECTOR]: LoginAgent connector not implemented at the simulators");
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool LogoutAgent(UUID sessionID)
|
||||
{
|
||||
return m_RemoteConnector.LogoutAgent(sessionID);
|
||||
}
|
||||
|
||||
|
||||
public bool LogoutRegionAgents(UUID regionID)
|
||||
{
|
||||
return m_RemoteConnector.LogoutRegionAgents(regionID);
|
||||
}
|
||||
|
||||
public bool ReportAgent(UUID sessionID, UUID regionID)
|
||||
{
|
||||
return m_RemoteConnector.ReportAgent(sessionID, regionID);
|
||||
}
|
||||
|
||||
public PresenceInfo GetAgent(UUID sessionID)
|
||||
{
|
||||
return m_RemoteConnector.GetAgent(sessionID);
|
||||
}
|
||||
|
||||
public PresenceInfo[] GetAgents(string[] userIDs)
|
||||
{
|
||||
return m_RemoteConnector.GetAgents(userIDs);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -35,7 +35,6 @@ using NUnit.Framework;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using Nini.Config;
|
||||
|
||||
using OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using PresenceInfo = OpenSim.Services.Interfaces.PresenceInfo;
|
||||
@@ -44,7 +43,7 @@ using OpenSim.Tests.Common;
|
||||
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class PresenceConnectorsTests
|
||||
public class PresenceConnectorsTests : OpenSimTestCase
|
||||
{
|
||||
LocalPresenceServicesConnector m_LocalConnector;
|
||||
private void SetUp()
|
||||
@@ -56,7 +55,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence.Tests
|
||||
config.Configs["PresenceService"].Set("LocalServiceModule", "OpenSim.Services.PresenceService.dll:PresenceService");
|
||||
config.Configs["PresenceService"].Set("StorageProvider", "OpenSim.Data.Null.dll");
|
||||
|
||||
m_LocalConnector = new LocalPresenceServicesConnector(config);
|
||||
m_LocalConnector = new LocalPresenceServicesConnector();
|
||||
m_LocalConnector.Initialise(config);
|
||||
|
||||
// Let's stick in a test presence
|
||||
m_LocalConnector.m_PresenceService.LoginAgent(UUID.Zero.ToString(), UUID.Zero, UUID.Zero);
|
||||
|
||||
@@ -552,13 +552,22 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||
|
||||
// Validate User and Group UUID's
|
||||
|
||||
if (!ResolveUserUuid(scene, parcel.OwnerID))
|
||||
parcel.OwnerID = m_rootScene.RegionInfo.EstateSettings.EstateOwner;
|
||||
|
||||
if (!ResolveGroupUuid(parcel.GroupID))
|
||||
if (parcel.IsGroupOwned)
|
||||
{
|
||||
parcel.GroupID = UUID.Zero;
|
||||
parcel.IsGroupOwned = false;
|
||||
if (!ResolveGroupUuid(parcel.GroupID))
|
||||
{
|
||||
parcel.OwnerID = m_rootScene.RegionInfo.EstateSettings.EstateOwner;
|
||||
parcel.GroupID = UUID.Zero;
|
||||
parcel.IsGroupOwned = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!ResolveUserUuid(scene, parcel.OwnerID))
|
||||
parcel.OwnerID = m_rootScene.RegionInfo.EstateSettings.EstateOwner;
|
||||
|
||||
if (!ResolveGroupUuid(parcel.GroupID))
|
||||
parcel.GroupID = UUID.Zero;
|
||||
}
|
||||
|
||||
List<LandAccessEntry> accessList = new List<LandAccessEntry>();
|
||||
@@ -571,8 +580,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||
parcel.ParcelAccessList = accessList;
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[ARCHIVER]: Adding parcel {0}, local id {1}, area {2}",
|
||||
// parcel.Name, parcel.LocalID, parcel.Area);
|
||||
// "[ARCHIVER]: Adding parcel {0}, local id {1}, owner {2}, group {3}, isGroupOwned {4}, area {5}",
|
||||
// parcel.Name, parcel.LocalID, parcel.OwnerID, parcel.GroupID, parcel.IsGroupOwned, parcel.Area);
|
||||
|
||||
landData.Add(parcel);
|
||||
}
|
||||
|
||||
@@ -167,7 +167,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||
}
|
||||
scenesGroup.CalcSceneLocations();
|
||||
|
||||
|
||||
m_archiveWriter = new TarArchiveWriter(m_saveStream);
|
||||
|
||||
try
|
||||
@@ -216,7 +215,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void ArchiveOneRegion(Scene scene, string regionDir, Dictionary<UUID, AssetType> assetUuids)
|
||||
{
|
||||
m_log.InfoFormat("[ARCHIVER]: Writing region {0}", scene.RegionInfo.RegionName);
|
||||
@@ -540,7 +538,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||
xtw.WriteElementString("size_in_meters", string.Format("{0},{1}", size.X, size.Y));
|
||||
}
|
||||
|
||||
|
||||
protected void Save(Scene scene, List<SceneObjectGroup> sceneObjects, string regionDir)
|
||||
{
|
||||
if (regionDir != string.Empty)
|
||||
@@ -560,8 +557,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||
foreach (ILandObject lo in landObjects)
|
||||
{
|
||||
LandData landData = lo.LandData;
|
||||
string landDataPath = String.Format("{0}{1}{2}.xml",
|
||||
regionDir, ArchiveConstants.LANDDATA_PATH, landData.GlobalID.ToString());
|
||||
string landDataPath
|
||||
= String.Format("{0}{1}", regionDir, ArchiveConstants.CreateOarLandDataPath(landData));
|
||||
m_archiveWriter.WriteFile(landDataPath, LandDataSerializer.Serialize(landData, m_options));
|
||||
}
|
||||
|
||||
@@ -604,7 +601,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||
|
||||
CloseArchive(String.Empty);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Closes the archive and notifies that we're done.
|
||||
@@ -629,6 +625,5 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||
|
||||
m_rootScene.EventManager.TriggerOarFileSaved(m_requestId, errorMessage);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -31,16 +31,19 @@ using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using log4net.Config;
|
||||
using Nini.Config;
|
||||
using NUnit.Framework;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.Assets;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Serialization;
|
||||
using OpenSim.Framework.Serialization.External;
|
||||
using OpenSim.Region.CoreModules.World.Land;
|
||||
using OpenSim.Region.CoreModules.World.Serialiser;
|
||||
using OpenSim.Region.CoreModules.World.Terrain;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Region.Framework.Scenes.Serialization;
|
||||
using OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups;
|
||||
using OpenSim.Tests.Common;
|
||||
using OpenSim.Tests.Common.Mock;
|
||||
using ArchiveConstants = OpenSim.Framework.Serialization.ArchiveConstants;
|
||||
@@ -69,9 +72,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
|
||||
{
|
||||
base.SetUp();
|
||||
|
||||
// FIXME: Do something about this - relying on statics in unit tests causes trouble sooner or later
|
||||
new SceneManager();
|
||||
|
||||
m_archiverModule = new ArchiverModule();
|
||||
m_serialiserModule = new SerialiserModule();
|
||||
TerrainModule terrainModule = new TerrainModule();
|
||||
@@ -127,6 +127,53 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
|
||||
|
||||
return new SceneObjectPart(ownerId, shape, groupPosition, rotationOffset, offsetPosition) { Name = partName };
|
||||
}
|
||||
|
||||
private void CreateTestObjects(Scene scene, out SceneObjectGroup sog1, out SceneObjectGroup sog2, out UUID ncAssetUuid)
|
||||
{
|
||||
SceneObjectPart part1 = CreateSceneObjectPart1();
|
||||
sog1 = new SceneObjectGroup(part1);
|
||||
scene.AddNewSceneObject(sog1, false);
|
||||
|
||||
AssetNotecard nc = new AssetNotecard();
|
||||
nc.BodyText = "Hello World!";
|
||||
nc.Encode();
|
||||
ncAssetUuid = UUID.Random();
|
||||
UUID ncItemUuid = UUID.Random();
|
||||
AssetBase ncAsset
|
||||
= AssetHelpers.CreateAsset(ncAssetUuid, AssetType.Notecard, nc.AssetData, UUID.Zero);
|
||||
m_scene.AssetService.Store(ncAsset);
|
||||
|
||||
TaskInventoryItem ncItem
|
||||
= new TaskInventoryItem { Name = "ncItem", AssetID = ncAssetUuid, ItemID = ncItemUuid };
|
||||
SceneObjectPart part2 = CreateSceneObjectPart2();
|
||||
sog2 = new SceneObjectGroup(part2);
|
||||
part2.Inventory.AddInventoryItem(ncItem, true);
|
||||
|
||||
scene.AddNewSceneObject(sog2, false);
|
||||
}
|
||||
|
||||
private static void CreateSoundAsset(TarArchiveWriter tar, Assembly assembly, string soundDataResourceName, out byte[] soundData, out UUID soundUuid)
|
||||
{
|
||||
using (Stream resource = assembly.GetManifestResourceStream(soundDataResourceName))
|
||||
{
|
||||
using (BinaryReader br = new BinaryReader(resource))
|
||||
{
|
||||
// FIXME: Use the inspector instead
|
||||
soundData = br.ReadBytes(99999999);
|
||||
soundUuid = UUID.Parse("00000000-0000-0000-0000-000000000001");
|
||||
string soundAssetFileName
|
||||
= ArchiveConstants.ASSETS_PATH + soundUuid
|
||||
+ ArchiveConstants.ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.SoundWAV];
|
||||
tar.WriteFile(soundAssetFileName, soundData);
|
||||
|
||||
/*
|
||||
AssetBase soundAsset = AssetHelpers.CreateAsset(soundUuid, soundData);
|
||||
scene.AssetService.Store(soundAsset);
|
||||
asset1FileName = ArchiveConstants.ASSETS_PATH + soundUuid + ".wav";
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test saving an OpenSim Region Archive.
|
||||
@@ -204,30 +251,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
|
||||
// TODO: Test presence of more files and contents of files.
|
||||
}
|
||||
|
||||
private void CreateTestObjects(Scene scene, out SceneObjectGroup sog1, out SceneObjectGroup sog2, out UUID ncAssetUuid)
|
||||
{
|
||||
SceneObjectPart part1 = CreateSceneObjectPart1();
|
||||
sog1 = new SceneObjectGroup(part1);
|
||||
scene.AddNewSceneObject(sog1, false);
|
||||
|
||||
AssetNotecard nc = new AssetNotecard();
|
||||
nc.BodyText = "Hello World!";
|
||||
nc.Encode();
|
||||
ncAssetUuid = UUID.Random();
|
||||
UUID ncItemUuid = UUID.Random();
|
||||
AssetBase ncAsset
|
||||
= AssetHelpers.CreateAsset(ncAssetUuid, AssetType.Notecard, nc.AssetData, UUID.Zero);
|
||||
m_scene.AssetService.Store(ncAsset);
|
||||
|
||||
TaskInventoryItem ncItem
|
||||
= new TaskInventoryItem { Name = "ncItem", AssetID = ncAssetUuid, ItemID = ncItemUuid };
|
||||
SceneObjectPart part2 = CreateSceneObjectPart2();
|
||||
sog2 = new SceneObjectGroup(part2);
|
||||
part2.Inventory.AddInventoryItem(ncItem, true);
|
||||
|
||||
scene.AddNewSceneObject(sog2, false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test saving an OpenSim Region Archive with the no assets option
|
||||
/// </summary>
|
||||
@@ -308,59 +331,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
|
||||
// TODO: Test presence of more files and contents of files.
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test loading an OpenSim Region Archive where the scene object parts are not ordered by link number (e.g.
|
||||
/// 2 can come after 3).
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestLoadOarUnorderedParts()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
UUID ownerId = TestHelpers.ParseTail(0xaaaa);
|
||||
|
||||
MemoryStream archiveWriteStream = new MemoryStream();
|
||||
TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream);
|
||||
|
||||
tar.WriteFile(
|
||||
ArchiveConstants.CONTROL_FILE_PATH,
|
||||
new ArchiveWriteRequest(m_scene, (Stream)null, Guid.Empty).CreateControlFile(new ArchiveScenesGroup()));
|
||||
|
||||
SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, ownerId, "obj1-", 0x11);
|
||||
SceneObjectPart sop2
|
||||
= SceneHelpers.CreateSceneObjectPart("obj1-Part2", TestHelpers.ParseTail(0x12), ownerId);
|
||||
SceneObjectPart sop3
|
||||
= SceneHelpers.CreateSceneObjectPart("obj1-Part3", TestHelpers.ParseTail(0x13), ownerId);
|
||||
|
||||
// Add the parts so they will be written out in reverse order to the oar
|
||||
sog1.AddPart(sop3);
|
||||
sop3.LinkNum = 3;
|
||||
sog1.AddPart(sop2);
|
||||
sop2.LinkNum = 2;
|
||||
|
||||
tar.WriteFile(
|
||||
ArchiveConstants.CreateOarObjectPath(sog1.Name, sog1.UUID, sog1.AbsolutePosition),
|
||||
SceneObjectSerializer.ToXml2Format(sog1));
|
||||
|
||||
tar.Close();
|
||||
|
||||
MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray());
|
||||
|
||||
lock (this)
|
||||
{
|
||||
m_scene.EventManager.OnOarFileLoaded += LoadCompleted;
|
||||
m_archiverModule.DearchiveRegion(archiveReadStream);
|
||||
}
|
||||
|
||||
Assert.That(m_lastErrorMessage, Is.Null);
|
||||
|
||||
SceneObjectPart part2 = m_scene.GetSceneObjectPart("obj1-Part2");
|
||||
Assert.That(part2.LinkNum, Is.EqualTo(2));
|
||||
|
||||
SceneObjectPart part3 = m_scene.GetSceneObjectPart("obj1-Part3");
|
||||
Assert.That(part3.LinkNum, Is.EqualTo(3));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test loading an OpenSim Region Archive.
|
||||
/// </summary>
|
||||
@@ -435,50 +405,57 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
|
||||
TestLoadedRegion(part1, soundItemName, soundData);
|
||||
}
|
||||
|
||||
private static void CreateSoundAsset(TarArchiveWriter tar, Assembly assembly, string soundDataResourceName, out byte[] soundData, out UUID soundUuid)
|
||||
/// <summary>
|
||||
/// Test loading an OpenSim Region Archive where the scene object parts are not ordered by link number (e.g.
|
||||
/// 2 can come after 3).
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestLoadOarUnorderedParts()
|
||||
{
|
||||
using (Stream resource = assembly.GetManifestResourceStream(soundDataResourceName))
|
||||
TestHelpers.InMethod();
|
||||
|
||||
UUID ownerId = TestHelpers.ParseTail(0xaaaa);
|
||||
|
||||
MemoryStream archiveWriteStream = new MemoryStream();
|
||||
TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream);
|
||||
|
||||
tar.WriteFile(
|
||||
ArchiveConstants.CONTROL_FILE_PATH,
|
||||
new ArchiveWriteRequest(m_scene, (Stream)null, Guid.Empty).CreateControlFile(new ArchiveScenesGroup()));
|
||||
|
||||
SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, ownerId, "obj1-", 0x11);
|
||||
SceneObjectPart sop2
|
||||
= SceneHelpers.CreateSceneObjectPart("obj1-Part2", TestHelpers.ParseTail(0x12), ownerId);
|
||||
SceneObjectPart sop3
|
||||
= SceneHelpers.CreateSceneObjectPart("obj1-Part3", TestHelpers.ParseTail(0x13), ownerId);
|
||||
|
||||
// Add the parts so they will be written out in reverse order to the oar
|
||||
sog1.AddPart(sop3);
|
||||
sop3.LinkNum = 3;
|
||||
sog1.AddPart(sop2);
|
||||
sop2.LinkNum = 2;
|
||||
|
||||
tar.WriteFile(
|
||||
ArchiveConstants.CreateOarObjectPath(sog1.Name, sog1.UUID, sog1.AbsolutePosition),
|
||||
SceneObjectSerializer.ToXml2Format(sog1));
|
||||
|
||||
tar.Close();
|
||||
|
||||
MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray());
|
||||
|
||||
lock (this)
|
||||
{
|
||||
using (BinaryReader br = new BinaryReader(resource))
|
||||
{
|
||||
// FIXME: Use the inspector instead
|
||||
soundData = br.ReadBytes(99999999);
|
||||
soundUuid = UUID.Parse("00000000-0000-0000-0000-000000000001");
|
||||
string soundAssetFileName
|
||||
= ArchiveConstants.ASSETS_PATH + soundUuid
|
||||
+ ArchiveConstants.ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.SoundWAV];
|
||||
tar.WriteFile(soundAssetFileName, soundData);
|
||||
|
||||
/*
|
||||
AssetBase soundAsset = AssetHelpers.CreateAsset(soundUuid, soundData);
|
||||
scene.AssetService.Store(soundAsset);
|
||||
asset1FileName = ArchiveConstants.ASSETS_PATH + soundUuid + ".wav";
|
||||
*/
|
||||
}
|
||||
m_scene.EventManager.OnOarFileLoaded += LoadCompleted;
|
||||
m_archiverModule.DearchiveRegion(archiveReadStream);
|
||||
}
|
||||
}
|
||||
|
||||
private void TestLoadedRegion(SceneObjectPart part1, string soundItemName, byte[] soundData)
|
||||
{
|
||||
SceneObjectPart object1PartLoaded = m_scene.GetSceneObjectPart(part1.Name);
|
||||
Assert.That(m_lastErrorMessage, Is.Null);
|
||||
|
||||
Assert.That(object1PartLoaded, Is.Not.Null, "object1 was not loaded");
|
||||
Assert.That(object1PartLoaded.Name, Is.EqualTo(part1.Name), "object1 names not identical");
|
||||
Assert.That(object1PartLoaded.GroupPosition, Is.EqualTo(part1.GroupPosition), "object1 group position not equal");
|
||||
Assert.That(
|
||||
object1PartLoaded.RotationOffset, Is.EqualTo(part1.RotationOffset), "object1 rotation offset not equal");
|
||||
Assert.That(
|
||||
object1PartLoaded.OffsetPosition, Is.EqualTo(part1.OffsetPosition), "object1 offset position not equal");
|
||||
Assert.That(object1PartLoaded.SitTargetOrientation, Is.EqualTo(part1.SitTargetOrientation));
|
||||
Assert.That(object1PartLoaded.SitTargetPosition, Is.EqualTo(part1.SitTargetPosition));
|
||||
SceneObjectPart part2 = m_scene.GetSceneObjectPart("obj1-Part2");
|
||||
Assert.That(part2.LinkNum, Is.EqualTo(2));
|
||||
|
||||
TaskInventoryItem loadedSoundItem = object1PartLoaded.Inventory.GetInventoryItems(soundItemName)[0];
|
||||
Assert.That(loadedSoundItem, Is.Not.Null, "loaded sound item was null");
|
||||
AssetBase loadedSoundAsset = m_scene.AssetService.Get(loadedSoundItem.AssetID.ToString());
|
||||
Assert.That(loadedSoundAsset, Is.Not.Null, "loaded sound asset was null");
|
||||
Assert.That(loadedSoundAsset.Data, Is.EqualTo(soundData), "saved and loaded sound data do not match");
|
||||
|
||||
Assert.Greater(m_scene.LandChannel.AllParcels().Count, 0, "incorrect number of parcels");
|
||||
SceneObjectPart part3 = m_scene.GetSceneObjectPart("obj1-Part3");
|
||||
Assert.That(part3.LinkNum, Is.EqualTo(3));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -538,8 +515,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
|
||||
SerialiserModule serialiserModule = new SerialiserModule();
|
||||
TerrainModule terrainModule = new TerrainModule();
|
||||
|
||||
m_sceneHelpers = new SceneHelpers();
|
||||
TestScene scene2 = m_sceneHelpers.SetupScene();
|
||||
SceneHelpers m_sceneHelpers2 = new SceneHelpers();
|
||||
TestScene scene2 = m_sceneHelpers2.SetupScene();
|
||||
SceneHelpers.SetupSceneModules(scene2, archiverModule, serialiserModule, terrainModule);
|
||||
|
||||
// Make sure there's a valid owner for the owner we saved (this should have been wiped if the code is
|
||||
@@ -562,6 +539,71 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test OAR loading where the land parcel is group deeded.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// In this situation, the owner ID is set to the group ID.
|
||||
/// </remarks>
|
||||
[Test]
|
||||
public void TestLoadOarDeededLand()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// TestHelpers.EnableLogging();
|
||||
|
||||
UUID landID = TestHelpers.ParseTail(0x10);
|
||||
|
||||
MockGroupsServicesConnector groupsService = new MockGroupsServicesConnector();
|
||||
|
||||
IConfigSource configSource = new IniConfigSource();
|
||||
IConfig config = configSource.AddConfig("Groups");
|
||||
config.Set("Enabled", true);
|
||||
config.Set("Module", "GroupsModule");
|
||||
config.Set("DebugEnabled", true);
|
||||
SceneHelpers.SetupSceneModules(
|
||||
m_scene, configSource, new object[] { new GroupsModule(), groupsService, new LandManagementModule() });
|
||||
|
||||
// Create group in scene for loading
|
||||
// FIXME: For now we'll put up with the issue that we'll get a group ID that varies across tests.
|
||||
UUID groupID
|
||||
= groupsService.CreateGroup(UUID.Zero, "group1", "", true, UUID.Zero, 3, true, true, true, UUID.Zero);
|
||||
|
||||
// Construct OAR
|
||||
MemoryStream oarStream = new MemoryStream();
|
||||
TarArchiveWriter tar = new TarArchiveWriter(oarStream);
|
||||
|
||||
tar.WriteDir(ArchiveConstants.LANDDATA_PATH);
|
||||
tar.WriteFile(
|
||||
ArchiveConstants.CONTROL_FILE_PATH,
|
||||
new ArchiveWriteRequest(m_scene, (Stream)null, Guid.Empty).CreateControlFile(new ArchiveScenesGroup()));
|
||||
|
||||
LandObject lo = new LandObject(groupID, true, null);
|
||||
lo.SetLandBitmap(lo.BasicFullRegionLandBitmap());
|
||||
LandData ld = lo.LandData;
|
||||
ld.GlobalID = landID;
|
||||
|
||||
string ldPath = ArchiveConstants.CreateOarLandDataPath(ld);
|
||||
tar.WriteFile(ldPath, LandDataSerializer.Serialize(ld, null));
|
||||
tar.Close();
|
||||
|
||||
oarStream = new MemoryStream(oarStream.ToArray());
|
||||
|
||||
// Load OAR
|
||||
lock (this)
|
||||
{
|
||||
m_scene.EventManager.OnOarFileLoaded += LoadCompleted;
|
||||
m_archiverModule.DearchiveRegion(oarStream);
|
||||
}
|
||||
|
||||
ILandObject rLo = m_scene.LandChannel.GetLandObject(16, 16);
|
||||
LandData rLd = rLo.LandData;
|
||||
|
||||
Assert.That(rLd.GlobalID, Is.EqualTo(landID));
|
||||
Assert.That(rLd.OwnerID, Is.EqualTo(groupID));
|
||||
Assert.That(rLd.GroupID, Is.EqualTo(groupID));
|
||||
Assert.That(rLd.IsGroupOwned, Is.EqualTo(true));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test loading the region settings of an OpenSim Region Archive.
|
||||
/// </summary>
|
||||
@@ -781,9 +823,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Save OAR
|
||||
|
||||
MemoryStream archiveWriteStream = new MemoryStream();
|
||||
m_scene.EventManager.OnOarFileSaved += SaveCompleted;
|
||||
|
||||
@@ -800,7 +840,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
|
||||
|
||||
|
||||
// Check that the OAR contains the expected data
|
||||
|
||||
Assert.That(m_lastRequestId, Is.EqualTo(requestId));
|
||||
|
||||
byte[] archive = archiveWriteStream.ToArray();
|
||||
@@ -892,7 +931,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
|
||||
}
|
||||
|
||||
ArchiveScenesGroup scenesGroup = new ArchiveScenesGroup();
|
||||
SceneManager.Instance.ForEachScene(delegate(Scene scene)
|
||||
m_sceneHelpers.SceneManager.ForEachScene(delegate(Scene scene)
|
||||
{
|
||||
scenesGroup.AddScene(scene);
|
||||
});
|
||||
@@ -950,13 +989,13 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
|
||||
|
||||
// Delete the current objects, to test that they're loaded from the OAR and didn't
|
||||
// just remain in the scene.
|
||||
SceneManager.Instance.ForEachScene(delegate(Scene scene)
|
||||
m_sceneHelpers.SceneManager.ForEachScene(delegate(Scene scene)
|
||||
{
|
||||
scene.DeleteAllSceneObjects();
|
||||
});
|
||||
|
||||
// Create a "hole", to test that that the corresponding region isn't loaded from the OAR
|
||||
SceneManager.Instance.CloseScene(SceneManager.Instance.Scenes[1]);
|
||||
m_sceneHelpers.SceneManager.CloseScene(SceneManager.Instance.Scenes[1]);
|
||||
|
||||
|
||||
// Check thay the OAR file contains the expected data
|
||||
@@ -971,10 +1010,32 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
|
||||
|
||||
Assert.That(m_lastErrorMessage, Is.Null);
|
||||
|
||||
Assert.AreEqual(3, SceneManager.Instance.Scenes.Count);
|
||||
Assert.AreEqual(3, m_sceneHelpers.SceneManager.Scenes.Count);
|
||||
|
||||
TestLoadedRegion(part1, soundItemName, soundData);
|
||||
}
|
||||
|
||||
private void TestLoadedRegion(SceneObjectPart part1, string soundItemName, byte[] soundData)
|
||||
{
|
||||
SceneObjectPart object1PartLoaded = m_scene.GetSceneObjectPart(part1.Name);
|
||||
|
||||
Assert.That(object1PartLoaded, Is.Not.Null, "object1 was not loaded");
|
||||
Assert.That(object1PartLoaded.Name, Is.EqualTo(part1.Name), "object1 names not identical");
|
||||
Assert.That(object1PartLoaded.GroupPosition, Is.EqualTo(part1.GroupPosition), "object1 group position not equal");
|
||||
Assert.That(
|
||||
object1PartLoaded.RotationOffset, Is.EqualTo(part1.RotationOffset), "object1 rotation offset not equal");
|
||||
Assert.That(
|
||||
object1PartLoaded.OffsetPosition, Is.EqualTo(part1.OffsetPosition), "object1 offset position not equal");
|
||||
Assert.That(object1PartLoaded.SitTargetOrientation, Is.EqualTo(part1.SitTargetOrientation));
|
||||
Assert.That(object1PartLoaded.SitTargetPosition, Is.EqualTo(part1.SitTargetPosition));
|
||||
|
||||
TaskInventoryItem loadedSoundItem = object1PartLoaded.Inventory.GetInventoryItems(soundItemName)[0];
|
||||
Assert.That(loadedSoundItem, Is.Not.Null, "loaded sound item was null");
|
||||
AssetBase loadedSoundAsset = m_scene.AssetService.Get(loadedSoundItem.AssetID.ToString());
|
||||
Assert.That(loadedSoundAsset, Is.Not.Null, "loaded sound asset was null");
|
||||
Assert.That(loadedSoundAsset.Data, Is.EqualTo(soundData), "saved and loaded sound data do not match");
|
||||
|
||||
Assert.Greater(m_scene.LandChannel.AllParcels().Count, 0, "incorrect number of parcels");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -53,6 +53,11 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||
|
||||
protected EstateManagementCommands m_commands;
|
||||
|
||||
/// <summary>
|
||||
/// If false, region restart requests from the client are blocked even if they are otherwise legitimate.
|
||||
/// </summary>
|
||||
public bool AllowRegionRestartFromClient { get; set; }
|
||||
|
||||
private EstateTerrainXferHandler TerrainUploader;
|
||||
public TelehubManager m_Telehub;
|
||||
|
||||
@@ -60,6 +65,53 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||
public event ChangeDelegate OnEstateInfoChange;
|
||||
public event MessageDelegate OnEstateMessage;
|
||||
|
||||
#region Region Module interface
|
||||
|
||||
public string Name { get { return "EstateManagementModule"; } }
|
||||
|
||||
public Type ReplaceableInterface { get { return null; } }
|
||||
|
||||
public void Initialise(IConfigSource source)
|
||||
{
|
||||
AllowRegionRestartFromClient = true;
|
||||
|
||||
IConfig config = source.Configs["EstateManagement"];
|
||||
|
||||
if (config != null)
|
||||
AllowRegionRestartFromClient = config.GetBoolean("AllowRegionRestartFromClient", true);
|
||||
}
|
||||
|
||||
public void AddRegion(Scene scene)
|
||||
{
|
||||
Scene = scene;
|
||||
Scene.RegisterModuleInterface<IEstateModule>(this);
|
||||
Scene.EventManager.OnNewClient += EventManager_OnNewClient;
|
||||
Scene.EventManager.OnRequestChangeWaterHeight += changeWaterHeight;
|
||||
|
||||
m_Telehub = new TelehubManager(scene);
|
||||
|
||||
m_commands = new EstateManagementCommands(this);
|
||||
m_commands.Initialise();
|
||||
}
|
||||
|
||||
public void RemoveRegion(Scene scene) {}
|
||||
|
||||
public void RegionLoaded(Scene scene)
|
||||
{
|
||||
// Sets up the sun module based no the saved Estate and Region Settings
|
||||
// DO NOT REMOVE or the sun will stop working
|
||||
scene.TriggerEstateSunUpdate();
|
||||
|
||||
UserManager = scene.RequestModuleInterface<IUserManagement>();
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
m_commands.Close();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Packet Data Responders
|
||||
|
||||
private void sendDetailedEstateData(IClientAPI remote_client, UUID invoice)
|
||||
@@ -184,6 +236,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||
Scene.RegionInfo.RegionSettings.TerrainTexture4 = texture;
|
||||
break;
|
||||
}
|
||||
|
||||
Scene.RegionInfo.RegionSettings.Save();
|
||||
TriggerRegionInfoChange();
|
||||
sendRegionInfoPacketToAll();
|
||||
@@ -215,6 +268,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||
Scene.RegionInfo.RegionSettings.Elevation2NE = highValue;
|
||||
break;
|
||||
}
|
||||
|
||||
Scene.RegionInfo.RegionSettings.Save();
|
||||
TriggerRegionInfoChange();
|
||||
sendRegionHandshakeToAll();
|
||||
@@ -255,6 +309,12 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||
|
||||
private void handleEstateRestartSimRequest(IClientAPI remoteClient, int timeInSeconds)
|
||||
{
|
||||
if (!AllowRegionRestartFromClient)
|
||||
{
|
||||
remoteClient.SendAlertMessage("Region restart has been disabled on this simulator.");
|
||||
return;
|
||||
}
|
||||
|
||||
IRestartModule restartModule = Scene.RequestModuleInterface<IRestartModule>();
|
||||
if (restartModule != null)
|
||||
{
|
||||
@@ -271,6 +331,10 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||
}
|
||||
|
||||
restartModule.ScheduleRestart(UUID.Zero, "Region will restart in {0}", times.ToArray(), true);
|
||||
|
||||
m_log.InfoFormat(
|
||||
"User {0} requested restart of region {1} in {2} seconds",
|
||||
remoteClient.Name, Scene.Name, times.Count != 0 ? times[0] : 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -295,7 +359,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||
|
||||
if ((estateAccessType & 4) != 0) // User add
|
||||
{
|
||||
if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions())
|
||||
if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true))
|
||||
{
|
||||
if ((estateAccessType & 1) != 0) // All estates
|
||||
{
|
||||
@@ -325,9 +389,10 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ((estateAccessType & 8) != 0) // User remove
|
||||
{
|
||||
if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions())
|
||||
if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true))
|
||||
{
|
||||
if ((estateAccessType & 1) != 0) // All estates
|
||||
{
|
||||
@@ -356,9 +421,10 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||
remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions");
|
||||
}
|
||||
}
|
||||
|
||||
if ((estateAccessType & 16) != 0) // Group add
|
||||
{
|
||||
if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions())
|
||||
if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true))
|
||||
{
|
||||
if ((estateAccessType & 1) != 0) // All estates
|
||||
{
|
||||
@@ -387,9 +453,10 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||
remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions");
|
||||
}
|
||||
}
|
||||
|
||||
if ((estateAccessType & 32) != 0) // Group remove
|
||||
{
|
||||
if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions())
|
||||
if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true))
|
||||
{
|
||||
if ((estateAccessType & 1) != 0) // All estates
|
||||
{
|
||||
@@ -418,9 +485,10 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||
remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions");
|
||||
}
|
||||
}
|
||||
|
||||
if ((estateAccessType & 64) != 0) // Ban add
|
||||
{
|
||||
if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false) || Scene.Permissions.BypassPermissions())
|
||||
if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false))
|
||||
{
|
||||
EstateBan[] banlistcheck = Scene.RegionInfo.EstateSettings.EstateBans;
|
||||
|
||||
@@ -495,9 +563,10 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||
remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions");
|
||||
}
|
||||
}
|
||||
|
||||
if ((estateAccessType & 128) != 0) // Ban remove
|
||||
{
|
||||
if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false) || Scene.Permissions.BypassPermissions())
|
||||
if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false))
|
||||
{
|
||||
EstateBan[] banlistcheck = Scene.RegionInfo.EstateSettings.EstateBans;
|
||||
|
||||
@@ -550,9 +619,10 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||
remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions");
|
||||
}
|
||||
}
|
||||
|
||||
if ((estateAccessType & 256) != 0) // Manager add
|
||||
{
|
||||
if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions())
|
||||
if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true))
|
||||
{
|
||||
if ((estateAccessType & 1) != 0) // All estates
|
||||
{
|
||||
@@ -581,9 +651,10 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||
remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions");
|
||||
}
|
||||
}
|
||||
|
||||
if ((estateAccessType & 512) != 0) // Manager remove
|
||||
{
|
||||
if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions())
|
||||
if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true))
|
||||
{
|
||||
if ((estateAccessType & 1) != 0) // All estates
|
||||
{
|
||||
@@ -614,7 +685,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||
}
|
||||
}
|
||||
|
||||
public void handleOnEstateManageTelehub (IClientAPI client, UUID invoice, UUID senderID, string cmd, uint param1)
|
||||
public void handleOnEstateManageTelehub(IClientAPI client, UUID invoice, UUID senderID, string cmd, uint param1)
|
||||
{
|
||||
SceneObjectPart part;
|
||||
|
||||
@@ -1072,45 +1143,6 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||
|
||||
#endregion
|
||||
|
||||
#region Region Module interface
|
||||
|
||||
public string Name { get { return "EstateManagementModule"; } }
|
||||
|
||||
public Type ReplaceableInterface { get { return null; } }
|
||||
|
||||
public void Initialise(IConfigSource source) {}
|
||||
|
||||
public void AddRegion(Scene scene)
|
||||
{
|
||||
Scene = scene;
|
||||
Scene.RegisterModuleInterface<IEstateModule>(this);
|
||||
Scene.EventManager.OnNewClient += EventManager_OnNewClient;
|
||||
Scene.EventManager.OnRequestChangeWaterHeight += changeWaterHeight;
|
||||
|
||||
m_Telehub = new TelehubManager(scene);
|
||||
|
||||
m_commands = new EstateManagementCommands(this);
|
||||
m_commands.Initialise();
|
||||
}
|
||||
|
||||
public void RemoveRegion(Scene scene) {}
|
||||
|
||||
public void RegionLoaded(Scene scene)
|
||||
{
|
||||
// Sets up the sun module based no the saved Estate and Region Settings
|
||||
// DO NOT REMOVE or the sun will stop working
|
||||
scene.TriggerEstateSunUpdate();
|
||||
|
||||
UserManager = scene.RequestModuleInterface<IUserManagement>();
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
m_commands.Close();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Other Functions
|
||||
|
||||
public void changeWaterHeight(float height)
|
||||
|
||||
@@ -1378,10 +1378,11 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||
|
||||
public void EventManagerOnIncomingLandDataFromStorage(List<LandData> data)
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[LAND MANAGMENT MODULE]: Processing {0} incoming parcels on {1}", data.Count, m_scene.Name);
|
||||
|
||||
for (int i = 0; i < data.Count; i++)
|
||||
{
|
||||
IncomingLandObjectFromStorage(data[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public void IncomingLandObjectFromStorage(LandData data)
|
||||
|
||||
@@ -727,9 +727,10 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||
int ty = min_y * 4;
|
||||
if (ty > ((int)Constants.RegionSize - 1))
|
||||
ty = ((int)Constants.RegionSize - 1);
|
||||
|
||||
LandData.AABBMin =
|
||||
new Vector3((float) (min_x * 4), (float) (min_y * 4),
|
||||
(float) m_scene.Heightmap[tx, ty]);
|
||||
new Vector3(
|
||||
(float)(min_x * 4), (float)(min_y * 4), m_scene != null ? (float)m_scene.Heightmap[tx, ty] : 0);
|
||||
|
||||
tx = max_x * 4;
|
||||
if (tx > ((int)Constants.RegionSize - 1))
|
||||
@@ -737,9 +738,11 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||
ty = max_y * 4;
|
||||
if (ty > ((int)Constants.RegionSize - 1))
|
||||
ty = ((int)Constants.RegionSize - 1);
|
||||
LandData.AABBMax =
|
||||
new Vector3((float) (max_x * 4), (float) (max_y * 4),
|
||||
(float) m_scene.Heightmap[tx, ty]);
|
||||
|
||||
LandData.AABBMax
|
||||
= new Vector3(
|
||||
(float)(max_x * 4), (float)(max_y * 4), m_scene != null ? (float)m_scene.Heightmap[tx, ty] : 0);
|
||||
|
||||
LandData.Area = tempArea;
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ using OpenSim.Tests.Common.Mock;
|
||||
namespace OpenSim.Region.CoreModules.World.Land.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class PrimCountModuleTests
|
||||
public class PrimCountModuleTests : OpenSimTestCase
|
||||
{
|
||||
protected UUID m_userId = new UUID("00000000-0000-0000-0000-100000000000");
|
||||
protected UUID m_groupId = new UUID("00000000-0000-0000-8888-000000000000");
|
||||
|
||||
@@ -44,7 +44,7 @@ using OpenSim.Tests.Common.Mock;
|
||||
namespace OpenSim.Region.CoreModules.World.Media.Moap.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class MoapTests
|
||||
public class MoapTests : OpenSimTestCase
|
||||
{
|
||||
protected TestScene m_scene;
|
||||
protected MoapModule m_module;
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Timers;
|
||||
using System.Threading;
|
||||
@@ -264,7 +265,10 @@ namespace OpenSim.Region.CoreModules.World.Region
|
||||
for (int i = 4 ; i < args.Length ; i++)
|
||||
times.Add(Convert.ToInt32(args[i]));
|
||||
|
||||
MainConsole.Instance.OutputFormat(
|
||||
"Region {0} scheduled for restart in {1} seconds", m_Scene.Name, times.Sum());
|
||||
|
||||
ScheduleRestart(UUID.Zero, args[3], times.ToArray(), notice);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -39,7 +39,7 @@ using OpenSim.Tests.Common;
|
||||
namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class SerialiserTests
|
||||
public class SerialiserTests : OpenSimTestCase
|
||||
{
|
||||
private string xml = @"
|
||||
<SceneObjectGroup>
|
||||
|
||||
@@ -43,8 +43,8 @@ namespace OpenSim.Region.CoreModules.World.Sound
|
||||
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "SoundModule")]
|
||||
public class SoundModule : INonSharedRegionModule, ISoundModule
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(
|
||||
MethodBase.GetCurrentMethod().DeclaringType);
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(
|
||||
// MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private Scene m_scene;
|
||||
|
||||
|
||||
@@ -30,11 +30,12 @@ using NUnit.Framework;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.CoreModules.World.Terrain.PaintBrushes;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Tests.Common;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.World.Terrain.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class TerrainTest
|
||||
public class TerrainTest : OpenSimTestCase
|
||||
{
|
||||
[Test]
|
||||
public void BrushTest()
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace OpenSim.Region.CoreModules
|
||||
public void Initialise(IConfigSource config)
|
||||
{
|
||||
m_windConfig = config.Configs["Wind"];
|
||||
string desiredWindPlugin = m_dWindPluginName;
|
||||
// string desiredWindPlugin = m_dWindPluginName;
|
||||
|
||||
if (m_windConfig != null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user