mirror of
https://github.com/opensim/opensim.git
synced 2026-08-09 02:36:00 +08:00
Merge branch 'master' into careminster
Conflicts: OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
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;
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -570,13 +570,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>();
|
||||
@@ -589,8 +598,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");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -55,6 +55,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;
|
||||
|
||||
@@ -64,6 +69,53 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||
|
||||
private int m_delayCount = 0;
|
||||
|
||||
#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 clientSendDetailedEstateData(IClientAPI remote_client, UUID invoice)
|
||||
@@ -197,6 +249,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||
Scene.RegionInfo.RegionSettings.TerrainTexture4 = texture;
|
||||
break;
|
||||
}
|
||||
|
||||
Scene.RegionInfo.RegionSettings.Save();
|
||||
TriggerRegionInfoChange();
|
||||
sendRegionInfoPacketToAll();
|
||||
@@ -228,6 +281,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||
Scene.RegionInfo.RegionSettings.Elevation2NE = highValue;
|
||||
break;
|
||||
}
|
||||
|
||||
Scene.RegionInfo.RegionSettings.Save();
|
||||
TriggerRegionInfoChange();
|
||||
sendRegionHandshakeToAll();
|
||||
@@ -268,6 +322,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)
|
||||
{
|
||||
@@ -352,6 +412,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ((estateAccessType & 8) != 0) // User remove
|
||||
{
|
||||
if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true))
|
||||
@@ -383,6 +444,7 @@ 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))
|
||||
@@ -650,7 +712,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;
|
||||
|
||||
@@ -1118,49 +1180,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)
|
||||
{
|
||||
m_regionChangeTimer.AutoReset = false;
|
||||
m_regionChangeTimer.Interval = 2000;
|
||||
m_regionChangeTimer.Elapsed += RaiseRegionInfoChange;
|
||||
|
||||
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)
|
||||
|
||||
@@ -1384,9 +1384,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||
}
|
||||
|
||||
for (int i = 0; i < data.Count; i++)
|
||||
{
|
||||
IncomingLandObjectFromStorage(data[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public void IncomingLandObjectFromStorage(LandData data)
|
||||
|
||||
@@ -748,9 +748,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))
|
||||
@@ -758,9 +759,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;
|
||||
|
||||
@@ -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