aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/Tests/BasicCircuitTests.cs343
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/Tests/MockScene.cs10
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/Tests/PacketHandlerTests.cs121
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/Tests/TestLLPacketServer.cs72
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/Tests/TestLLUDPServer.cs79
-rw-r--r--prebuild.xml20
6 files changed, 291 insertions, 354 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Tests/BasicCircuitTests.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/BasicCircuitTests.cs
index daab84f..b8a4e8e 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/Tests/BasicCircuitTests.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/Tests/BasicCircuitTests.cs
@@ -29,7 +29,6 @@ using System.Net;
29using log4net.Config; 29using log4net.Config;
30using Nini.Config; 30using Nini.Config;
31using NUnit.Framework; 31using NUnit.Framework;
32using NUnit.Framework.SyntaxHelpers;
33using OpenMetaverse; 32using OpenMetaverse;
34using OpenMetaverse.Packets; 33using OpenMetaverse.Packets;
35using OpenSim.Framework; 34using OpenSim.Framework;
@@ -57,27 +56,27 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
57 } 56 }
58 } 57 }
59 58
60 /// <summary> 59// /// <summary>
61 /// Add a client for testing 60// /// Add a client for testing
62 /// </summary> 61// /// </summary>
63 /// <param name="scene"></param> 62// /// <param name="scene"></param>
64 /// <param name="testLLUDPServer"></param> 63// /// <param name="testLLUDPServer"></param>
65 /// <param name="testPacketServer"></param> 64// /// <param name="testPacketServer"></param>
66 /// <param name="acm">Agent circuit manager used in setting up the stack</param> 65// /// <param name="acm">Agent circuit manager used in setting up the stack</param>
67 protected void SetupStack( 66// protected void SetupStack(
68 IScene scene, out TestLLUDPServer testLLUDPServer, out TestLLPacketServer testPacketServer, 67// IScene scene, out TestLLUDPServer testLLUDPServer, out TestLLPacketServer testPacketServer,
69 out AgentCircuitManager acm) 68// out AgentCircuitManager acm)
70 { 69// {
71 IConfigSource configSource = new IniConfigSource(); 70// IConfigSource configSource = new IniConfigSource();
72 ClientStackUserSettings userSettings = new ClientStackUserSettings(); 71// ClientStackUserSettings userSettings = new ClientStackUserSettings();
73 testLLUDPServer = new TestLLUDPServer(); 72// testLLUDPServer = new TestLLUDPServer();
74 acm = new AgentCircuitManager(); 73// acm = new AgentCircuitManager();
75 74//
76 uint port = 666; 75// uint port = 666;
77 testLLUDPServer.Initialise(null, ref port, 0, false, configSource, acm); 76// testLLUDPServer.Initialise(null, ref port, 0, false, configSource, acm);
78 testPacketServer = new TestLLPacketServer(testLLUDPServer, userSettings); 77// testPacketServer = new TestLLPacketServer(testLLUDPServer, userSettings);
79 testLLUDPServer.LocalScene = scene; 78// testLLUDPServer.LocalScene = scene;
80 } 79// }
81 80
82 /// <summary> 81 /// <summary>
83 /// Set up a client for tests which aren't concerned with this process itself and where only one client is being 82 /// Set up a client for tests which aren't concerned with this process itself and where only one client is being
@@ -145,155 +144,155 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
145 return onp; 144 return onp;
146 } 145 }
147 146
148 /// <summary> 147// /// <summary>
149 /// Test adding a client to the stack 148// /// Test adding a client to the stack
150 /// </summary> 149// /// </summary>
151 [Test, LongRunning] 150// [Test, LongRunning]
152 public void TestAddClient() 151// public void TestAddClient()
153 { 152// {
154 TestHelper.InMethod(); 153// TestHelper.InMethod();
155 154//
156 uint myCircuitCode = 123456; 155// uint myCircuitCode = 123456;
157 UUID myAgentUuid = UUID.Parse("00000000-0000-0000-0000-000000000001"); 156// UUID myAgentUuid = UUID.Parse("00000000-0000-0000-0000-000000000001");
158 UUID mySessionUuid = UUID.Parse("00000000-0000-0000-0000-000000000002"); 157// UUID mySessionUuid = UUID.Parse("00000000-0000-0000-0000-000000000002");
159 158//
160 TestLLUDPServer testLLUDPServer; 159// TestLLUDPServer testLLUDPServer;
161 TestLLPacketServer testLLPacketServer; 160// TestLLPacketServer testLLPacketServer;
162 AgentCircuitManager acm; 161// AgentCircuitManager acm;
163 SetupStack(new MockScene(), out testLLUDPServer, out testLLPacketServer, out acm); 162// SetupStack(new MockScene(), out testLLUDPServer, out testLLPacketServer, out acm);
164 163//
165 AgentCircuitData acd = new AgentCircuitData(); 164// AgentCircuitData acd = new AgentCircuitData();
166 acd.AgentID = myAgentUuid; 165// acd.AgentID = myAgentUuid;
167 acd.SessionID = mySessionUuid; 166// acd.SessionID = mySessionUuid;
168 167//
169 UseCircuitCodePacket uccp = new UseCircuitCodePacket(); 168// UseCircuitCodePacket uccp = new UseCircuitCodePacket();
170 169//
171 UseCircuitCodePacket.CircuitCodeBlock uccpCcBlock 170// UseCircuitCodePacket.CircuitCodeBlock uccpCcBlock
172 = new UseCircuitCodePacket.CircuitCodeBlock(); 171// = new UseCircuitCodePacket.CircuitCodeBlock();
173 uccpCcBlock.Code = myCircuitCode; 172// uccpCcBlock.Code = myCircuitCode;
174 uccpCcBlock.ID = myAgentUuid; 173// uccpCcBlock.ID = myAgentUuid;
175 uccpCcBlock.SessionID = mySessionUuid; 174// uccpCcBlock.SessionID = mySessionUuid;
176 uccp.CircuitCode = uccpCcBlock; 175// uccp.CircuitCode = uccpCcBlock;
177 176//
178 EndPoint testEp = new IPEndPoint(IPAddress.Loopback, 999); 177// EndPoint testEp = new IPEndPoint(IPAddress.Loopback, 999);
179 178//
180 testLLUDPServer.LoadReceive(uccp, testEp); 179// testLLUDPServer.LoadReceive(uccp, testEp);
181 testLLUDPServer.ReceiveData(null); 180// testLLUDPServer.ReceiveData(null);
182 181//
183 // Circuit shouildn't exist since the circuit manager doesn't know about this circuit for authentication yet 182// // Circuit shouildn't exist since the circuit manager doesn't know about this circuit for authentication yet
184 Assert.IsFalse(testLLUDPServer.HasCircuit(myCircuitCode)); 183// Assert.IsFalse(testLLUDPServer.HasCircuit(myCircuitCode));
185 184//
186 acm.AddNewCircuit(myCircuitCode, acd); 185// acm.AddNewCircuit(myCircuitCode, acd);
187 186//
188 testLLUDPServer.LoadReceive(uccp, testEp); 187// testLLUDPServer.LoadReceive(uccp, testEp);
189 testLLUDPServer.ReceiveData(null); 188// testLLUDPServer.ReceiveData(null);
190 189//
191 // Should succeed now 190// // Should succeed now
192 Assert.IsTrue(testLLUDPServer.HasCircuit(myCircuitCode)); 191// Assert.IsTrue(testLLUDPServer.HasCircuit(myCircuitCode));
193 Assert.IsFalse(testLLUDPServer.HasCircuit(101)); 192// Assert.IsFalse(testLLUDPServer.HasCircuit(101));
194 } 193// }
195 194//
196 /// <summary> 195// /// <summary>
197 /// Test removing a client from the stack 196// /// Test removing a client from the stack
198 /// </summary> 197// /// </summary>
199 [Test] 198// [Test]
200 public void TestRemoveClient() 199// public void TestRemoveClient()
201 { 200// {
202 TestHelper.InMethod(); 201// TestHelper.InMethod();
203 202//
204 uint myCircuitCode = 123457; 203// uint myCircuitCode = 123457;
205 204//
206 TestLLUDPServer testLLUDPServer; 205// TestLLUDPServer testLLUDPServer;
207 TestLLPacketServer testLLPacketServer; 206// TestLLPacketServer testLLPacketServer;
208 AgentCircuitManager acm; 207// AgentCircuitManager acm;
209 SetupStack(new MockScene(), out testLLUDPServer, out testLLPacketServer, out acm); 208// SetupStack(new MockScene(), out testLLUDPServer, out testLLPacketServer, out acm);
210 AddClient(myCircuitCode, new IPEndPoint(IPAddress.Loopback, 1000), testLLUDPServer, acm); 209// AddClient(myCircuitCode, new IPEndPoint(IPAddress.Loopback, 1000), testLLUDPServer, acm);
211 210//
212 testLLUDPServer.RemoveClientCircuit(myCircuitCode); 211// testLLUDPServer.RemoveClientCircuit(myCircuitCode);
213 Assert.IsFalse(testLLUDPServer.HasCircuit(myCircuitCode)); 212// Assert.IsFalse(testLLUDPServer.HasCircuit(myCircuitCode));
214 213//
215 // Check that removing a non-existant circuit doesn't have any bad effects 214// // Check that removing a non-existant circuit doesn't have any bad effects
216 testLLUDPServer.RemoveClientCircuit(101); 215// testLLUDPServer.RemoveClientCircuit(101);
217 Assert.IsFalse(testLLUDPServer.HasCircuit(101)); 216// Assert.IsFalse(testLLUDPServer.HasCircuit(101));
218 } 217// }
219 218//
220 /// <summary> 219// /// <summary>
221 /// Make sure that the client stack reacts okay to malformed packets 220// /// Make sure that the client stack reacts okay to malformed packets
222 /// </summary> 221// /// </summary>
223 [Test] 222// [Test]
224 public void TestMalformedPacketSend() 223// public void TestMalformedPacketSend()
225 { 224// {
226 TestHelper.InMethod(); 225// TestHelper.InMethod();
227 226//
228 uint myCircuitCode = 123458; 227// uint myCircuitCode = 123458;
229 EndPoint testEp = new IPEndPoint(IPAddress.Loopback, 1001); 228// EndPoint testEp = new IPEndPoint(IPAddress.Loopback, 1001);
230 MockScene scene = new MockScene(); 229// MockScene scene = new MockScene();
231 230//
232 TestLLUDPServer testLLUDPServer; 231// TestLLUDPServer testLLUDPServer;
233 TestLLPacketServer testLLPacketServer; 232// TestLLPacketServer testLLPacketServer;
234 AgentCircuitManager acm; 233// AgentCircuitManager acm;
235 SetupStack(scene, out testLLUDPServer, out testLLPacketServer, out acm); 234// SetupStack(scene, out testLLUDPServer, out testLLPacketServer, out acm);
236 AddClient(myCircuitCode, testEp, testLLUDPServer, acm); 235// AddClient(myCircuitCode, testEp, testLLUDPServer, acm);
237 236//
238 byte[] data = new byte[] { 0x01, 0x02, 0x03, 0x04 }; 237// byte[] data = new byte[] { 0x01, 0x02, 0x03, 0x04 };
239 238//
240 // Send two garbled 'packets' in succession 239// // Send two garbled 'packets' in succession
241 testLLUDPServer.LoadReceive(data, testEp); 240// testLLUDPServer.LoadReceive(data, testEp);
242 testLLUDPServer.LoadReceive(data, testEp); 241// testLLUDPServer.LoadReceive(data, testEp);
243 testLLUDPServer.ReceiveData(null); 242// testLLUDPServer.ReceiveData(null);
244 243//
245 // Check that we are still here 244// // Check that we are still here
246 Assert.IsTrue(testLLUDPServer.HasCircuit(myCircuitCode)); 245// Assert.IsTrue(testLLUDPServer.HasCircuit(myCircuitCode));
247 Assert.That(testLLPacketServer.GetTotalPacketsReceived(), Is.EqualTo(0)); 246// Assert.That(testLLPacketServer.GetTotalPacketsReceived(), Is.EqualTo(0));
248 247//
249 // Check that sending a valid packet to same circuit still succeeds 248// // Check that sending a valid packet to same circuit still succeeds
250 Assert.That(scene.ObjectNameCallsReceived, Is.EqualTo(0)); 249// Assert.That(scene.ObjectNameCallsReceived, Is.EqualTo(0));
251 250//
252 testLLUDPServer.LoadReceive(BuildTestObjectNamePacket(1, "helloooo"), testEp); 251// testLLUDPServer.LoadReceive(BuildTestObjectNamePacket(1, "helloooo"), testEp);
253 testLLUDPServer.ReceiveData(null); 252// testLLUDPServer.ReceiveData(null);
254 253//
255 Assert.That(testLLPacketServer.GetTotalPacketsReceived(), Is.EqualTo(1)); 254// Assert.That(testLLPacketServer.GetTotalPacketsReceived(), Is.EqualTo(1));
256 Assert.That(testLLPacketServer.GetPacketsReceivedFor(PacketType.ObjectName), Is.EqualTo(1)); 255// Assert.That(testLLPacketServer.GetPacketsReceivedFor(PacketType.ObjectName), Is.EqualTo(1));
257 } 256// }
258 257//
259 /// <summary> 258// /// <summary>
260 /// Test that the stack continues to work even if some client has caused a 259// /// Test that the stack continues to work even if some client has caused a
261 /// SocketException on Socket.BeginReceive() 260// /// SocketException on Socket.BeginReceive()
262 /// </summary> 261// /// </summary>
263 [Test] 262// [Test]
264 public void TestExceptionOnBeginReceive() 263// public void TestExceptionOnBeginReceive()
265 { 264// {
266 TestHelper.InMethod(); 265// TestHelper.InMethod();
267 266//
268 MockScene scene = new MockScene(); 267// MockScene scene = new MockScene();
269 268//
270 uint circuitCodeA = 130000; 269// uint circuitCodeA = 130000;
271 EndPoint epA = new IPEndPoint(IPAddress.Loopback, 1300); 270// EndPoint epA = new IPEndPoint(IPAddress.Loopback, 1300);
272 UUID agentIdA = UUID.Parse("00000000-0000-0000-0000-000000001300"); 271// UUID agentIdA = UUID.Parse("00000000-0000-0000-0000-000000001300");
273 UUID sessionIdA = UUID.Parse("00000000-0000-0000-0000-000000002300"); 272// UUID sessionIdA = UUID.Parse("00000000-0000-0000-0000-000000002300");
274 273//
275 uint circuitCodeB = 130001; 274// uint circuitCodeB = 130001;
276 EndPoint epB = new IPEndPoint(IPAddress.Loopback, 1301); 275// EndPoint epB = new IPEndPoint(IPAddress.Loopback, 1301);
277 UUID agentIdB = UUID.Parse("00000000-0000-0000-0000-000000001301"); 276// UUID agentIdB = UUID.Parse("00000000-0000-0000-0000-000000001301");
278 UUID sessionIdB = UUID.Parse("00000000-0000-0000-0000-000000002301"); 277// UUID sessionIdB = UUID.Parse("00000000-0000-0000-0000-000000002301");
279 278//
280 TestLLUDPServer testLLUDPServer; 279// TestLLUDPServer testLLUDPServer;
281 TestLLPacketServer testLLPacketServer; 280// TestLLPacketServer testLLPacketServer;
282 AgentCircuitManager acm; 281// AgentCircuitManager acm;
283 SetupStack(scene, out testLLUDPServer, out testLLPacketServer, out acm); 282// SetupStack(scene, out testLLUDPServer, out testLLPacketServer, out acm);
284 AddClient(circuitCodeA, epA, agentIdA, sessionIdA, testLLUDPServer, acm); 283// AddClient(circuitCodeA, epA, agentIdA, sessionIdA, testLLUDPServer, acm);
285 AddClient(circuitCodeB, epB, agentIdB, sessionIdB, testLLUDPServer, acm); 284// AddClient(circuitCodeB, epB, agentIdB, sessionIdB, testLLUDPServer, acm);
286 285//
287 testLLUDPServer.LoadReceive(BuildTestObjectNamePacket(1, "packet1"), epA); 286// testLLUDPServer.LoadReceive(BuildTestObjectNamePacket(1, "packet1"), epA);
288 testLLUDPServer.LoadReceive(BuildTestObjectNamePacket(1, "packet2"), epB); 287// testLLUDPServer.LoadReceive(BuildTestObjectNamePacket(1, "packet2"), epB);
289 testLLUDPServer.LoadReceiveWithBeginException(epA); 288// testLLUDPServer.LoadReceiveWithBeginException(epA);
290 testLLUDPServer.LoadReceive(BuildTestObjectNamePacket(2, "packet3"), epB); 289// testLLUDPServer.LoadReceive(BuildTestObjectNamePacket(2, "packet3"), epB);
291 testLLUDPServer.ReceiveData(null); 290// testLLUDPServer.ReceiveData(null);
292 291//
293 Assert.IsFalse(testLLUDPServer.HasCircuit(circuitCodeA)); 292// Assert.IsFalse(testLLUDPServer.HasCircuit(circuitCodeA));
294 293//
295 Assert.That(testLLPacketServer.GetTotalPacketsReceived(), Is.EqualTo(3)); 294// Assert.That(testLLPacketServer.GetTotalPacketsReceived(), Is.EqualTo(3));
296 Assert.That(testLLPacketServer.GetPacketsReceivedFor(PacketType.ObjectName), Is.EqualTo(3)); 295// Assert.That(testLLPacketServer.GetPacketsReceivedFor(PacketType.ObjectName), Is.EqualTo(3));
297 } 296// }
298 } 297 }
299} 298}
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Tests/MockScene.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/MockScene.cs
index 34c21aa..737c654 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/Tests/MockScene.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/Tests/MockScene.cs
@@ -25,6 +25,7 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System.Net;
28using OpenMetaverse; 29using OpenMetaverse;
29using OpenSim.Framework; 30using OpenSim.Framework;
30using OpenSim.Region.Framework.Scenes; 31using OpenSim.Region.Framework.Scenes;
@@ -52,14 +53,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
52 public override void Update() {} 53 public override void Update() {}
53 public override void LoadWorldMap() {} 54 public override void LoadWorldMap() {}
54 55
55 public override void AddNewClient(IClientAPI client) 56 public override void AddNewClient(IClientAPI client, PresenceType type)
56 { 57 {
57 client.OnObjectName += RecordObjectNameCall; 58 client.OnObjectName += RecordObjectNameCall;
58 } 59 }
59 60
60 public override void RemoveClient(UUID agentID) {} 61 public override void RemoveClient(UUID agentID, bool someReason) {}
61 public override void CloseAllAgents(uint circuitcode) {} 62// public override void CloseAllAgents(uint circuitcode) {}
63 public override bool CheckClient(UUID clientId, IPEndPoint endPoint) { return true; }
62 public override void OtherRegionUp(GridRegion otherRegion) { } 64 public override void OtherRegionUp(GridRegion otherRegion) { }
65
66 public override bool TryGetScenePresence(UUID uuid, out ScenePresence sp) { sp = null; return false; }
63 67
64 /// <summary> 68 /// <summary>
65 /// Doesn't really matter what the call is - we're using this to test that a packet has actually been received 69 /// 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/Linden/UDP/Tests/PacketHandlerTests.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/PacketHandlerTests.cs
index 7d0757f..0f88ec6 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/Tests/PacketHandlerTests.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/Tests/PacketHandlerTests.cs
@@ -27,7 +27,6 @@
27 27
28using Nini.Config; 28using Nini.Config;
29using NUnit.Framework; 29using NUnit.Framework;
30using NUnit.Framework.SyntaxHelpers;
31using OpenMetaverse; 30using OpenMetaverse;
32using OpenMetaverse.Packets; 31using OpenMetaverse.Packets;
33using OpenSim.Framework; 32using OpenSim.Framework;
@@ -42,65 +41,65 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
42 [TestFixture] 41 [TestFixture]
43 public class PacketHandlerTests 42 public class PacketHandlerTests
44 { 43 {
45 [Test] 44// [Test]
46 /// <summary> 45// /// <summary>
47 /// More a placeholder, really 46// /// More a placeholder, really
48 /// </summary> 47// /// </summary>
49 public void InPacketTest() 48// public void InPacketTest()
50 { 49// {
51 TestHelper.InMethod(); 50// TestHelper.InMethod();
52 51//
53 AgentCircuitData agent = new AgentCircuitData(); 52// AgentCircuitData agent = new AgentCircuitData();
54 agent.AgentID = UUID.Random(); 53// agent.AgentID = UUID.Random();
55 agent.firstname = "testfirstname"; 54// agent.firstname = "testfirstname";
56 agent.lastname = "testlastname"; 55// agent.lastname = "testlastname";
57 agent.SessionID = UUID.Zero; 56// agent.SessionID = UUID.Zero;
58 agent.SecureSessionID = UUID.Zero; 57// agent.SecureSessionID = UUID.Zero;
59 agent.circuitcode = 123; 58// agent.circuitcode = 123;
60 agent.BaseFolder = UUID.Zero; 59// agent.BaseFolder = UUID.Zero;
61 agent.InventoryFolder = UUID.Zero; 60// agent.InventoryFolder = UUID.Zero;
62 agent.startpos = Vector3.Zero; 61// agent.startpos = Vector3.Zero;
63 agent.CapsPath = "http://wibble.com"; 62// agent.CapsPath = "http://wibble.com";
64 63//
65 TestLLUDPServer testLLUDPServer; 64// TestLLUDPServer testLLUDPServer;
66 TestLLPacketServer testLLPacketServer; 65// TestLLPacketServer testLLPacketServer;
67 AgentCircuitManager acm; 66// AgentCircuitManager acm;
68 IScene scene = new MockScene(); 67// IScene scene = new MockScene();
69 SetupStack(scene, out testLLUDPServer, out testLLPacketServer, out acm); 68// SetupStack(scene, out testLLUDPServer, out testLLPacketServer, out acm);
70 69//
71 TestClient testClient = new TestClient(agent, scene); 70// TestClient testClient = new TestClient(agent, scene);
72 71//
73 LLPacketHandler packetHandler 72// LLPacketHandler packetHandler
74 = new LLPacketHandler(testClient, testLLPacketServer, new ClientStackUserSettings()); 73// = new LLPacketHandler(testClient, testLLPacketServer, new ClientStackUserSettings());
75 74//
76 packetHandler.InPacket(new AgentAnimationPacket()); 75// packetHandler.InPacket(new AgentAnimationPacket());
77 LLQueItem receivedPacket = packetHandler.PacketQueue.Dequeue(); 76// LLQueItem receivedPacket = packetHandler.PacketQueue.Dequeue();
78 77//
79 Assert.That(receivedPacket, Is.Not.Null); 78// Assert.That(receivedPacket, Is.Not.Null);
80 Assert.That(receivedPacket.Incoming, Is.True); 79// Assert.That(receivedPacket.Incoming, Is.True);
81 Assert.That(receivedPacket.Packet, Is.TypeOf(typeof(AgentAnimationPacket))); 80// Assert.That(receivedPacket.Packet, Is.TypeOf(typeof(AgentAnimationPacket)));
82 } 81// }
83 82//
84 /// <summary> 83// /// <summary>
85 /// Add a client for testing 84// /// Add a client for testing
86 /// </summary> 85// /// </summary>
87 /// <param name="scene"></param> 86// /// <param name="scene"></param>
88 /// <param name="testLLUDPServer"></param> 87// /// <param name="testLLUDPServer"></param>
89 /// <param name="testPacketServer"></param> 88// /// <param name="testPacketServer"></param>
90 /// <param name="acm">Agent circuit manager used in setting up the stack</param> 89// /// <param name="acm">Agent circuit manager used in setting up the stack</param>
91 protected void SetupStack( 90// protected void SetupStack(
92 IScene scene, out TestLLUDPServer testLLUDPServer, out TestLLPacketServer testPacketServer, 91// IScene scene, out TestLLUDPServer testLLUDPServer, out TestLLPacketServer testPacketServer,
93 out AgentCircuitManager acm) 92// out AgentCircuitManager acm)
94 { 93// {
95 IConfigSource configSource = new IniConfigSource(); 94// IConfigSource configSource = new IniConfigSource();
96 ClientStackUserSettings userSettings = new ClientStackUserSettings(); 95// ClientStackUserSettings userSettings = new ClientStackUserSettings();
97 testLLUDPServer = new TestLLUDPServer(); 96// testLLUDPServer = new TestLLUDPServer();
98 acm = new AgentCircuitManager(); 97// acm = new AgentCircuitManager();
99 98//
100 uint port = 666; 99// uint port = 666;
101 testLLUDPServer.Initialise(null, ref port, 0, false, configSource, acm); 100// testLLUDPServer.Initialise(null, ref port, 0, false, configSource, acm);
102 testPacketServer = new TestLLPacketServer(testLLUDPServer, userSettings); 101// testPacketServer = new TestLLPacketServer(testLLUDPServer, userSettings);
103 testLLUDPServer.LocalScene = scene; 102// testLLUDPServer.LocalScene = scene;
104 } 103// }
105 } 104 }
106} 105}
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Tests/TestLLPacketServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/TestLLPacketServer.cs
deleted file mode 100644
index e995d65..0000000
--- a/OpenSim/Region/ClientStack/Linden/UDP/Tests/TestLLPacketServer.cs
+++ /dev/null
@@ -1,72 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System.Collections.Generic;
29using OpenMetaverse.Packets;
30
31namespace OpenSim.Region.ClientStack.LindenUDP.Tests
32{
33 public class TestLLPacketServer : LLPacketServer
34 {
35 /// <summary>
36 /// Record counts of packets received
37 /// </summary>
38 protected Dictionary<PacketType, int> m_packetsReceived = new Dictionary<PacketType, int>();
39
40 public TestLLPacketServer(LLUDPServer networkHandler, ClientStackUserSettings userSettings)
41 : base(networkHandler, userSettings)
42 {}
43
44 public override void InPacket(uint circuitCode, Packet packet)
45 {
46 base.InPacket(circuitCode, packet);
47
48 if (m_packetsReceived.ContainsKey(packet.Type))
49 m_packetsReceived[packet.Type]++;
50 else
51 m_packetsReceived[packet.Type] = 1;
52 }
53
54 public int GetTotalPacketsReceived()
55 {
56 int totalCount = 0;
57
58 foreach (int count in m_packetsReceived.Values)
59 totalCount += count;
60
61 return totalCount;
62 }
63
64 public int GetPacketsReceivedFor(PacketType packetType)
65 {
66 if (m_packetsReceived.ContainsKey(packetType))
67 return m_packetsReceived[packetType];
68 else
69 return 0;
70 }
71 }
72}
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Tests/TestLLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/TestLLUDPServer.cs
index f98586d..dd7999a 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/Tests/TestLLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/Tests/TestLLUDPServer.cs
@@ -29,7 +29,9 @@ using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Net; 30using System.Net;
31using System.Net.Sockets; 31using System.Net.Sockets;
32using Nini.Config;
32using OpenMetaverse.Packets; 33using OpenMetaverse.Packets;
34using OpenSim.Framework;
33 35
34namespace OpenSim.Region.ClientStack.LindenUDP.Tests 36namespace OpenSim.Region.ClientStack.LindenUDP.Tests
35{ 37{
@@ -39,42 +41,46 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
39 /// </summary> 41 /// </summary>
40 public class TestLLUDPServer : LLUDPServer 42 public class TestLLUDPServer : LLUDPServer
41 { 43 {
44 public TestLLUDPServer(IPAddress listenIP, ref uint port, int proxyPortOffsetParm, bool allow_alternate_port, IConfigSource configSource, AgentCircuitManager circuitManager)
45 : base(listenIP, ref port, proxyPortOffsetParm, allow_alternate_port, configSource, circuitManager)
46 {}
47
42 /// <summary> 48 /// <summary>
43 /// The chunks of data to pass to the LLUDPServer when it calls EndReceive 49 /// The chunks of data to pass to the LLUDPServer when it calls EndReceive
44 /// </summary> 50 /// </summary>
45 protected Queue<ChunkSenderTuple> m_chunksToLoad = new Queue<ChunkSenderTuple>(); 51 protected Queue<ChunkSenderTuple> m_chunksToLoad = new Queue<ChunkSenderTuple>();
46 52
47 protected override void BeginReceive() 53// protected override void BeginReceive()
48 { 54// {
49 if (m_chunksToLoad.Count > 0 && m_chunksToLoad.Peek().BeginReceiveException) 55// if (m_chunksToLoad.Count > 0 && m_chunksToLoad.Peek().BeginReceiveException)
50 { 56// {
51 ChunkSenderTuple tuple = m_chunksToLoad.Dequeue(); 57// ChunkSenderTuple tuple = m_chunksToLoad.Dequeue();
52 reusedEpSender = tuple.Sender; 58// reusedEpSender = tuple.Sender;
53 throw new SocketException(); 59// throw new SocketException();
54 } 60// }
55 } 61// }
56 62
57 protected override bool EndReceive(out int numBytes, IAsyncResult result, ref EndPoint epSender) 63// protected override bool EndReceive(out int numBytes, IAsyncResult result, ref EndPoint epSender)
58 { 64// {
59 numBytes = 0; 65// numBytes = 0;
60 66//
61 //m_log.Debug("Queue size " + m_chunksToLoad.Count); 67// //m_log.Debug("Queue size " + m_chunksToLoad.Count);
62 68//
63 if (m_chunksToLoad.Count <= 0) 69// if (m_chunksToLoad.Count <= 0)
64 return false; 70// return false;
65 71//
66 ChunkSenderTuple tuple = m_chunksToLoad.Dequeue(); 72// ChunkSenderTuple tuple = m_chunksToLoad.Dequeue();
67 RecvBuffer = tuple.Data; 73// RecvBuffer = tuple.Data;
68 numBytes = tuple.Data.Length; 74// numBytes = tuple.Data.Length;
69 epSender = tuple.Sender; 75// epSender = tuple.Sender;
70 76//
71 return true; 77// return true;
72 } 78// }
73 79
74 public override void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode) 80// public override void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode)
75 { 81// {
76 // Don't do anything just yet 82// // Don't do anything just yet
77 } 83// }
78 84
79 /// <summary> 85 /// <summary>
80 /// Signal that this chunk should throw an exception on Socket.BeginReceive() 86 /// Signal that this chunk should throw an exception on Socket.BeginReceive()
@@ -112,8 +118,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
112 /// <param name="result"></param> 118 /// <param name="result"></param>
113 public void ReceiveData(IAsyncResult result) 119 public void ReceiveData(IAsyncResult result)
114 { 120 {
115 while (m_chunksToLoad.Count > 0) 121 // Doesn't work the same way anymore
116 OnReceivedData(result); 122// while (m_chunksToLoad.Count > 0)
123// OnReceivedData(result);
117 } 124 }
118 125
119 /// <summary> 126 /// <summary>
@@ -123,10 +130,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
123 /// <returns></returns> 130 /// <returns></returns>
124 public bool HasCircuit(uint circuitCode) 131 public bool HasCircuit(uint circuitCode)
125 { 132 {
126 lock (clientCircuits_reverse) 133// lock (clientCircuits_reverse)
127 { 134// {
128 return clientCircuits_reverse.ContainsKey(circuitCode); 135// return clientCircuits_reverse.ContainsKey(circuitCode);
129 } 136// }
137
138 return true;
130 } 139 }
131 } 140 }
132 141
diff --git a/prebuild.xml b/prebuild.xml
index c2e024a..8a45156 100644
--- a/prebuild.xml
+++ b/prebuild.xml
@@ -3067,27 +3067,26 @@
3067 </Files> 3067 </Files>
3068 </Project> 3068 </Project>
3069 3069
3070 <!-- Commented for now until new unit tests are written for the new LLUDP implementation 3070 <Project frameworkVersion="v3_5" name="OpenSim.Region.ClientStack.LindenUDP.Tests" path="OpenSim/Region/ClientStack/Linden/UDP/Tests" type="Library">
3071 <Project frameworkVersion="v3_5" name="OpenSim.Region.ClientStack.LindenUDP.Tests" path="OpenSim/Region/ClientStack/LindenUDP/Tests" type="Library">
3072 <Configuration name="Debug"> 3071 <Configuration name="Debug">
3073 <Options> 3072 <Options>
3074 <OutputPath>../../../../../bin/</OutputPath> 3073 <OutputPath>../../../../../../bin/</OutputPath>
3075 </Options> 3074 </Options>
3076 </Configuration> 3075 </Configuration>
3077 <Configuration name="Release"> 3076 <Configuration name="Release">
3078 <Options> 3077 <Options>
3079 <OutputPath>../../../../../bin/</OutputPath> 3078 <OutputPath>../../../../../../bin/</OutputPath>
3080 </Options> 3079 </Options>
3081 </Configuration> 3080 </Configuration>
3082 3081
3083 <ReferencePath>../../../../../bin/</ReferencePath> 3082 <ReferencePath>../../../../../../bin/</ReferencePath>
3084 <Reference name="System"/> 3083 <Reference name="System"/>
3085 <Reference name="System.Xml"/> 3084 <Reference name="System.Xml"/>
3086 <Reference name="log4net"/> 3085 <Reference name="log4net" path="../../../../../../bin/"/>
3087 <Reference name="Nini" /> 3086 <Reference name="Nini" path="../../../../../../bin/"/>
3088 <Reference name="nunit.framework" /> 3087 <Reference name="nunit.framework" path="../../../../../../bin/"/>
3089 <Reference name="OpenMetaverse"/> 3088 <Reference name="OpenMetaverse" path="../../../../../../bin/"/>
3090 <Reference name="OpenMetaverseTypes"/> 3089 <Reference name="OpenMetaverseTypes" path="../../../../../../bin/"/>
3091 <Reference name="OpenSim.Framework"/> 3090 <Reference name="OpenSim.Framework"/>
3092 <Reference name="OpenSim.Framework.Communications"/> 3091 <Reference name="OpenSim.Framework.Communications"/>
3093 <Reference name="OpenSim.Framework.Statistics"/> 3092 <Reference name="OpenSim.Framework.Statistics"/>
@@ -3101,7 +3100,6 @@
3101 <Match pattern="*.cs" recurse="false"/> 3100 <Match pattern="*.cs" recurse="false"/>
3102 </Files> 3101 </Files>
3103 </Project> 3102 </Project>
3104 -->
3105 3103
3106 <Project frameworkVersion="v3_5" name="OpenSim.Region.ScriptEngine.Tests" path="OpenSim/Region/ScriptEngine" type="Library"> 3104 <Project frameworkVersion="v3_5" name="OpenSim.Region.ScriptEngine.Tests" path="OpenSim/Region/ScriptEngine" type="Library">
3107 <Configuration name="Debug"> 3105 <Configuration name="Debug">