aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/LindenUDP/Tests
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ClientStack/LindenUDP/Tests')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/Tests/BasicCircuitTests.cs52
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/Tests/MockScene.cs3
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/Tests/PacketHandlerTests.cs12
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/Tests/TestLLPacketServer.cs4
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/Tests/TestLLUDPServer.cs6
5 files changed, 39 insertions, 38 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/Tests/BasicCircuitTests.cs b/OpenSim/Region/ClientStack/LindenUDP/Tests/BasicCircuitTests.cs
index 9fb1041..daab84f 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/Tests/BasicCircuitTests.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/Tests/BasicCircuitTests.cs
@@ -54,7 +54,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
54 catch 54 catch
55 { 55 {
56 // I don't care, just leave log4net off 56 // I don't care, just leave log4net off
57 } 57 }
58 } 58 }
59 59
60 /// <summary> 60 /// <summary>
@@ -63,20 +63,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
63 /// <param name="scene"></param> 63 /// <param name="scene"></param>
64 /// <param name="testLLUDPServer"></param> 64 /// <param name="testLLUDPServer"></param>
65 /// <param name="testPacketServer"></param> 65 /// <param name="testPacketServer"></param>
66 /// <param name="acm">Agent circuit manager used in setting up the stack</param> 66 /// <param name="acm">Agent circuit manager used in setting up the stack</param>
67 protected void SetupStack( 67 protected void SetupStack(
68 IScene scene, out TestLLUDPServer testLLUDPServer, out TestLLPacketServer testPacketServer, 68 IScene scene, out TestLLUDPServer testLLUDPServer, out TestLLPacketServer testPacketServer,
69 out AgentCircuitManager acm) 69 out AgentCircuitManager acm)
70 { 70 {
71 IConfigSource configSource = new IniConfigSource(); 71 IConfigSource configSource = new IniConfigSource();
72 ClientStackUserSettings userSettings = new ClientStackUserSettings(); 72 ClientStackUserSettings userSettings = new ClientStackUserSettings();
73 testLLUDPServer = new TestLLUDPServer(); 73 testLLUDPServer = new TestLLUDPServer();
74 acm = new AgentCircuitManager(); 74 acm = new AgentCircuitManager();
75 75
76 uint port = 666; 76 uint port = 666;
77 testLLUDPServer.Initialise(null, ref port, 0, false, configSource, acm); 77 testLLUDPServer.Initialise(null, ref port, 0, false, configSource, acm);
78 testPacketServer = new TestLLPacketServer(testLLUDPServer, userSettings); 78 testPacketServer = new TestLLPacketServer(testLLUDPServer, userSettings);
79 testLLUDPServer.LocalScene = scene; 79 testLLUDPServer.LocalScene = scene;
80 } 80 }
81 81
82 /// <summary> 82 /// <summary>
@@ -124,7 +124,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
124 124
125 acm.AddNewCircuit(circuitCode, acd); 125 acm.AddNewCircuit(circuitCode, acd);
126 126
127 testLLUDPServer.LoadReceive(uccp, epSender); 127 testLLUDPServer.LoadReceive(uccp, epSender);
128 testLLUDPServer.ReceiveData(null); 128 testLLUDPServer.ReceiveData(null);
129 } 129 }
130 130
@@ -142,15 +142,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
142 onp.ObjectData = new ObjectNamePacket.ObjectDataBlock[] { odb }; 142 onp.ObjectData = new ObjectNamePacket.ObjectDataBlock[] { odb };
143 onp.Header.Zerocoded = false; 143 onp.Header.Zerocoded = false;
144 144
145 return onp; 145 return onp;
146 } 146 }
147 147
148 /// <summary> 148 /// <summary>
149 /// Test adding a client to the stack 149 /// Test adding a client to the stack
150 /// </summary> 150 /// </summary>
151 [Test, LongRunning] 151 [Test, LongRunning]
152 public void TestAddClient() 152 public void TestAddClient()
153 { 153 {
154 TestHelper.InMethod(); 154 TestHelper.InMethod();
155 155
156 uint myCircuitCode = 123456; 156 uint myCircuitCode = 123456;
@@ -177,7 +177,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
177 177
178 EndPoint testEp = new IPEndPoint(IPAddress.Loopback, 999); 178 EndPoint testEp = new IPEndPoint(IPAddress.Loopback, 999);
179 179
180 testLLUDPServer.LoadReceive(uccp, testEp); 180 testLLUDPServer.LoadReceive(uccp, testEp);
181 testLLUDPServer.ReceiveData(null); 181 testLLUDPServer.ReceiveData(null);
182 182
183 // Circuit shouildn't exist since the circuit manager doesn't know about this circuit for authentication yet 183 // Circuit shouildn't exist since the circuit manager doesn't know about this circuit for authentication yet
@@ -185,8 +185,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
185 185
186 acm.AddNewCircuit(myCircuitCode, acd); 186 acm.AddNewCircuit(myCircuitCode, acd);
187 187
188 testLLUDPServer.LoadReceive(uccp, testEp); 188 testLLUDPServer.LoadReceive(uccp, testEp);
189 testLLUDPServer.ReceiveData(null); 189 testLLUDPServer.ReceiveData(null);
190 190
191 // Should succeed now 191 // Should succeed now
192 Assert.IsTrue(testLLUDPServer.HasCircuit(myCircuitCode)); 192 Assert.IsTrue(testLLUDPServer.HasCircuit(myCircuitCode));
@@ -196,24 +196,24 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
196 /// <summary> 196 /// <summary>
197 /// Test removing a client from the stack 197 /// Test removing a client from the stack
198 /// </summary> 198 /// </summary>
199 [Test] 199 [Test]
200 public void TestRemoveClient() 200 public void TestRemoveClient()
201 { 201 {
202 TestHelper.InMethod(); 202 TestHelper.InMethod();
203 203
204 uint myCircuitCode = 123457; 204 uint myCircuitCode = 123457;
205 205
206 TestLLUDPServer testLLUDPServer; 206 TestLLUDPServer testLLUDPServer;
207 TestLLPacketServer testLLPacketServer; 207 TestLLPacketServer testLLPacketServer;
208 AgentCircuitManager acm; 208 AgentCircuitManager acm;
209 SetupStack(new MockScene(), out testLLUDPServer, out testLLPacketServer, out acm); 209 SetupStack(new MockScene(), out testLLUDPServer, out testLLPacketServer, out acm);
210 AddClient(myCircuitCode, new IPEndPoint(IPAddress.Loopback, 1000), testLLUDPServer, acm); 210 AddClient(myCircuitCode, new IPEndPoint(IPAddress.Loopback, 1000), testLLUDPServer, acm);
211 211
212 testLLUDPServer.RemoveClientCircuit(myCircuitCode); 212 testLLUDPServer.RemoveClientCircuit(myCircuitCode);
213 Assert.IsFalse(testLLUDPServer.HasCircuit(myCircuitCode)); 213 Assert.IsFalse(testLLUDPServer.HasCircuit(myCircuitCode));
214 214
215 // Check that removing a non-existant circuit doesn't have any bad effects 215 // Check that removing a non-existant circuit doesn't have any bad effects
216 testLLUDPServer.RemoveClientCircuit(101); 216 testLLUDPServer.RemoveClientCircuit(101);
217 Assert.IsFalse(testLLUDPServer.HasCircuit(101)); 217 Assert.IsFalse(testLLUDPServer.HasCircuit(101));
218 } 218 }
219 219
@@ -232,8 +232,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
232 TestLLUDPServer testLLUDPServer; 232 TestLLUDPServer testLLUDPServer;
233 TestLLPacketServer testLLPacketServer; 233 TestLLPacketServer testLLPacketServer;
234 AgentCircuitManager acm; 234 AgentCircuitManager acm;
235 SetupStack(scene, out testLLUDPServer, out testLLPacketServer, out acm); 235 SetupStack(scene, out testLLUDPServer, out testLLPacketServer, out acm);
236 AddClient(myCircuitCode, testEp, testLLUDPServer, acm); 236 AddClient(myCircuitCode, testEp, testLLUDPServer, acm);
237 237
238 byte[] data = new byte[] { 0x01, 0x02, 0x03, 0x04 }; 238 byte[] data = new byte[] { 0x01, 0x02, 0x03, 0x04 };
239 239
@@ -252,7 +252,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
252 testLLUDPServer.LoadReceive(BuildTestObjectNamePacket(1, "helloooo"), testEp); 252 testLLUDPServer.LoadReceive(BuildTestObjectNamePacket(1, "helloooo"), testEp);
253 testLLUDPServer.ReceiveData(null); 253 testLLUDPServer.ReceiveData(null);
254 254
255 Assert.That(testLLPacketServer.GetTotalPacketsReceived(), Is.EqualTo(1)); 255 Assert.That(testLLPacketServer.GetTotalPacketsReceived(), Is.EqualTo(1));
256 Assert.That(testLLPacketServer.GetPacketsReceivedFor(PacketType.ObjectName), Is.EqualTo(1)); 256 Assert.That(testLLPacketServer.GetPacketsReceivedFor(PacketType.ObjectName), Is.EqualTo(1));
257 } 257 }
258 258
@@ -270,17 +270,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
270 uint circuitCodeA = 130000; 270 uint circuitCodeA = 130000;
271 EndPoint epA = new IPEndPoint(IPAddress.Loopback, 1300); 271 EndPoint epA = new IPEndPoint(IPAddress.Loopback, 1300);
272 UUID agentIdA = UUID.Parse("00000000-0000-0000-0000-000000001300"); 272 UUID agentIdA = UUID.Parse("00000000-0000-0000-0000-000000001300");
273 UUID sessionIdA = UUID.Parse("00000000-0000-0000-0000-000000002300"); 273 UUID sessionIdA = UUID.Parse("00000000-0000-0000-0000-000000002300");
274 274
275 uint circuitCodeB = 130001; 275 uint circuitCodeB = 130001;
276 EndPoint epB = new IPEndPoint(IPAddress.Loopback, 1301); 276 EndPoint epB = new IPEndPoint(IPAddress.Loopback, 1301);
277 UUID agentIdB = UUID.Parse("00000000-0000-0000-0000-000000001301"); 277 UUID agentIdB = UUID.Parse("00000000-0000-0000-0000-000000001301");
278 UUID sessionIdB = UUID.Parse("00000000-0000-0000-0000-000000002301"); 278 UUID sessionIdB = UUID.Parse("00000000-0000-0000-0000-000000002301");
279 279
280 TestLLUDPServer testLLUDPServer; 280 TestLLUDPServer testLLUDPServer;
281 TestLLPacketServer testLLPacketServer; 281 TestLLPacketServer testLLPacketServer;
282 AgentCircuitManager acm; 282 AgentCircuitManager acm;
283 SetupStack(scene, out testLLUDPServer, out testLLPacketServer, out acm); 283 SetupStack(scene, out testLLUDPServer, out testLLPacketServer, out acm);
284 AddClient(circuitCodeA, epA, agentIdA, sessionIdA, testLLUDPServer, acm); 284 AddClient(circuitCodeA, epA, agentIdA, sessionIdA, testLLUDPServer, acm);
285 AddClient(circuitCodeB, epB, agentIdB, sessionIdB, testLLUDPServer, acm); 285 AddClient(circuitCodeB, epB, agentIdB, sessionIdB, testLLUDPServer, acm);
286 286
@@ -292,8 +292,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
292 292
293 Assert.IsFalse(testLLUDPServer.HasCircuit(circuitCodeA)); 293 Assert.IsFalse(testLLUDPServer.HasCircuit(circuitCodeA));
294 294
295 Assert.That(testLLPacketServer.GetTotalPacketsReceived(), Is.EqualTo(3)); 295 Assert.That(testLLPacketServer.GetTotalPacketsReceived(), Is.EqualTo(3));
296 Assert.That(testLLPacketServer.GetPacketsReceivedFor(PacketType.ObjectName), Is.EqualTo(3)); 296 Assert.That(testLLPacketServer.GetPacketsReceivedFor(PacketType.ObjectName), Is.EqualTo(3));
297 } 297 }
298 } 298 }
299} 299}
diff --git a/OpenSim/Region/ClientStack/LindenUDP/Tests/MockScene.cs b/OpenSim/Region/ClientStack/LindenUDP/Tests/MockScene.cs
index c831f68..34c21aa 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/Tests/MockScene.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/Tests/MockScene.cs
@@ -28,6 +28,7 @@
28using OpenMetaverse; 28using OpenMetaverse;
29using OpenSim.Framework; 29using OpenSim.Framework;
30using OpenSim.Region.Framework.Scenes; 30using OpenSim.Region.Framework.Scenes;
31using GridRegion = OpenSim.Services.Interfaces.GridRegion;
31 32
32namespace OpenSim.Region.ClientStack.LindenUDP.Tests 33namespace OpenSim.Region.ClientStack.LindenUDP.Tests
33{ 34{
@@ -58,7 +59,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
58 59
59 public override void RemoveClient(UUID agentID) {} 60 public override void RemoveClient(UUID agentID) {}
60 public override void CloseAllAgents(uint circuitcode) {} 61 public override void CloseAllAgents(uint circuitcode) {}
61 public override bool OtherRegionUp(RegionInfo thisRegion) { return false; } 62 public override void OtherRegionUp(GridRegion otherRegion) { }
62 63
63 /// <summary> 64 /// <summary>
64 /// Doesn't really matter what the call is - we're using this to test that a packet has actually been received 65 /// Doesn't really matter what the call is - we're using this to test that a packet has actually been received
diff --git a/OpenSim/Region/ClientStack/LindenUDP/Tests/PacketHandlerTests.cs b/OpenSim/Region/ClientStack/LindenUDP/Tests/PacketHandlerTests.cs
index 8b11ccc..cde155b 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/Tests/PacketHandlerTests.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/Tests/PacketHandlerTests.cs
@@ -45,7 +45,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
45 [Test] 45 [Test]
46 /// <summary> 46 /// <summary>
47 /// More a placeholder, really 47 /// More a placeholder, really
48 /// </summary> 48 /// </summary>
49 public void InPacketTest() 49 public void InPacketTest()
50 { 50 {
51 TestHelper.InMethod(); 51 TestHelper.InMethod();
@@ -87,20 +87,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
87 /// <param name="scene"></param> 87 /// <param name="scene"></param>
88 /// <param name="testLLUDPServer"></param> 88 /// <param name="testLLUDPServer"></param>
89 /// <param name="testPacketServer"></param> 89 /// <param name="testPacketServer"></param>
90 /// <param name="acm">Agent circuit manager used in setting up the stack</param> 90 /// <param name="acm">Agent circuit manager used in setting up the stack</param>
91 protected void SetupStack( 91 protected void SetupStack(
92 IScene scene, out TestLLUDPServer testLLUDPServer, out TestLLPacketServer testPacketServer, 92 IScene scene, out TestLLUDPServer testLLUDPServer, out TestLLPacketServer testPacketServer,
93 out AgentCircuitManager acm) 93 out AgentCircuitManager acm)
94 { 94 {
95 IConfigSource configSource = new IniConfigSource(); 95 IConfigSource configSource = new IniConfigSource();
96 ClientStackUserSettings userSettings = new ClientStackUserSettings(); 96 ClientStackUserSettings userSettings = new ClientStackUserSettings();
97 testLLUDPServer = new TestLLUDPServer(); 97 testLLUDPServer = new TestLLUDPServer();
98 acm = new AgentCircuitManager(); 98 acm = new AgentCircuitManager();
99 99
100 uint port = 666; 100 uint port = 666;
101 testLLUDPServer.Initialise(null, ref port, 0, false, configSource, acm); 101 testLLUDPServer.Initialise(null, ref port, 0, false, configSource, acm);
102 testPacketServer = new TestLLPacketServer(testLLUDPServer, userSettings); 102 testPacketServer = new TestLLPacketServer(testLLUDPServer, userSettings);
103 testLLUDPServer.LocalScene = scene; 103 testLLUDPServer.LocalScene = scene;
104 } 104 }
105 } 105 }
106} 106}
diff --git a/OpenSim/Region/ClientStack/LindenUDP/Tests/TestLLPacketServer.cs b/OpenSim/Region/ClientStack/LindenUDP/Tests/TestLLPacketServer.cs
index d055969..1fba847 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/Tests/TestLLPacketServer.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/Tests/TestLLPacketServer.cs
@@ -31,7 +31,7 @@ using OpenMetaverse.Packets;
31namespace OpenSim.Region.ClientStack.LindenUDP.Tests 31namespace OpenSim.Region.ClientStack.LindenUDP.Tests
32{ 32{
33 public class TestLLPacketServer : LLPacketServer 33 public class TestLLPacketServer : LLPacketServer
34 { 34 {
35 /// <summary> 35 /// <summary>
36 /// Record counts of packets received 36 /// Record counts of packets received
37 /// </summary> 37 /// </summary>
@@ -49,7 +49,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
49 m_packetsReceived[packet.Type]++; 49 m_packetsReceived[packet.Type]++;
50 else 50 else
51 m_packetsReceived[packet.Type] = 1; 51 m_packetsReceived[packet.Type] = 1;
52 } 52 }
53 53
54 public int GetTotalPacketsReceived() 54 public int GetTotalPacketsReceived()
55 { 55 {
diff --git a/OpenSim/Region/ClientStack/LindenUDP/Tests/TestLLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/Tests/TestLLUDPServer.cs
index 1dffefb..f98586d 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/Tests/TestLLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/Tests/TestLLUDPServer.cs
@@ -66,7 +66,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
66 ChunkSenderTuple tuple = m_chunksToLoad.Dequeue(); 66 ChunkSenderTuple tuple = m_chunksToLoad.Dequeue();
67 RecvBuffer = tuple.Data; 67 RecvBuffer = tuple.Data;
68 numBytes = tuple.Data.Length; 68 numBytes = tuple.Data.Length;
69 epSender = tuple.Sender; 69 epSender = tuple.Sender;
70 70
71 return true; 71 return true;
72 } 72 }
@@ -114,7 +114,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
114 { 114 {
115 while (m_chunksToLoad.Count > 0) 115 while (m_chunksToLoad.Count > 0)
116 OnReceivedData(result); 116 OnReceivedData(result);
117 } 117 }
118 118
119 /// <summary> 119 /// <summary>
120 /// Has a circuit with the given code been established? 120 /// Has a circuit with the given code been established?
@@ -134,7 +134,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
134 /// Record the data and sender tuple 134 /// Record the data and sender tuple
135 /// </summary> 135 /// </summary>
136 public class ChunkSenderTuple 136 public class ChunkSenderTuple
137 { 137 {
138 public byte[] Data; 138 public byte[] Data;
139 public EndPoint Sender; 139 public EndPoint Sender;
140 public bool BeginReceiveException; 140 public bool BeginReceiveException;