Merge branch 'careminster-presence-refactor' of ssh://3dhosting.de/var/git/careminster into careminster-presence-refactor

avinationmerge
Melanie 2011-05-22 20:00:59 +02:00
commit 89705b19c7
37 changed files with 331 additions and 144 deletions

View File

@ -33,7 +33,6 @@ using OpenMetaverse.StructuredData;
using OpenSim.Framework;
using OpenSim.Tests.Common;
using OpenSim.Tests.Common.Mock;
using OpenSim.Tests.Common.Setup;
using Animation = OpenSim.Framework.Animation;
namespace OpenSim.Framework.Tests

View File

@ -44,7 +44,6 @@ using OpenSim.Region.Framework.Scenes.Serialization;
using OpenSim.Services.Interfaces;
using OpenSim.Tests.Common;
using OpenSim.Tests.Common.Mock;
using OpenSim.Tests.Common.Setup;
namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
{
@ -104,7 +103,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
Scene scene = SceneSetupHelpers.SetupScene();
SceneSetupHelpers.SetupSceneModules(scene, archiverModule);
UserProfileTestUtils.CreateUserWithInventory(scene, m_uaLL1, "hampshire");
UserAccountHelpers.CreateUserWithInventory(scene, m_uaLL1, "hampshire");
MemoryStream archiveWriteStream = new MemoryStream();

View File

@ -44,7 +44,6 @@ using OpenSim.Region.Framework.Scenes.Serialization;
using OpenSim.Services.Interfaces;
using OpenSim.Tests.Common;
using OpenSim.Tests.Common.Mock;
using OpenSim.Tests.Common.Setup;
namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
{
@ -72,7 +71,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
TestHelper.InMethod();
// log4net.Config.XmlConfigurator.Configure();
UserProfileTestUtils.CreateUserWithInventory(m_scene, m_uaLL1, "password");
UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaLL1, "password");
m_archiverModule.DearchiveInventory(m_uaLL1.FirstName, m_uaLL1.LastName, "/", "password", m_iarStream);
InventoryItemBase coaItem
@ -138,7 +137,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
string userLastName = "Stirrup";
string userPassword = "troll";
UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020");
UserProfileTestUtils.CreateUserWithInventory(m_scene, userFirstName, userLastName, userId, userPassword);
UserAccountHelpers.CreateUserWithInventory(m_scene, userFirstName, userLastName, userId, userPassword);
// Create asset
UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040");
@ -229,7 +228,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
TestHelper.InMethod();
// log4net.Config.XmlConfigurator.Configure();
UserProfileTestUtils.CreateUserWithInventory(m_scene, m_uaLL1, "meowfood");
UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaLL1, "meowfood");
m_archiverModule.DearchiveInventory(m_uaLL1.FirstName, m_uaLL1.LastName, "/", "meowfood", m_iarStream);
InventoryItemBase foundItem1
@ -261,8 +260,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
TestHelper.InMethod();
// log4net.Config.XmlConfigurator.Configure();
UserProfileTestUtils.CreateUserWithInventory(m_scene, m_uaMT, "meowfood");
UserProfileTestUtils.CreateUserWithInventory(m_scene, m_uaLL2, "hampshire");
UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaMT, "meowfood");
UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaLL2, "hampshire");
m_archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "/", "meowfood", m_iarStream);
InventoryItemBase foundItem1
@ -294,7 +293,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
TestHelper.InMethod();
// log4net.Config.XmlConfigurator.Configure();
UserProfileTestUtils.CreateUserWithInventory(m_scene, m_uaMT, "password");
UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaMT, "password");
m_archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "/", "password", m_iarStream);
InventoryItemBase foundItem1

View File

