diff options
Diffstat (limited to 'OpenSim/Region/ClientStack/LindenUDP')
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/Tests/PacketHandlerTests.cs | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/Tests/PacketHandlerTests.cs b/OpenSim/Region/ClientStack/LindenUDP/Tests/PacketHandlerTests.cs new file mode 100644 index 0000000..305a620 --- /dev/null +++ b/OpenSim/Region/ClientStack/LindenUDP/Tests/PacketHandlerTests.cs | |||
@@ -0,0 +1,91 @@ | |||
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 OpenSim 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 | |||
28 | using Nini.Config; | ||
29 | using NUnit.Framework; | ||
30 | using OpenMetaverse; | ||
31 | using OpenSim.Framework; | ||
32 | using OpenSim.Region.ClientStack.LindenUDP; | ||
33 | using OpenSim.Tests.Common.Mock; | ||
34 | |||
35 | namespace OpenSim.Region.ClientStack.LindenUDP.Tests | ||
36 | { | ||
37 | /// <summary> | ||
38 | /// Tests for the LL packet handler | ||
39 | /// </summary> | ||
40 | [TestFixture] | ||
41 | public class PacketHandlerTests | ||
42 | { | ||
43 | [Test] | ||
44 | /// <summary> | ||
45 | /// More a placeholder, really | ||
46 | /// </summary> | ||
47 | public void DummyTest() | ||
48 | { | ||
49 | AgentCircuitData agent = new AgentCircuitData(); | ||
50 | agent.AgentID = UUID.Random(); | ||
51 | agent.firstname = "testfirstname"; | ||
52 | agent.lastname = "testlastname"; | ||
53 | agent.SessionID = UUID.Zero; | ||
54 | agent.SecureSessionID = UUID.Zero; | ||
55 | agent.circuitcode = 123; | ||
56 | agent.BaseFolder = UUID.Zero; | ||
57 | agent.InventoryFolder = UUID.Zero; | ||
58 | agent.startpos = Vector3.Zero; | ||
59 | agent.CapsPath = "http://wibble.com"; | ||
60 | |||
61 | TestLLUDPServer testLLUDPServer; | ||
62 | TestLLPacketServer testLLPacketServer; | ||
63 | AgentCircuitManager acm; | ||
64 | SetupStack(new MockScene(), out testLLUDPServer, out testLLPacketServer, out acm); | ||
65 | |||
66 | new LLPacketHandler(new TestClient(agent), testLLPacketServer, new ClientStackUserSettings()); | ||
67 | } | ||
68 | |||
69 | /// <summary> | ||
70 | /// Add a client for testing | ||
71 | /// </summary> | ||
72 | /// <param name="scene"></param> | ||
73 | /// <param name="testLLUDPServer"></param> | ||
74 | /// <param name="testPacketServer"></param> | ||
75 | /// <param name="acm">Agent circuit manager used in setting up the stack</param> | ||
76 | protected void SetupStack( | ||
77 | IScene scene, out TestLLUDPServer testLLUDPServer, out TestLLPacketServer testPacketServer, | ||
78 | out AgentCircuitManager acm) | ||
79 | { | ||
80 | IConfigSource configSource = new IniConfigSource(); | ||
81 | ClientStackUserSettings userSettings = new ClientStackUserSettings(); | ||
82 | testLLUDPServer = new TestLLUDPServer(); | ||
83 | acm = new AgentCircuitManager(); | ||
84 | |||
85 | uint port = 666; | ||
86 | testLLUDPServer.Initialise(null, ref port, 0, false, configSource, null, acm); | ||
87 | testPacketServer = new TestLLPacketServer(testLLUDPServer, userSettings); | ||
88 | testLLUDPServer.LocalScene = scene; | ||
89 | } | ||
90 | } | ||
91 | } | ||