public void Init() { cm = new TestCommunicationsManager(); scene = SceneSetupHelpers.SetupScene("Neighbour x", UUID.Random(), 1000, 1000, cm); scene2 = SceneSetupHelpers.SetupScene("Neighbour x+1", UUID.Random(), 1001, 1000, cm); scene3 = SceneSetupHelpers.SetupScene("Neighbour x-1", UUID.Random(), 999, 1000, cm); IRegionModule interregionComms = new RESTInterregionComms(); interregionComms.Initialise(scene, new IniConfigSource()); interregionComms.Initialise(scene2, new IniConfigSource()); interregionComms.Initialise(scene3, new IniConfigSource()); interregionComms.PostInitialise(); SceneSetupHelpers.SetupSceneModules(scene, new IniConfigSource(), interregionComms); SceneSetupHelpers.SetupSceneModules(scene2, new IniConfigSource(), interregionComms); SceneSetupHelpers.SetupSceneModules(scene3, new IniConfigSource(), interregionComms); agent1 = UUID.Random(); agent2 = UUID.Random(); agent3 = UUID.Random(); random = new Random(); sog1 = NewSOG(UUID.Random(), scene, agent1); sog2 = NewSOG(UUID.Random(), scene, agent1); sog3 = NewSOG(UUID.Random(), scene, agent1); //ulong neighbourHandle = Utils.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize)); region1 = scene.RegionInfo.RegionHandle; region2 = scene2.RegionInfo.RegionHandle; region3 = scene3.RegionInfo.RegionHandle; }
public void TestSimpleNotNeighboursTeleport() { TestHelper.InMethod(); // Console.WriteLine("Beginning test {0}", MethodBase.GetCurrentMethod()); log4net.Config.XmlConfigurator.Configure(); UUID sceneAId = UUID.Parse("00000000-0000-0000-0000-000000000100"); UUID sceneBId = UUID.Parse("00000000-0000-0000-0000-000000000200"); TestCommunicationsManager cm = new TestCommunicationsManager(); // shared module IRegionModule interregionComms = new RESTInterregionComms(); Scene sceneA = SceneSetupHelpers.SetupScene("sceneA", sceneAId, 1000, 1000, cm); SceneSetupHelpers.SetupSceneModules(sceneA, new IniConfigSource(), interregionComms); sceneA.RegisterRegionWithGrid(); Scene sceneB = SceneSetupHelpers.SetupScene("sceneB", sceneBId, 1010, 1010, cm); SceneSetupHelpers.SetupSceneModules(sceneB, new IniConfigSource(), interregionComms); sceneB.RegisterRegionWithGrid(); UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000041"); TestClient client = SceneSetupHelpers.AddRootAgent(sceneA, agentId); ICapabilitiesModule sceneACapsModule = sceneA.RequestModuleInterface <ICapabilitiesModule>(); Assert.That( sceneACapsModule.GetCapsPath(agentId), Is.EqualTo(client.CapsSeedUrl), "Incorrect caps object path set up in sceneA"); // FIXME: This is a hack to get the test working - really the normal OpenSim mechanisms should be used. client.TeleportTargetScene = sceneB; client.Teleport(sceneB.RegionInfo.RegionHandle, new Vector3(100, 100, 100), new Vector3(40, 40, 40)); Assert.That(sceneB.GetScenePresence(agentId), Is.Not.Null, "Client does not have an agent in sceneB"); Assert.That(sceneA.GetScenePresence(agentId), Is.Null, "Client still had an agent in sceneA"); ICapabilitiesModule sceneBCapsModule = sceneB.RequestModuleInterface <ICapabilitiesModule>(); // Temporary assertion - caps url construction should at least be doable through a method. Assert.That( "http://" + sceneB.RegionInfo.ExternalHostName + ":" + sceneB.RegionInfo.HttpPort + "/CAPS/" + sceneBCapsModule.GetCapsPath(agentId) + "0000/", Is.EqualTo(client.CapsSeedUrl), "Incorrect caps object path set up in sceneB"); // This assertion will currently fail since we don't remove the caps paths when no longer needed //Assert.That(sceneACapsModule.GetCapsPath(agentId), Is.Null, "sceneA still had a caps object path"); // TODO: Check that more of everything is as it should be // TODO: test what happens if we try to teleport to a region that doesn't exist }
public static Scene CreateScene(ushort httpPort, uint xloc, uint yloc) { //2130706433 = 127.0.0.1 BaseHttpServer server = new BaseHttpServer(httpPort, new System.Net.IPAddress(2130706433)); var commsManager = new OpenSim.Framework.Communications.CommunicationsManager(new OpenSim.Framework.NetworkServersInfo(), server, new AssetCache(), new LibraryRootFolder(".", "Library")); var gridSvc = new SceneCommunicationService(commsManager); var regionInfo = new OpenSim.Framework.RegionInfo(xloc, yloc, new System.Net.IPEndPoint(new System.Net.IPAddress(2130706433), 9001), "localhost"); var restComms = new RESTInterregionComms(); gridSvc.UnitTest_SetCommsOut(restComms); Scene scene = new Scene(regionInfo, commsManager, gridSvc); restComms.Initialize_Unittest(scene); server.Start(); return(scene); }