@ -44,7 +44,6 @@ using OpenSim.Region.Framework.Scenes.Serialization;
using OpenSim.Services.Interfaces;
using OpenSim.Tests.Common;
using OpenSim.Tests.Common.Mock;
using OpenSim.Tests.Common.Setup;
namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
{
@ -71,7 +70,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
string userLastName = "Stirrup";
string userPassword = "troll";
UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020");
UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userId, userPassword);
UserAccountHelpers.CreateUserWithInventory(scene, userFirstName, userLastName, userId, userPassword);
// Create asset
SceneObjectGroup object1;
@ -184,8 +183,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
UserProfileTestUtils.CreateUserWithInventory(scene, m_uaMT, "meowfood");
UserProfileTestUtils.CreateUserWithInventory(scene, m_uaLL1, "hampshire");
UserAccountHelpers.CreateUserWithInventory(scene, m_uaMT, "meowfood");
UserAccountHelpers.CreateUserWithInventory(scene, m_uaLL1, "hampshire");
archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "/", "meowfood", m_iarStream);
InventoryItemBase foundItem1
@ -194,7 +193,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1");
// Now try loading to a root child folder
UserInventoryTestUtils.CreateInventoryFolder(scene.InventoryService, m_uaMT.PrincipalID, "xA");
UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, m_uaMT.PrincipalID, "xA");
MemoryStream archiveReadStream = new MemoryStream(m_iarStream.ToArray());
archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "xA", "meowfood", archiveReadStream);
@ -203,7 +202,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
Assert.That(foundItem2, Is.Not.Null, "Didn't find loaded item 2");
// Now try loading to a more deeply nested folder
UserInventoryTestUtils.CreateInventoryFolder(scene.InventoryService, m_uaMT.PrincipalID, "xB/xC");
UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, m_uaMT.PrincipalID, "xB/xC");
archiveReadStream = new MemoryStream(archiveReadStream.ToArray());
archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "xB/xC", "meowfood", archiveReadStream);
@ -226,7 +225,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
Scene scene = SceneSetupHelpers.SetupScene();
SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
UserProfileTestUtils.CreateUserWithInventory(scene, m_uaMT, "password");
UserAccountHelpers.CreateUserWithInventory(scene, m_uaMT, "password");
archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "/Objects", "password", m_iarStream);
InventoryItemBase foundItem1
@ -255,7 +254,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
string userFirstName = "Jock";
string userLastName = "Stirrup";
UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020");
UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userId, "meowfood");
UserAccountHelpers.CreateUserWithInventory(scene, userFirstName, userLastName, userId, "meowfood");
// Create asset
SceneObjectGroup object1;
@ -328,7 +327,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
// log4net.Config.XmlConfigurator.Configure();
Scene scene = SceneSetupHelpers.SetupScene();
UserAccount ua1 = UserProfileTestUtils.CreateUserWithInventory(scene);
UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene);
Dictionary <string, InventoryFolderBase> foldersCreated = new Dictionary<string, InventoryFolderBase>();
HashSet<InventoryNodeBase> nodesLoaded = new HashSet<InventoryNodeBase>();
@ -395,13 +394,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
//log4net.Config.XmlConfigurator.Configure();
Scene scene = SceneSetupHelpers.SetupScene();
UserAccount ua1 = UserProfileTestUtils.CreateUserWithInventory(scene);
UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene);
string folder1ExistingName = "a";
string folder2Name = "b";
InventoryFolderBase folder1
= UserInventoryTestUtils.CreateInventoryFolder(
= UserInventoryHelpers.CreateInventoryFolder(
scene.InventoryService, ua1.PrincipalID, folder1ExistingName);
string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1ExistingName, UUID.Random());
@ -446,13 +445,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
// log4net.Config.XmlConfigurator.Configure();
Scene scene = SceneSetupHelpers.SetupScene();
UserAccount ua1 = UserProfileTestUtils.CreateUserWithInventory(scene);
UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene);
string folder1ExistingName = "a";
string folder2Name = "b";
InventoryFolderBase folder1
= UserInventoryTestUtils.CreateInventoryFolder(
= UserInventoryHelpers.CreateInventoryFolder(
scene.InventoryService, ua1.PrincipalID, folder1ExistingName);
string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1ExistingName, UUID.Random());

View File

