aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/LindenUDP/Tests/BasicCircuitTests.cs
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-11-06 19:35:57 +0000
committerJustin Clarke Casey2008-11-06 19:35:57 +0000
commit29691a3d36906c27b7fd7955184106bd6178cb83 (patch)
tree699b590bed419108729d19e519434225f78953c3 /OpenSim/Region/ClientStack/LindenUDP/Tests/BasicCircuitTests.cs
parentMantis#2566. Thank you kindly, Diva for a patch that: (diff)
downloadopensim-SC_OLD-29691a3d36906c27b7fd7955184106bd6178cb83.zip
opensim-SC_OLD-29691a3d36906c27b7fd7955184106bd6178cb83.tar.gz
opensim-SC_OLD-29691a3d36906c27b7fd7955184106bd6178cb83.tar.bz2
opensim-SC_OLD-29691a3d36906c27b7fd7955184106bd6178cb83.tar.xz
* Test to ensure that the udp server stays active after receiving a SocketException on BeginReceive
Diffstat (limited to 'OpenSim/Region/ClientStack/LindenUDP/Tests/BasicCircuitTests.cs')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/Tests/BasicCircuitTests.cs54
1 files changed, 42 insertions, 12 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/Tests/BasicCircuitTests.cs b/OpenSim/Region/ClientStack/LindenUDP/Tests/BasicCircuitTests.cs
index 6210d0c..dc1c63d 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/Tests/BasicCircuitTests.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/Tests/BasicCircuitTests.cs
@@ -26,6 +26,7 @@
26 */ 26 */
27 27
28using System.Net; 28using System.Net;
29using System.Threading;
29using log4net; 30using log4net;
30using Nini.Config; 31using Nini.Config;
31using NUnit.Framework; 32using NUnit.Framework;
@@ -81,7 +82,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
81 } 82 }
82 83
83 /// <summary> 84 /// <summary>
84 /// Set up a client for tests which aren't concerned with this process itself 85 /// Set up a client for tests which aren't concerned with this process itself and where only one client is being
86 /// tested
85 /// </summary> 87 /// </summary>
86 /// <param name="circuitCode"></param> 88 /// <param name="circuitCode"></param>
87 /// <param name="epSender"></param> 89 /// <param name="epSender"></param>
@@ -92,18 +94,34 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
92 { 94 {
93 UUID myAgentUuid = UUID.Parse("00000000-0000-0000-0000-000000000001"); 95 UUID myAgentUuid = UUID.Parse("00000000-0000-0000-0000-000000000001");
94 UUID mySessionUuid = UUID.Parse("00000000-0000-0000-0000-000000000002"); 96 UUID mySessionUuid = UUID.Parse("00000000-0000-0000-0000-000000000002");
95 97
98 AddClient(circuitCode, epSender, myAgentUuid, mySessionUuid, testLLUDPServer, acm);
99 }
100
101 /// <summary>
102 /// Set up a client for tests which aren't concerned with this process itself
103 /// </summary>
104 /// <param name="circuitCode"></param>
105 /// <param name="epSender"></param>
106 /// <param name="agentId"></param>
107 /// <param name="sessionId"></param>
108 /// <param name="testLLUDPServer"></param>
109 /// <param name="acm"></param>
110 protected void AddClient(
111 uint circuitCode, EndPoint epSender, UUID agentId, UUID sessionId,
112 TestLLUDPServer testLLUDPServer, AgentCircuitManager acm)
113 {
96 AgentCircuitData acd = new AgentCircuitData(); 114 AgentCircuitData acd = new AgentCircuitData();
97 acd.AgentID = myAgentUuid; 115 acd.AgentID = agentId;
98 acd.SessionID = mySessionUuid; 116 acd.SessionID = sessionId;
99 117
100 UseCircuitCodePacket uccp = new UseCircuitCodePacket(); 118 UseCircuitCodePacket uccp = new UseCircuitCodePacket();
101 119
102 UseCircuitCodePacket.CircuitCodeBlock uccpCcBlock 120 UseCircuitCodePacket.CircuitCodeBlock uccpCcBlock
103 = new OpenMetaverse.Packets.UseCircuitCodePacket.CircuitCodeBlock(); 121 = new OpenMetaverse.Packets.UseCircuitCodePacket.CircuitCodeBlock();
104 uccpCcBlock.Code = circuitCode; 122 uccpCcBlock.Code = circuitCode;
105 uccpCcBlock.ID = myAgentUuid; 123 uccpCcBlock.ID = agentId;
106 uccpCcBlock.SessionID = mySessionUuid; 124 uccpCcBlock.SessionID = sessionId;
107 uccp.CircuitCode = uccpCcBlock; 125 uccp.CircuitCode = uccpCcBlock;
108 126
109 acm.AddNewCircuit(circuitCode, acd); 127 acm.AddNewCircuit(circuitCode, acd);
@@ -181,7 +199,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
181 [Test] 199 [Test]
182 public void TestRemoveClient() 200 public void TestRemoveClient()
183 { 201 {
184 uint myCircuitCode = 123457; 202 uint myCircuitCode = 123457;
185 203
186 TestLLUDPServer testLLUDPServer; 204 TestLLUDPServer testLLUDPServer;
187 TestLLPacketServer testLLPacketServer; 205 TestLLPacketServer testLLPacketServer;
@@ -241,21 +259,33 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
241 [Test] 259 [Test]
242 public void TestExceptionOnBeginReceive() 260 public void TestExceptionOnBeginReceive()
243 { 261 {
244 /*
245 MockScene scene = new MockScene(); 262 MockScene scene = new MockScene();
246 263
247 uint circuitCodeA = 130000; 264 uint circuitCodeA = 130000;
248 EndPoint epA = new IPEndPoint(IPAddress.Loopback, 1300); 265 EndPoint epA = new IPEndPoint(IPAddress.Loopback, 1300);
266 UUID agentIdA = UUID.Parse("00000000-0000-0000-0000-000000001300");
267 UUID sessionIdA = UUID.Parse("00000000-0000-0000-0000-000000002300");
268
249 uint circuitCodeB = 130001; 269 uint circuitCodeB = 130001;
250 EndPoint epB = new IPEndPoint(IPAddress.Loopback, 1301); 270 EndPoint epB = new IPEndPoint(IPAddress.Loopback, 1301);
271 UUID agentIdB = UUID.Parse("00000000-0000-0000-0000-000000001301");
272 UUID sessionIdB = UUID.Parse("00000000-0000-0000-0000-000000002301");
251 273
252 TestLLUDPServer testLLUDPServer; 274 TestLLUDPServer testLLUDPServer;
253 TestLLPacketServer testLLPacketServer; 275 TestLLPacketServer testLLPacketServer;
254 AgentCircuitManager acm; 276 AgentCircuitManager acm;
255 SetupStack(scene, out testLLUDPServer, out testLLPacketServer, out acm); 277 SetupStack(scene, out testLLUDPServer, out testLLPacketServer, out acm);
256 AddClient(circuitCodeA, epA, testLLUDPServer, acm); 278 AddClient(circuitCodeA, epA, agentIdA, sessionIdA, testLLUDPServer, acm);
257 AddClient(circuitCodeB, epB, testLLUDPServer, acm); 279 AddClient(circuitCodeB, epB, agentIdB, sessionIdB, testLLUDPServer, acm);
258 */ 280
281 testLLUDPServer.LoadReceive(BuildTestObjectNamePacket(1, "packet1"), epA);
282 testLLUDPServer.LoadReceive(BuildTestObjectNamePacket(1, "packet2"), epB);
283 testLLUDPServer.LoadReceiveWithBeginException(epA);
284 testLLUDPServer.LoadReceive(BuildTestObjectNamePacket(2, "packet3"), epB);
285 testLLUDPServer.ReceiveData(null);
286
287 Assert.That(testLLPacketServer.GetTotalPacketsReceived(), Is.EqualTo(3));
288 Assert.That(testLLPacketServer.GetPacketsReceivedFor(PacketType.ObjectName), Is.EqualTo(3));
259 } 289 }
260 } 290 }
261} 291} \ No newline at end of file