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

This seems to make more sense as we can get SP.ControllingClient
bulletsim
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

@ -52,7 +52,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
AvatarFactoryModule afm = new AvatarFactoryModule();
TestScene scene = SceneHelpers.SetupScene();
SceneHelpers.SetupSceneModules(scene, afm);
TestClient tc = SceneHelpers.AddClient(scene, userId);
IClientAPI tc = SceneHelpers.AddScenePresence(scene, userId).ControllingClient;
byte[] visualParams = new byte[AvatarAppearance.VISUALPARAM_COUNT];
for (byte i = 0; i < visualParams.Length; i++)

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>();

View File

@ -59,7 +59,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
AvatarFactoryModule afm = new AvatarFactoryModule();
TestScene scene = SceneHelpers.SetupScene();
SceneHelpers.SetupSceneModules(scene, config, afm, new NPCModule());
TestClient originalClient = SceneHelpers.AddClient(scene, TestHelpers.ParseTail(0x1));
IClientAPI originalClient = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)).ControllingClient;
// ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId);
// 8 is the index of the first baked texture in AvatarAppearance
@ -96,7 +96,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
TestScene scene = SceneHelpers.SetupScene();
SceneHelpers.SetupSceneModules(scene, config, new NPCModule());
TestClient originalClient = SceneHelpers.AddClient(scene, TestHelpers.ParseTail(0x1));
IClientAPI originalClient = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)).ControllingClient;
// ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId);
Vector3 startPos = new Vector3(128, 128, 30);

View File

@ -341,9 +341,9 @@ namespace OpenSim.Tests.Common
/// <param name="scene"></param>
/// <param name="agentId"></param>
/// <returns></returns>
public static TestClient AddClient(Scene scene, UUID agentId)
public static ScenePresence AddScenePresence(Scene scene, UUID agentId)
{
return AddClient(scene, GenerateAgentData(agentId));
return AddScenePresence(scene, GenerateAgentData(agentId));
}
/// <summary>
@ -364,7 +364,7 @@ namespace OpenSim.Tests.Common
/// <param name="scene"></param>
/// <param name="agentData"></param>
/// <returns></returns>
public static TestClient AddClient(Scene scene, AgentCircuitData agentData)
public static ScenePresence AddScenePresence(Scene scene, AgentCircuitData agentData)
{
string reason;
@ -386,7 +386,7 @@ namespace OpenSim.Tests.Common
scp.CompleteMovement(client);
//scp.MakeRootAgent(new Vector3(90, 90, 90), true);
return client;
return scp;
}
/// <summary>