diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Tests')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs | 1 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs | 115 |
2 files changed, 96 insertions, 20 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs index a3672d5..88452d2 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs | |||
@@ -113,6 +113,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
113 | agent.InventoryFolder = UUID.Zero; | 113 | agent.InventoryFolder = UUID.Zero; |
114 | agent.startpos = Vector3.Zero; | 114 | agent.startpos = Vector3.Zero; |
115 | agent.CapsPath = GetRandomCapsObjectPath(); | 115 | agent.CapsPath = GetRandomCapsObjectPath(); |
116 | agent.ChildrenCapSeeds = new Dictionary<ulong, string>(); | ||
116 | 117 | ||
117 | string reason; | 118 | string reason; |
118 | scene.NewUserConnection(agent, out reason); | 119 | scene.NewUserConnection(agent, out reason); |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs index ed2d317..23eab90 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs | |||
@@ -38,6 +38,7 @@ using OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion; | |||
38 | using OpenSim.Tests.Common; | 38 | using OpenSim.Tests.Common; |
39 | using OpenSim.Tests.Common.Mock; | 39 | using OpenSim.Tests.Common.Mock; |
40 | using OpenSim.Tests.Common.Setup; | 40 | using OpenSim.Tests.Common.Setup; |
41 | using System.Threading; | ||
41 | 42 | ||
42 | namespace OpenSim.Region.Framework.Scenes.Tests | 43 | namespace OpenSim.Region.Framework.Scenes.Tests |
43 | { | 44 | { |
@@ -55,56 +56,130 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
55 | public void TestSimpleNotNeighboursTeleport() | 56 | public void TestSimpleNotNeighboursTeleport() |
56 | { | 57 | { |
57 | TestHelper.InMethod(); | 58 | TestHelper.InMethod(); |
59 | ThreadRunResults results = new ThreadRunResults(); | ||
60 | results.Result = false; | ||
61 | results.Message = "Test did not run"; | ||
62 | TestRunning testClass = new TestRunning(results); | ||
58 | 63 | ||
64 | Thread testThread = new Thread(testClass.run); | ||
65 | |||
66 | try | ||
67 | { | ||
68 | // Seems kind of redundant to start a thread and then join it, however.. We need to protect against | ||
69 | // A thread abort exception in the simulator code. | ||
70 | testThread.Start(); | ||
71 | testThread.Join(); | ||
72 | } | ||
73 | catch (ThreadAbortException) | ||
74 | { | ||
75 | |||
76 | } | ||
77 | Assert.That(testClass.results.Result, Is.EqualTo(true), testClass.results.Message); | ||
59 | // Console.WriteLine("Beginning test {0}", MethodBase.GetCurrentMethod()); | 78 | // Console.WriteLine("Beginning test {0}", MethodBase.GetCurrentMethod()); |
79 | } | ||
80 | |||
81 | } | ||
82 | |||
83 | public class ThreadRunResults | ||
84 | { | ||
85 | public bool Result = false; | ||
86 | public string Message = string.Empty; | ||
87 | } | ||
88 | |||
89 | public class TestRunning | ||
90 | { | ||
91 | public ThreadRunResults results; | ||
92 | public TestRunning(ThreadRunResults t) | ||
93 | { | ||
94 | results = t; | ||
95 | } | ||
96 | public void run(object o) | ||
97 | { | ||
60 | 98 | ||
99 | //results.Result = true; | ||
61 | log4net.Config.XmlConfigurator.Configure(); | 100 | log4net.Config.XmlConfigurator.Configure(); |
62 | 101 | ||
63 | UUID sceneAId = UUID.Parse("00000000-0000-0000-0000-000000000100"); | 102 | UUID sceneAId = UUID.Parse("00000000-0000-0000-0000-000000000100"); |
64 | UUID sceneBId = UUID.Parse("00000000-0000-0000-0000-000000000200"); | 103 | UUID sceneBId = UUID.Parse("00000000-0000-0000-0000-000000000200"); |
65 | TestCommunicationsManager cm = new TestCommunicationsManager(); | 104 | TestCommunicationsManager cm = new TestCommunicationsManager(); |
66 | 105 | ||
67 | // shared module | 106 | // shared module |
68 | ISharedRegionModule interregionComms = new RESTInterregionComms(); | 107 | ISharedRegionModule interregionComms = new RESTInterregionComms(); |
69 | 108 | ||
70 | Scene sceneA = SceneSetupHelpers.SetupScene("sceneA", sceneAId, 1000, 1000, cm); | 109 | Scene sceneA = SceneSetupHelpers.SetupScene("sceneA", sceneAId, 1000, 1000, cm); |
71 | SceneSetupHelpers.SetupSceneModules(sceneA, new IniConfigSource(), interregionComms); | 110 | SceneSetupHelpers.SetupSceneModules(sceneA, new IniConfigSource(), interregionComms); |
72 | sceneA.RegisterRegionWithGrid(); | 111 | sceneA.RegisterRegionWithGrid(); |
73 | 112 | ||
74 | Scene sceneB = SceneSetupHelpers.SetupScene("sceneB", sceneBId, 1010, 1010, cm); | 113 | Scene sceneB = SceneSetupHelpers.SetupScene("sceneB", sceneBId, 1010, 1010, cm); |
75 | SceneSetupHelpers.SetupSceneModules(sceneB, new IniConfigSource(), interregionComms); | 114 | SceneSetupHelpers.SetupSceneModules(sceneB, new IniConfigSource(), interregionComms); |
76 | sceneB.RegisterRegionWithGrid(); | 115 | sceneB.RegisterRegionWithGrid(); |
77 | 116 | ||
78 | UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000041"); | 117 | UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000041"); |
79 | TestClient client = SceneSetupHelpers.AddRootAgent(sceneA, agentId); | 118 | TestClient client = SceneSetupHelpers.AddRootAgent(sceneA, agentId); |
80 | 119 | ||
81 | ICapabilitiesModule sceneACapsModule = sceneA.RequestModuleInterface<ICapabilitiesModule>(); | 120 | ICapabilitiesModule sceneACapsModule = sceneA.RequestModuleInterface<ICapabilitiesModule>(); |
121 | |||
122 | results.Result = (sceneACapsModule.GetCapsPath(agentId) == client.CapsSeedUrl); | ||
82 | 123 | ||
124 | if (!results.Result) | ||
125 | { | ||
126 | results.Message = "Incorrect caps object path set up in sceneA"; | ||
127 | return; | ||
128 | } | ||
129 | |||
130 | /* | ||
83 | Assert.That( | 131 | Assert.That( |
84 | sceneACapsModule.GetCapsPath(agentId), | 132 | sceneACapsModule.GetCapsPath(agentId), |
85 | Is.EqualTo(client.CapsSeedUrl), | 133 | Is.EqualTo(client.CapsSeedUrl), |
86 | "Incorrect caps object path set up in sceneA"); | 134 | "Incorrect caps object path set up in sceneA"); |
87 | 135 | */ | |
88 | // FIXME: This is a hack to get the test working - really the normal OpenSim mechanisms should be used. | 136 | // FIXME: This is a hack to get the test working - really the normal OpenSim mechanisms should be used. |
89 | client.TeleportTargetScene = sceneB; | ||
90 | client.Teleport(sceneB.RegionInfo.RegionHandle, new Vector3(100, 100, 100), new Vector3(40, 40, 40)); | ||
91 | 137 | ||
92 | Assert.That(sceneB.GetScenePresence(agentId), Is.Not.Null, "Client does not have an agent in sceneB"); | 138 | |
93 | Assert.That(sceneA.GetScenePresence(agentId), Is.Null, "Client still had an agent in sceneA"); | 139 | client.TeleportTargetScene = sceneB; |
140 | client.Teleport(sceneB.RegionInfo.RegionHandle, new Vector3(100, 100, 100), new Vector3(40, 40, 40)); | ||
141 | |||
142 | results.Result = (sceneB.GetScenePresence(agentId) != null); | ||
143 | if (!results.Result) | ||
144 | { | ||
145 | results.Message = "Client does not have an agent in sceneB"; | ||
146 | return; | ||
147 | } | ||
148 | |||
149 | //Assert.That(sceneB.GetScenePresence(agentId), Is.Not.Null, "Client does not have an agent in sceneB"); | ||
94 | 150 | ||
151 | //Assert.That(sceneA.GetScenePresence(agentId), Is.Null, "Client still had an agent in sceneA"); | ||
152 | |||
153 | results.Result = (sceneA.GetScenePresence(agentId) == null); | ||
154 | if (!results.Result) | ||
155 | { | ||
156 | results.Message = "Client still had an agent in sceneA"; | ||
157 | return; | ||
158 | } | ||
159 | |||
95 | ICapabilitiesModule sceneBCapsModule = sceneB.RequestModuleInterface<ICapabilitiesModule>(); | 160 | ICapabilitiesModule sceneBCapsModule = sceneB.RequestModuleInterface<ICapabilitiesModule>(); |
96 | 161 | ||
162 | |||
163 | results.Result = ("http://" + sceneB.RegionInfo.ExternalHostName + ":" + sceneB.RegionInfo.HttpPort + | ||
164 | "/CAPS/" + sceneBCapsModule.GetCapsPath(agentId) + "0000/" == client.CapsSeedUrl); | ||
165 | if (!results.Result) | ||
166 | { | ||
167 | results.Message = "Incorrect caps object path set up in sceneB"; | ||
168 | return; | ||
169 | } | ||
170 | |||
97 | // Temporary assertion - caps url construction should at least be doable through a method. | 171 | // Temporary assertion - caps url construction should at least be doable through a method. |
172 | /* | ||
98 | Assert.That( | 173 | Assert.That( |
99 | "http://" + sceneB.RegionInfo.ExternalHostName + ":" + sceneB.RegionInfo.HttpPort + "/CAPS/" + sceneBCapsModule.GetCapsPath(agentId) + "0000/", | 174 | "http://" + sceneB.RegionInfo.ExternalHostName + ":" + sceneB.RegionInfo.HttpPort + "/CAPS/" + sceneBCapsModule.GetCapsPath(agentId) + "0000/", |
100 | Is.EqualTo(client.CapsSeedUrl), | 175 | Is.EqualTo(client.CapsSeedUrl), |
101 | "Incorrect caps object path set up in sceneB"); | 176 | "Incorrect caps object path set up in sceneB"); |
102 | 177 | */ | |
103 | // This assertion will currently fail since we don't remove the caps paths when no longer needed | 178 | // This assertion will currently fail since we don't remove the caps paths when no longer needed |
104 | //Assert.That(sceneACapsModule.GetCapsPath(agentId), Is.Null, "sceneA still had a caps object path"); | 179 | //Assert.That(sceneACapsModule.GetCapsPath(agentId), Is.Null, "sceneA still had a caps object path"); |
105 | 180 | ||
106 | // TODO: Check that more of everything is as it should be | 181 | // TODO: Check that more of everything is as it should be |
107 | 182 | ||
108 | // TODO: test what happens if we try to teleport to a region that doesn't exist | 183 | // TODO: test what happens if we try to teleport to a region that doesn't exist |
109 | } | 184 | } |
110 | } | 185 | } |