refactor: Change SceneHelpers.AddClient() to AddScenePresence().

This seems to make more sense as we can get SP.ControllingClient
This commit is contained in:
Justin Clark-Casey (justincc)
2011-08-06 02:17:41 +01:00
parent 83ba35a26b
commit 85e07c78fb
9 changed files with 54 additions and 44 deletions

View File

@@ -83,7 +83,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
region1 = scene.RegionInfo.RegionHandle;
region2 = scene2.RegionInfo.RegionHandle;
SceneHelpers.AddClient(scene, agent1);
SceneHelpers.AddScenePresence(scene, agent1);
}
[Test]

View File

@@ -139,7 +139,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
SceneObjectPart part = SceneHelpers.AddSceneObject(scene);
IClientAPI client = SceneHelpers.AddClient(scene, agentId);
IClientAPI client = SceneHelpers.AddScenePresence(scene, agentId).ControllingClient;
scene.DeRezObjects(client, new System.Collections.Generic.List<uint>() { part.LocalId }, UUID.Zero, DeRezAction.Delete, UUID.Zero);
SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);

View File

@@ -66,7 +66,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
IConfig config = configSource.AddConfig("Startup");
config.Set("serverside_object_permissions", true);
SceneHelpers.SetupSceneModules(scene, configSource, new object[] { new PermissionsModule() });
TestClient client = SceneHelpers.AddClient(scene, userId);
IClientAPI client = SceneHelpers.AddScenePresence(scene, userId).ControllingClient;
// Turn off the timer on the async sog deleter - we'll crank it by hand for this test.
AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
@@ -105,7 +105,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
IConfig config = configSource.AddConfig("Startup");
config.Set("serverside_object_permissions", true);
SceneHelpers.SetupSceneModules(scene, configSource, new object[] { new PermissionsModule() });
TestClient client = SceneHelpers.AddClient(scene, userId);
IClientAPI client = SceneHelpers.AddScenePresence(scene, userId).ControllingClient;
// Turn off the timer on the async sog deleter - we'll crank it by hand for this test.
AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;

View File

@@ -75,7 +75,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
new GroupsModule(),
new MockGroupsServicesConnector() });
TestClient client = SceneHelpers.AddClient(scene, userId);
IClientAPI client = SceneHelpers.AddScenePresence(scene, userId).ControllingClient;
IGroupsModule groupsModule = scene.RequestModuleInterface<IGroupsModule>();

View File

@@ -93,6 +93,47 @@ namespace OpenSim.Region.Framework.Scenes.Tests
region3 = scene3.RegionInfo.RegionHandle;
}
// [Test]
// public void TestLogout()
// {
// TestHelpers.InMethod();
//// log4net.Config.XmlConfigurator.Configure();
//
// TestScene scene = SceneHelpers.SetupScene();
// SceneHelpers.
// }
/// <summary>
/// Test that if a root agent logs into a region, a child agent is also established in the neighbouring region
/// </summary>
/// <remarks>
/// Please note that unlike the other tests here, this doesn't rely on structures
/// </remarks>
[Test]
public void TestChildAgentEstablished()
{
TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure();
UUID agent1Id = UUID.Parse("00000000-0000-0000-0000-000000000001");
TestScene myScene1 = SceneHelpers.SetupScene("Neighbour y", UUID.Random(), 1000, 1000);
// TestScene myScene2 = SceneHelpers.SetupScene("Neighbour y + 1", UUID.Random(), 1001, 1000);
IConfigSource configSource = new IniConfigSource();
configSource.AddConfig("Modules").Set("EntityTransferModule", "BasicEntityTransferModule");
EntityTransferModule etm = new EntityTransferModule();
SceneHelpers.SetupSceneModules(myScene1, configSource, etm);
SceneHelpers.AddScenePresence(myScene1, agent1Id);
// ScenePresence childPresence = myScene2.GetScenePresence(agent1);
// TODO: Need to do a fair amount of work to allow synchronous establishment of child agents
// Assert.That(childPresence, Is.Not.Null);
// Assert.That(childPresence.IsChildAgent, Is.True);
}
/// <summary>
/// Test adding a root agent to a scene. Doesn't yet actually complete crossing the agent into the scene.
/// </summary>
@@ -190,37 +231,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests
CompleteAvatarMovement
*/
}
/// <summary>
/// Test that if a root agent logs into a region, a child agent is also established in the neighbouring region
/// </summary>
/// <remarks>
/// Please note that unlike the other tests here, this doesn't rely on structures
/// </remarks>
[Test]
public void TestChildAgentEstablished()
{
TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure();
UUID agent1Id = UUID.Parse("00000000-0000-0000-0000-000000000001");
TestScene myScene1 = SceneHelpers.SetupScene("Neighbour y", UUID.Random(), 1000, 1000);
TestScene myScene2 = SceneHelpers.SetupScene("Neighbour y + 1", UUID.Random(), 1001, 1000);
IConfigSource configSource = new IniConfigSource();
configSource.AddConfig("Modules").Set("EntityTransferModule", "BasicEntityTransferModule");
EntityTransferModule etm = new EntityTransferModule();
SceneHelpers.SetupSceneModules(myScene1, configSource, etm);
SceneHelpers.AddClient(myScene1, agent1Id);
ScenePresence childPresence = myScene2.GetScenePresence(agent1);
// TODO: Need to do a fair amount of work to allow synchronous establishment of child agents
// Assert.That(childPresence, Is.Not.Null);
// Assert.That(childPresence.IsChildAgent, Is.True);
}
// I'm commenting this test because it does not represent
// crossings. The Thread.Sleep's in here are not meaningful mocks,

View File

@@ -125,7 +125,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
sceneA.RegisterRegionWithGrid();
UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000041");
TestClient client = SceneHelpers.AddClient(sceneA, agentId);
TestClient client = (TestClient)SceneHelpers.AddScenePresence(sceneA, agentId).ControllingClient;
ICapabilitiesModule sceneACapsModule = sceneA.RequestModuleInterface<ICapabilitiesModule>();