diff options
author | Justin Clarke Casey | 2008-11-06 18:27:56 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-11-06 18:27:56 +0000 |
commit | 8477aab8e02b2f829d4946e051d36f11ae2e4839 (patch) | |
tree | 3e2131a956796ad6546d38c4e34d09ca351a4661 /OpenSim/Region/ClientStack/LindenUDP/Tests/BasicCircuitTests.cs | |
parent | From: arthursv@linux.vnet.ibm.com (diff) | |
download | opensim-SC_OLD-8477aab8e02b2f829d4946e051d36f11ae2e4839.zip opensim-SC_OLD-8477aab8e02b2f829d4946e051d36f11ae2e4839.tar.gz opensim-SC_OLD-8477aab8e02b2f829d4946e051d36f11ae2e4839.tar.bz2 opensim-SC_OLD-8477aab8e02b2f829d4946e051d36f11ae2e4839.tar.xz |
* refactor: factor out test packet send method in client stack unit tests
Diffstat (limited to 'OpenSim/Region/ClientStack/LindenUDP/Tests/BasicCircuitTests.cs')
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/Tests/BasicCircuitTests.cs | 50 |
1 files changed, 42 insertions, 8 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/Tests/BasicCircuitTests.cs b/OpenSim/Region/ClientStack/LindenUDP/Tests/BasicCircuitTests.cs index d55f423..6210d0c 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/Tests/BasicCircuitTests.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/Tests/BasicCircuitTests.cs | |||
@@ -113,6 +113,23 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests | |||
113 | } | 113 | } |
114 | 114 | ||
115 | /// <summary> | 115 | /// <summary> |
116 | /// Build an object name packet for test purposes | ||
117 | /// </summary> | ||
118 | /// <param name="objectLocalId"></param> | ||
119 | /// <param name="objectName"></param> | ||
120 | protected ObjectNamePacket BuildTestObjectNamePacket(uint objectLocalId, string objectName) | ||
121 | { | ||
122 | ObjectNamePacket onp = new ObjectNamePacket(); | ||
123 | ObjectNamePacket.ObjectDataBlock odb = new ObjectNamePacket.ObjectDataBlock(); | ||
124 | odb.LocalID = objectLocalId; | ||
125 | odb.Name = Utils.StringToBytes(objectName); | ||
126 | onp.ObjectData = new ObjectNamePacket.ObjectDataBlock[] { odb }; | ||
127 | onp.Header.Zerocoded = false; | ||
128 | |||
129 | return onp; | ||
130 | } | ||
131 | |||
132 | /// <summary> | ||
116 | /// Test adding a client to the stack | 133 | /// Test adding a client to the stack |
117 | /// </summary> | 134 | /// </summary> |
118 | [Test] | 135 | [Test] |
@@ -209,19 +226,36 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests | |||
209 | 226 | ||
210 | // Check that sending a valid packet to same circuit still succeeds | 227 | // Check that sending a valid packet to same circuit still succeeds |
211 | Assert.That(scene.ObjectNameCallsReceived, Is.EqualTo(0)); | 228 | Assert.That(scene.ObjectNameCallsReceived, Is.EqualTo(0)); |
212 | |||
213 | ObjectNamePacket onp = new ObjectNamePacket(); | ||
214 | ObjectNamePacket.ObjectDataBlock odb = new ObjectNamePacket.ObjectDataBlock(); | ||
215 | odb.LocalID = 1; | ||
216 | odb.Name = Utils.StringToBytes("helloooo"); | ||
217 | onp.ObjectData = new ObjectNamePacket.ObjectDataBlock[] { odb }; | ||
218 | onp.Header.Zerocoded = false; | ||
219 | 229 | ||
220 | testLLUDPServer.LoadReceive(onp, testEp); | 230 | testLLUDPServer.LoadReceive(BuildTestObjectNamePacket(1, "helloooo"), testEp); |
221 | testLLUDPServer.ReceiveData(null); | 231 | testLLUDPServer.ReceiveData(null); |
222 | 232 | ||
223 | Assert.That(testLLPacketServer.GetTotalPacketsReceived(), Is.EqualTo(1)); | 233 | Assert.That(testLLPacketServer.GetTotalPacketsReceived(), Is.EqualTo(1)); |
224 | Assert.That(testLLPacketServer.GetPacketsReceivedFor(PacketType.ObjectName), Is.EqualTo(1)); | 234 | Assert.That(testLLPacketServer.GetPacketsReceivedFor(PacketType.ObjectName), Is.EqualTo(1)); |
225 | } | 235 | } |
236 | |||
237 | /// <summary> | ||
238 | /// Test that the stack continues to work even if some client has caused a | ||
239 | /// SocketException on Socket.BeginReceive() | ||
240 | /// </summary> | ||
241 | [Test] | ||
242 | public void TestExceptionOnBeginReceive() | ||
243 | { | ||
244 | /* | ||
245 | MockScene scene = new MockScene(); | ||
246 | |||
247 | uint circuitCodeA = 130000; | ||
248 | EndPoint epA = new IPEndPoint(IPAddress.Loopback, 1300); | ||
249 | uint circuitCodeB = 130001; | ||
250 | EndPoint epB = new IPEndPoint(IPAddress.Loopback, 1301); | ||
251 | |||
252 | TestLLUDPServer testLLUDPServer; | ||
253 | TestLLPacketServer testLLPacketServer; | ||
254 | AgentCircuitManager acm; | ||
255 | SetupStack(scene, out testLLUDPServer, out testLLPacketServer, out acm); | ||
256 | AddClient(circuitCodeA, epA, testLLUDPServer, acm); | ||
257 | AddClient(circuitCodeB, epB, testLLUDPServer, acm); | ||
258 | */ | ||
259 | } | ||
226 | } | 260 | } |
227 | } | 261 | } |