@ -45,7 +45,6 @@ using OpenSim.Region.Framework.Scenes.Serialization;
using OpenSim.Services.Interfaces;
using OpenSim.Tests.Common;
using OpenSim.Tests.Common.Mock;
using OpenSim.Tests.Common.Setup;
namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests
{
@ -73,7 +72,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests
string userFirstName = "Jock";
string userLastName = "Stirrup";
string userPassword = "troll";
UserProfileTestUtils.CreateUserWithInventory(m_scene, userFirstName, userLastName, m_userId, userPassword);
UserAccountHelpers.CreateUserWithInventory(m_scene, userFirstName, userLastName, m_userId, userPassword);
AgentCircuitData acd = new AgentCircuitData();
acd.AgentID = m_userId;

View File

@ -40,7 +40,6 @@ using OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid;
using OpenSim.Region.Framework.Scenes;
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
using OpenSim.Tests.Common;
using OpenSim.Tests.Common.Setup;
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests
{

View File

@ -40,7 +40,6 @@ using OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence;
using OpenSim.Region.Framework.Scenes;
using PresenceInfo = OpenSim.Services.Interfaces.PresenceInfo;
using OpenSim.Tests.Common;
using OpenSim.Tests.Common.Setup;
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence.Tests
{

View File

@ -43,7 +43,6 @@ using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.Framework.Scenes.Serialization;
using OpenSim.Tests.Common;
using OpenSim.Tests.Common.Mock;
using OpenSim.Tests.Common.Setup;
using ArchiveConstants = OpenSim.Framework.Serialization.ArchiveConstants;
using TarArchiveReader = OpenSim.Framework.Serialization.TarArchiveReader;
using TarArchiveWriter = OpenSim.Framework.Serialization.TarArchiveWriter;

View File

@ -37,7 +37,6 @@ using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Tests.Common;
using OpenSim.Tests.Common.Mock;
using OpenSim.Tests.Common.Setup;
namespace OpenSim.Region.CoreModules.World.Land.Tests
{

View File

@ -40,7 +40,6 @@ using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.Framework.Scenes.Serialization;
using OpenSim.Tests.Common;
using OpenSim.Tests.Common.Mock;
using OpenSim.Tests.Common.Setup;
namespace OpenSim.Region.CoreModules.World.Media.Moap.Tests
{

View File

@ -35,7 +35,6 @@ using OpenSim.Framework;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.Framework.Scenes.Serialization;
using OpenSim.Tests.Common;
using OpenSim.Tests.Common.Setup;
namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
{

View File

@ -2145,19 +2145,7 @@ namespace OpenSim.Region.Framework.Scenes
sourcePart.Inventory.RemoveInventoryItem(item.ItemID);
}
AddNewSceneObject(group, true);
group.AbsolutePosition = pos;
group.Velocity = vel;
if (rot != null)
group.UpdateGroupRotationR((Quaternion)rot);
// TODO: This needs to be refactored with the similar code in
// SceneGraph.AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, Vector3 pos, Quaternion rot, Vector3 vel)
// possibly by allowing this method to take a null rotation.
if (group.RootPart.PhysActor != null && group.RootPart.PhysActor.IsPhysical && vel != Vector3.Zero)
group.RootPart.ApplyImpulse((vel * group.GetMass()), false);
AddNewSceneObject(group, true, pos, rot, vel);
// We can only call this after adding the scene object, since the scene object references the scene
// to find out if scripts should be activated at all.

View File

@ -2014,16 +2014,17 @@ namespace OpenSim.Region.Framework.Scenes
/// <summary>
/// Add a newly created object to the scene.
/// </summary>
///
/// <remarks>
/// This method does not send updates to the client - callers need to handle this themselves.
/// </remarks>
/// <param name="sceneObject"></param>
/// <param name="attachToBackup"></param>
/// <param name="pos">Position of the object</param>
/// <param name="rot">Rotation of the object</param>
/// <param name="pos">Position of the object. If null then the position stored in the object is used.</param>
/// <param name="rot">Rotation of the object. If null then the rotation stored in the object is used.</param>
/// <param name="vel">Velocity of the object. This parameter only has an effect if the object is physical</param>
/// <returns></returns>
public bool AddNewSceneObject(
SceneObjectGroup sceneObject, bool attachToBackup, Vector3 pos, Quaternion rot, Vector3 vel)
SceneObjectGroup sceneObject, bool attachToBackup, Vector3? pos, Quaternion? rot, Vector3 vel)
{
if (m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, pos, rot, vel))
{
@ -4436,7 +4437,28 @@ namespace OpenSim.Region.Framework.Scenes
// }
/// <summary>
/// Get a named prim contained in this scene (will return the first
/// Get a group via its UUID
/// </summary>
/// <param name="fullID"></param>
/// <returns>null if no group with that name exists</returns>
public SceneObjectGroup GetSceneObjectGroup(UUID fullID)
{
return m_sceneGraph.GetSceneObjectGroup(fullID);
}
/// <summary>
/// Get a group by name from the scene (will return the first
/// found, if there are more than one prim with the same name)
/// </summary>
/// <param name="name"></param>
/// <returns>null if no group with that name exists</returns>
public SceneObjectGroup GetSceneObjectGroup(string name)
{
return m_sceneGraph.GetSceneObjectGroup(name);
}
/// <summary>
/// Get a prim by name from the scene (will return the first
/// found, if there are more than one prim with the same name)
/// </summary>
/// <param name="name"></param>

View File

@ -352,24 +352,25 @@ namespace OpenSim.Region.Framework.Scenes
/// This method does not send updates to the client - callers need to handle this themselves.
/// <param name="sceneObject"></param>
/// <param name="attachToBackup"></param>
/// <param name="pos">Position of the object</param>
/// <param name="rot">Rotation of the object</param>
/// <param name="pos">Position of the object. If null then the position stored in the object is used.</param>
/// <param name="rot">Rotation of the object. If null then the rotation stored in the object is used.</param>
/// <param name="vel">Velocity of the object. This parameter only has an effect if the object is physical</param>
/// <returns></returns>
public bool AddNewSceneObject(
SceneObjectGroup sceneObject, bool attachToBackup, Vector3 pos, Quaternion rot, Vector3 vel)
SceneObjectGroup sceneObject, bool attachToBackup, Vector3? pos, Quaternion? rot, Vector3 vel)
{
AddNewSceneObject(sceneObject, true, false);
// we set it's position in world.
sceneObject.AbsolutePosition = pos;
if (pos != null)
sceneObject.AbsolutePosition = (Vector3)pos;
if (sceneObject.RootPart.Shape.PCode == (byte)PCode.Prim)
{
sceneObject.ClearPartAttachmentData();
}
sceneObject.UpdateGroupRotationR(rot);
if (rot != null)
sceneObject.UpdateGroupRotationR((Quaternion)rot);
//group.ApplyPhysics(m_physicalPrim);
if (sceneObject.RootPart.PhysActor != null && sceneObject.RootPart.PhysActor.IsPhysical && vel != Vector3.Zero)
@ -385,6 +386,9 @@ namespace OpenSim.Region.Framework.Scenes
/// Add an object to the scene. This will both update the scene, and send information about the
/// new object to all clients interested in the scene.
/// </summary>
/// <remarks>
/// The object's stored position, rotation and velocity are used.
/// </remarks>
/// <param name="sceneObject"></param>
/// <param name="attachToBackup">
/// If true, the object is made persistent into the scene.
@ -1047,6 +1051,51 @@ namespace OpenSim.Region.Framework.Scenes
return result;
}
/// <summary>
/// Get a group in the scene
/// </summary>
/// <param name="fullID">UUID of the group</param>
/// <returns>null if no such group was found</returns>
protected internal SceneObjectGroup GetSceneObjectGroup(UUID fullID)
{
lock (SceneObjectGroupsByFullID)
{
if (SceneObjectGroupsByFullID.ContainsKey(fullID))
return SceneObjectGroupsByFullID[fullID];
}
return null;
}
/// <summary>
/// Get a group by name from the scene (will return the first
/// found, if there are more than one prim with the same name)
/// </summary>
/// <param name="name"></param>
/// <returns>null if the part was not found</returns>
protected internal SceneObjectGroup GetSceneObjectGroup(string name)
{
SceneObjectGroup so = null;
Entities.Find(
delegate(EntityBase entity)
{
if (entity is SceneObjectGroup)
{
if (entity.Name == name)
{
so = (SceneObjectGroup)entity;
return true;
}
}
return false;
}
);
return so;
}
/// <summary>
/// Get a part contained in this scene.
/// </summary>
@ -1061,7 +1110,7 @@ namespace OpenSim.Region.Framework.Scenes
}
/// <summary>
/// Get a named prim contained in this scene (will return the first
/// Get a prim by name from the scene (will return the first
/// found, if there are more than one prim with the same name)
/// </summary>
/// <param name="name"></param>

View File

@ -43,7 +43,6 @@ using OpenSim.Region.CoreModules.World.Serialiser;
using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
using OpenSim.Tests.Common;
using OpenSim.Tests.Common.Mock;
using OpenSim.Tests.Common.Setup;
namespace OpenSim.Region.Framework.Scenes.Tests
{

View File

@ -37,7 +37,6 @@ using OpenSim.Framework;
using OpenSim.Framework.Communications;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Tests.Common;
using OpenSim.Tests.Common.Setup;
namespace OpenSim.Region.Framework.Scenes.Tests
{

View File

@ -34,7 +34,6 @@ using OpenSim.Framework.Communications;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Tests.Common;
using OpenSim.Tests.Common.Mock;
using OpenSim.Tests.Common.Setup;
namespace OpenSim.Region.Framework.Scenes.Tests
{

View File

@ -34,7 +34,6 @@ using OpenSim.Framework.Communications;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Tests.Common;
using OpenSim.Tests.Common.Mock;
using OpenSim.Tests.Common.Setup;
namespace OpenSim.Region.Framework.Scenes.Tests
{

View File

@ -37,7 +37,6 @@ using OpenSim.Region.CoreModules.World.Permissions;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Tests.Common;
using OpenSim.Tests.Common.Mock;
using OpenSim.Tests.Common.Setup;
namespace OpenSim.Region.Framework.Scenes.Tests
{

View File

@ -35,7 +35,6 @@ using OpenSim.Framework.Communications;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Tests.Common;
using OpenSim.Tests.Common.Mock;
using OpenSim.Tests.Common.Setup;
using log4net;
namespace OpenSim.Region.Framework.Scenes.Tests

View File

@ -40,7 +40,6 @@ using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups;
using OpenSim.Tests.Common;
using OpenSim.Tests.Common.Mock;
using OpenSim.Tests.Common.Setup;
namespace OpenSim.Region.Framework.Scenes.Tests
{

View File

@ -44,7 +44,6 @@ using OpenSim.Region.CoreModules.World.Serialiser;
using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
using OpenSim.Tests.Common;
using OpenSim.Tests.Common.Mock;
using OpenSim.Tests.Common.Setup;
namespace OpenSim.Region.Framework.Scenes.Tests
{

View File

@ -43,7 +43,6 @@ using OpenSim.Region.CoreModules.World.Serialiser;
using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
using OpenSim.Tests.Common;
using OpenSim.Tests.Common.Mock;
using OpenSim.Tests.Common.Setup;
namespace OpenSim.Region.Framework.Scenes.Tests
{

View File

@ -36,7 +36,6 @@ using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
using OpenSim.Tests.Common;
using OpenSim.Tests.Common.Mock;
using OpenSim.Tests.Common.Setup;
using System.Threading;
namespace OpenSim.Region.Framework.Scenes.Tests

View File

@ -46,55 +46,55 @@ using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
using OpenSim.Services.Interfaces;
using OpenSim.Tests.Common;
using OpenSim.Tests.Common.Mock;
using OpenSim.Tests.Common.Setup;
namespace OpenSim.Region.Framework.Tests
{
[TestFixture]
public class TaskInventoryTests
{
protected UserAccount CreateUser(Scene scene)
[Test]
public void TestRezObjectFromInventoryItem()
{
string userFirstName = "Jock";
string userLastName = "Stirrup";
string userPassword = "troll";
UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020");
return UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userId, userPassword);
}
TestHelper.InMethod();
// log4net.Config.XmlConfigurator.Configure();
protected SceneObjectGroup CreateSO1(Scene scene, UUID ownerId)
{
string part1Name = "part1";
UUID part1Id = UUID.Parse("10000000-0000-0000-0000-000000000000");
SceneObjectPart part1
= new SceneObjectPart(ownerId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
{ Name = part1Name, UUID = part1Id };
return new SceneObjectGroup(part1);
}
Scene scene = SceneSetupHelpers.SetupScene();
UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene);
SceneObjectGroup sog1 = SceneSetupHelpers.CreateSceneObject(1, user1.PrincipalID);
SceneObjectPart sop1 = sog1.RootPart;
protected TaskInventoryItem CreateSOItem1(Scene scene, SceneObjectPart part)
{
AssetNotecard nc = new AssetNotecard();
nc.BodyText = "Hello World!";
nc.Encode();
UUID ncAssetUuid = new UUID("00000000-0000-0000-1000-000000000000");
UUID ncItemUuid = new UUID("00000000-0000-0000-1100-000000000000");
AssetBase ncAsset
= AssetHelpers.CreateAsset(ncAssetUuid, AssetType.Notecard, nc.AssetData, UUID.Zero);
scene.AssetService.Store(ncAsset);
TaskInventoryItem ncItem
= new TaskInventoryItem
{ Name = "ncItem", AssetID = ncAssetUuid, ItemID = ncItemUuid,
Type = (int)AssetType.Notecard, InvType = (int)InventoryType.Notecard };
part.Inventory.AddInventoryItem(ncItem, true);
// Create an object embedded inside the first
UUID taskSceneObjectItemId = UUID.Parse("00000000-0000-0000-0000-100000000000");
TaskInventoryItem taskSceneObjectItem
= TaskInventoryHelpers.AddSceneObject(scene, sop1, "tso", taskSceneObjectItemId);
return ncItem;
scene.AddSceneObject(sog1);
Vector3 rezPos = new Vector3(10, 10, 10);
Quaternion rezRot = new Quaternion(0.5f, 0.5f, 0.5f, 0.5f);
Vector3 rezVel = new Vector3(2, 2, 2);
scene.RezObject(sop1, taskSceneObjectItem, rezPos, rezRot, rezVel, 0);
SceneObjectGroup rezzedObject = scene.GetSceneObjectGroup("tso");
Assert.That(rezzedObject, Is.Not.Null);
Assert.That(rezzedObject.AbsolutePosition, Is.EqualTo(rezPos));
// Velocity doesn't get applied, probably because there is no physics in tests (yet)
// Assert.That(rezzedObject.Velocity, Is.EqualTo(rezVel));
Assert.That(rezzedObject.Velocity, Is.EqualTo(Vector3.Zero));
// Confusingly, this isn't the rezzedObject.Rotation
Assert.That(rezzedObject.RootPart.RotationOffset, Is.EqualTo(rezRot));
}
/// <summary>
/// Test MoveTaskInventoryItem where the item has no parent folder assigned.
/// </summary>
/// <remarks>
/// This should place it in the most suitable user folder.
/// </remarks>
[Test]
public void TestMoveTaskInventoryItem()
{
@ -102,10 +102,11 @@ namespace OpenSim.Region.Framework.Tests
// log4net.Config.XmlConfigurator.Configure();
Scene scene = SceneSetupHelpers.SetupScene();
UserAccount user1 = CreateUser(scene);
SceneObjectGroup sog1 = CreateSO1(scene, user1.PrincipalID);
UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene);
SceneObjectGroup sog1 = SceneSetupHelpers.CreateSceneObject(1, user1.PrincipalID);
SceneObjectPart sop1 = sog1.RootPart;
TaskInventoryItem sopItem1 = CreateSOItem1(scene, sop1);
TaskInventoryItem sopItem1 = TaskInventoryHelpers.AddNotecard(scene, sop1);
InventoryFolderBase folder
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, user1.PrincipalID, "Objects")[0];
@ -128,10 +129,10 @@ namespace OpenSim.Region.Framework.Tests
// log4net.Config.XmlConfigurator.Configure();
Scene scene = SceneSetupHelpers.SetupScene();
UserAccount user1 = CreateUser(scene);
SceneObjectGroup sog1 = CreateSO1(scene, user1.PrincipalID);
UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene);
SceneObjectGroup sog1 = SceneSetupHelpers.CreateSceneObject(1, user1.PrincipalID);
SceneObjectPart sop1 = sog1.RootPart;
TaskInventoryItem sopItem1 = CreateSOItem1(scene, sop1);
TaskInventoryItem sopItem1 = TaskInventoryHelpers.AddNotecard(scene, sop1);
// Perform test
scene.MoveTaskInventoryItem(user1.PrincipalID, UUID.Zero, sop1, sopItem1.ItemID);

View File

@ -33,7 +33,6 @@ using OpenSim.Framework;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Services.Interfaces;
using OpenSim.Tests.Common;
using OpenSim.Tests.Common.Setup;
using OpenSim.Tests.Common.Mock;
namespace OpenSim.Region.Framework.Scenes.Tests

View File

@ -35,7 +35,6 @@ using OpenSim.Framework.Communications;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Tests.Common;
using OpenSim.Tests.Common.Mock;
using OpenSim.Tests.Common.Setup;
namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups.Tests
{

View File

@ -278,21 +278,21 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup
{
string sRegionName;
string sRegionLabel;
string prepend;
// string prepend;
AutoBackupModuleState state;
if (parseDefault)
{
sRegionName = null;
sRegionLabel = "DEFAULT";
prepend = "";
// prepend = "";
state = this.m_defaultState;
}
else
{
sRegionName = scene.RegionInfo.RegionName;
sRegionLabel = sRegionName;
prepend = sRegionName + ".";
// prepend = sRegionName + ".";
state = null;
}

View File

@ -3635,12 +3635,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return m_ScriptEngine.GetStartParameter(m_itemID);
}
public void llGodLikeRezObject(string inventory, LSL_Vector pos)
{
m_host.AddScriptLPS(1);
NotImplemented("llGodLikeRezObject");
}
public void llRequestPermissions(string agent, int perm)
{
UUID agentID = new UUID();
@ -4618,12 +4612,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.CollisionSoundVolume = (float)impact_volume;
}
public void llCollisionSprite(string impact_sprite)
{
m_host.AddScriptLPS(1);
NotImplemented("llCollisionSprite");
}
public LSL_String llGetAnimation(string id)
{
// This should only return a value if the avatar is in the same region
@ -5963,11 +5951,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
ScriptSleep(100);
}
public void llSetSoundQueueing(int queue)
{
m_host.AddScriptLPS(1);
}
public void llSetSoundRadius(double radius)
{
m_host.AddScriptLPS(1);
@ -11000,6 +10983,72 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_SayShoutCount = 0;
}
#region Not Implemented
//
// Listing the unimplemented lsl functions here, please move
// them from this region as they are completed
//
public void llCastRay(LSL_Vector start, LSL_Vector end, LSL_List options)
{
m_host.AddScriptLPS(1);
NotImplemented("llCastRay");
}
public void llGetEnv(LSL_String name)
{
m_host.AddScriptLPS(1);
NotImplemented("llGetEnv");
}
public void llGetSPMaxMemory()
{
m_host.AddScriptLPS(1);
NotImplemented("llGetSPMaxMemory");
}
public virtual void llGetUsedMemory()
{
m_host.AddScriptLPS(1);
NotImplemented("llGetUsedMemory");
}
public void llRegionSayTo( LSL_Key target, LSL_Integer channel, LSL_String msg )
{
m_host.AddScriptLPS(1);
NotImplemented("llRegionSayTo");
}
public void llScriptProfiler( LSL_Integer flags )
{
m_host.AddScriptLPS(1);
//NotImplemented("llScriptProfiler");
}
public void llSetSoundQueueing(int queue)
{
m_host.AddScriptLPS(1);
}
public void llCollisionSprite(string impact_sprite)
{
m_host.AddScriptLPS(1);
NotImplemented("llCollisionSprite");
}
public void llGodLikeRezObject(string inventory, LSL_Vector pos)
{
m_host.AddScriptLPS(1);
NotImplemented("llGodLikeRezObject");
}
#endregion
}
public class NotecardCache

View File

@ -29,7 +29,6 @@ using System.Collections.Generic;
using NUnit.Framework;
using OpenSim.Tests.Common;
using OpenSim.Region.ScriptEngine.Shared;
using OpenSim.Tests.Common.Setup;
using OpenSim.Region.Framework.Scenes;
using Nini.Config;
using OpenSim.Region.ScriptEngine.Shared.Api;

View File

@ -29,7 +29,6 @@ using System;
using System.Collections.Generic;
using Nini.Config;
using NUnit.Framework;
using OpenSim.Tests.Common.Setup;
using OpenSim.Tests.Common.Mock;
using OpenSim.Region.Framework.Scenes;
using OpenMetaverse;

View File

@ -59,7 +59,21 @@ namespace OpenSim.Tests.Common
}
/// <summary>
/// Create an asset from the given scene object.
/// Create an asset from the given object.
/// </summary>
/// <param name="assetUuidTail">
/// The hexadecimal last part of the UUID for the asset created. A UUID of the form "00000000-0000-0000-0000-{0:XD12}"
/// will be used.
/// </param>
/// <param name="sog"></param>
/// <returns></returns>
public static AssetBase CreateAsset(int assetUuidTail, SceneObjectGroup sog)
{
return CreateAsset(new UUID(string.Format("00000000-0000-0000-0000-{0:X12}", assetUuidTail)), sog);
}
/// <summary>
/// Create an asset from the given object.
/// </summary>
/// <param name="assetUuid"></param>
/// <param name="sog"></param>
@ -76,7 +90,7 @@ namespace OpenSim.Tests.Common
/// <summary>
/// Create an asset from the given scene object.
/// </summary>
/// <param name="assetUuidTailZ">
/// <param name="assetUuidTail">
/// The hexadecimal last part of the UUID for the asset created. A UUID of the form "00000000-0000-0000-0000-{0:XD12}"
/// will be used.
/// </param>

View File

@ -34,9 +34,9 @@ using OpenSim.Framework.Servers;
using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Tests.Common.Mock;
namespace OpenSim.Tests.Common.Setup
namespace OpenSim.Tests.Common
{
public class BaseRequestHandlerTestHelper
public class BaseRequestHandlerHelpers
{
private static string[] m_emptyStringArray = new string[] { };

View File

@ -49,7 +49,7 @@ using OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence;
using OpenSim.Services.Interfaces;
using OpenSim.Tests.Common.Mock;
namespace OpenSim.Tests.Common.Setup
namespace OpenSim.Tests.Common
{
/// <summary>
/// Helpers for setting up scenes.

View File

@ -0,0 +1,89 @@
/*
* 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 OpenMetaverse;
using OpenMetaverse.Assets;
using OpenSim.Framework;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Services.Interfaces;
namespace OpenSim.Tests.Common
{
/// <summary>
/// Utility functions for carrying out task inventory tests.
/// </summary>
///
public static class TaskInventoryHelpers
{
/// <summary>
/// Add a notecard item to the given part.
/// </summary>
/// <param name="scene"></param>
/// <param name="part"></param>
/// <returns>The item that was added</returns>
public static TaskInventoryItem AddNotecard(Scene scene, SceneObjectPart part)
{
AssetNotecard nc = new AssetNotecard();
nc.BodyText = "Hello World!";
nc.Encode();
UUID ncAssetUuid = new UUID("00000000-0000-0000-1000-000000000000");
UUID ncItemUuid = new UUID("00000000-0000-0000-1100-000000000000");
AssetBase ncAsset
= AssetHelpers.CreateAsset(ncAssetUuid, AssetType.Notecard, nc.AssetData, UUID.Zero);
scene.AssetService.Store(ncAsset);
TaskInventoryItem ncItem
= new TaskInventoryItem
{ Name = "ncItem", AssetID = ncAssetUuid, ItemID = ncItemUuid,
Type = (int)AssetType.Notecard, InvType = (int)InventoryType.Notecard };
part.Inventory.AddInventoryItem(ncItem, true);
return ncItem;
}
/// <summary>
/// Add a scene object item to the given part.
/// </summary>
/// <param name="scene"></param>
/// <param name="sop"></param>
/// <param name="itemName"></param>
/// <param name="id"></param>
public static TaskInventoryItem AddSceneObject(Scene scene, SceneObjectPart sop, string itemName, UUID id)
{
SceneObjectGroup taskSceneObject = SceneSetupHelpers.CreateSceneObject(1, UUID.Zero);
AssetBase taskSceneObjectAsset = AssetHelpers.CreateAsset(0x10, taskSceneObject);
scene.AssetService.Store(taskSceneObjectAsset);
TaskInventoryItem taskSceneObjectItem
= new TaskInventoryItem
{ Name = itemName, AssetID = taskSceneObjectAsset.FullID, ItemID = id,
Type = (int)AssetType.Object, InvType = (int)InventoryType.Object };
sop.Inventory.AddInventoryItem(taskSceneObjectItem, true);
return taskSceneObjectItem;
}
}
}

View File

@ -31,12 +31,12 @@ using OpenSim.Framework.Communications;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Services.Interfaces;
namespace OpenSim.Tests.Common.Setup
namespace OpenSim.Tests.Common
{
/// <summary>
/// Utility functions for carrying out user profile related tests.
/// </summary>
public static class UserProfileTestUtils
public static class UserAccountHelpers
{
// /// <summary>
// /// Create a test user with a standard inventory

View File

@ -34,9 +34,9 @@ using OpenSim.Services.Interfaces;
namespace OpenSim.Tests.Common
{
/// <summary>
/// Utility functions for carrying out user inventory related tests.
/// Utility functions for carrying out user inventory tests.
/// </summary>
public static class UserInventoryTestUtils
public static class UserInventoryHelpers
{
public static readonly string PATH_DELIMITER = "/";