aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-10-30 19:26:38 +0000
committerJustin Clarke Casey2008-10-30 19:26:38 +0000
commit80e87747f353e5a3067722db510f65c649c30121 (patch)
tree933aeedad9afa2b30235f72ebec2e51e37134480 /OpenSim
parentFrom: Alan Webb (alan_webb@us.ibm.com) (diff)
downloadopensim-SC_OLD-80e87747f353e5a3067722db510f65c649c30121.zip
opensim-SC_OLD-80e87747f353e5a3067722db510f65c649c30121.tar.gz
opensim-SC_OLD-80e87747f353e5a3067722db510f65c649c30121.tar.bz2
opensim-SC_OLD-80e87747f353e5a3067722db510f65c649c30121.tar.xz
* test: Refactor test infrastructure for future client teardown test
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/Tests/BasicCircuitTests.cs78
1 files changed, 69 insertions, 9 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/Tests/BasicCircuitTests.cs b/OpenSim/Region/ClientStack/LindenUDP/Tests/BasicCircuitTests.cs
index 620e33f..f00ddf3 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/Tests/BasicCircuitTests.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/Tests/BasicCircuitTests.cs
@@ -57,25 +57,72 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
57 } 57 }
58 } 58 }
59 59
60 /// <summary>
61 /// Add a client for testing
62 /// </summary>
63 /// <param name="testLLUDPServer"></param>
64 /// <param name="acm">Agent circuit manager used in setting up the stack</param>
65 protected void SetupStack( out TestLLUDPServer testLLUDPServer, out AgentCircuitManager acm)
66 {
67 ClientStackUserSettings userSettings = new ClientStackUserSettings();
68 testLLUDPServer = new TestLLUDPServer();
69 acm = new AgentCircuitManager();
70
71 uint port = 666;
72 testLLUDPServer.Initialise(null, ref port, 0, false, userSettings, null, acm);
73 new LLPacketServer(testLLUDPServer, userSettings);
74 testLLUDPServer.LocalScene = new MockScene();
75 }
76
77 /// <summary>
78 /// Set up a client for tests which aren't concerned with this process itself
79 /// </summary>
80 /// <param name="circuitCode"></param>
81 /// <param name="testLLUDPServer"></param>
82 /// <param name="acm"></param>
83 protected void AddClient(uint circuitCode, TestLLUDPServer testLLUDPServer, AgentCircuitManager acm)
84 {
85 UUID myAgentUuid = UUID.Parse("00000000-0000-0000-0000-000000000001");
86 UUID mySessionUuid = UUID.Parse("00000000-0000-0000-0000-000000000002");
87
88 AgentCircuitData acd = new AgentCircuitData();
89 acd.AgentID = myAgentUuid;
90 acd.SessionID = mySessionUuid;
91
92 UseCircuitCodePacket uccp = new UseCircuitCodePacket();
93
94 UseCircuitCodePacket.CircuitCodeBlock uccpCcBlock
95 = new OpenMetaverse.Packets.UseCircuitCodePacket.CircuitCodeBlock();
96 uccpCcBlock.Code = circuitCode;
97 uccpCcBlock.ID = myAgentUuid;
98 uccpCcBlock.SessionID = mySessionUuid;
99 uccp.CircuitCode = uccpCcBlock;
100
101 EndPoint testEp = new IPEndPoint(IPAddress.Loopback, 999);
102
103 acm.AddNewCircuit(circuitCode, acd);
104
105 testLLUDPServer.LoadReceive(uccp, testEp);
106 testLLUDPServer.ReceiveData(null);
107 }
108
60 [Test] 109 [Test]
110 /// <summary>
111 /// Test adding a client to the stack
112 /// </summary>
61 public void TestAddClient() 113 public void TestAddClient()
62 { 114 {
63 uint myCircuitCode = 123456; 115 uint myCircuitCode = 123456;
64 UUID myAgentUuid = UUID.Parse("00000000-0000-0000-0000-000000000001"); 116 UUID myAgentUuid = UUID.Parse("00000000-0000-0000-0000-000000000001");
65 UUID mySessionUuid = UUID.Parse("00000000-0000-0000-0000-000000000002"); 117 UUID mySessionUuid = UUID.Parse("00000000-0000-0000-0000-000000000002");
66 118
67 TestLLUDPServer testLLUDPServer = new TestLLUDPServer(); 119 TestLLUDPServer testLLUDPServer;
68 ClientStackUserSettings userSettings = new ClientStackUserSettings(); 120 AgentCircuitManager acm;
121 SetupStack(out testLLUDPServer, out acm);
69 122
70 AgentCircuitManager acm = new AgentCircuitManager();
71 AgentCircuitData acd = new AgentCircuitData(); 123 AgentCircuitData acd = new AgentCircuitData();
72 acd.AgentID = myAgentUuid; 124 acd.AgentID = myAgentUuid;
73 acd.SessionID = mySessionUuid; 125 acd.SessionID = mySessionUuid;
74
75 uint port = 666;
76 testLLUDPServer.Initialise(null, ref port, 0, false, userSettings, null, acm);
77 new LLPacketServer(testLLUDPServer, userSettings);
78 testLLUDPServer.LocalScene = new MockScene();
79 126
80 UseCircuitCodePacket uccp = new UseCircuitCodePacket(); 127 UseCircuitCodePacket uccp = new UseCircuitCodePacket();
81 128
@@ -103,5 +150,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
103 Assert.IsTrue(testLLUDPServer.HasCircuit(myCircuitCode)); 150 Assert.IsTrue(testLLUDPServer.HasCircuit(myCircuitCode));
104 Assert.IsFalse(testLLUDPServer.HasCircuit(101)); 151 Assert.IsFalse(testLLUDPServer.HasCircuit(101));
105 } 152 }
153
154 [Test]
155 /// <summary>
156 /// Test removing a client from the stack
157 /// </summary>
158 public void TestRemoveClient()
159 {
160 TestLLUDPServer testLLUDPServer;
161 AgentCircuitManager acm;
162 SetupStack(out testLLUDPServer, out acm);
163
164 AddClient(123457, testLLUDPServer, acm);
165 }
106 } 166 }
107} 167}