* Change AddClient test such that we now successfully authenticate

* The fact that the assert passed even when authentication failed reveals a bug in the code that will be corrected soonish
0.6.0-stable
Justin Clarke Casey 2008-10-24 19:40:45 +00:00
parent 9fa7264c73
commit 91c2e53277
3 changed files with 19 additions and 6 deletions

View File

@ -74,7 +74,7 @@ namespace OpenSim.Framework
} }
/// <summary> /// <summary>
/// Add information about a new circuit. /// Add information about a new circuit so that later on we can authenticate a new client session.
/// </summary> /// </summary>
/// <param name="circuitCode"></param> /// <param name="circuitCode"></param>
/// <param name="agentData"></param> /// <param name="agentData"></param>

View File

@ -396,7 +396,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
useCircuit.CircuitCode.ID, useCircuit.CircuitCode.Code); useCircuit.CircuitCode.ID, useCircuit.CircuitCode.Code);
clientCircuits.Add(epSender, useCircuit.CircuitCode.Code); clientCircuits.Add(epSender, useCircuit.CircuitCode.Code);
isNewCircuit = true; isNewCircuit = true;
} }
} }

View File

@ -28,6 +28,7 @@
using System.Net; using System.Net;
using log4net; using log4net;
using NUnit.Framework; using NUnit.Framework;
using OpenMetaverse;
using OpenMetaverse.Packets; using OpenMetaverse.Packets;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Communications; using OpenSim.Framework.Communications;
@ -58,18 +59,31 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
[Test] [Test]
public void TestAddClient() public void TestAddClient()
{ {
uint myCircuitCode = 123456;
UUID myAgentUuid = UUID.Parse("00000000-0000-0000-0000-000000000001");
UUID mySessionUuid = UUID.Parse("00000000-0000-0000-0000-000000000002");
TestLLUDPServer testLLUDPServer = new TestLLUDPServer(); TestLLUDPServer testLLUDPServer = new TestLLUDPServer();
ClientStackUserSettings userSettings = new ClientStackUserSettings(); ClientStackUserSettings userSettings = new ClientStackUserSettings();
AgentCircuitManager acm = new AgentCircuitManager();
AgentCircuitData acd = new AgentCircuitData();
acd.AgentID = myAgentUuid;
acd.SessionID = mySessionUuid;
acm.AddNewCircuit(myCircuitCode, acd);
uint port = 666; uint port = 666;
testLLUDPServer.Initialise(null, ref port, 0, false, userSettings, null, new AgentCircuitManager()); testLLUDPServer.Initialise(null, ref port, 0, false, userSettings, null, acm);
LLPacketServer packetServer = new LLPacketServer(testLLUDPServer, userSettings); LLPacketServer packetServer = new LLPacketServer(testLLUDPServer, userSettings);
testLLUDPServer.LocalScene = new MockScene(); testLLUDPServer.LocalScene = new MockScene();
UseCircuitCodePacket uccp = new UseCircuitCodePacket(); UseCircuitCodePacket uccp = new UseCircuitCodePacket();
UseCircuitCodePacket.CircuitCodeBlock uccpCcBlock UseCircuitCodePacket.CircuitCodeBlock uccpCcBlock
= new OpenMetaverse.Packets.UseCircuitCodePacket.CircuitCodeBlock(); = new OpenMetaverse.Packets.UseCircuitCodePacket.CircuitCodeBlock();
uccpCcBlock.Code = 123456; uccpCcBlock.Code = myCircuitCode;
uccpCcBlock.ID = myAgentUuid;
uccpCcBlock.SessionID = mySessionUuid;
uccp.CircuitCode = uccpCcBlock; uccp.CircuitCode = uccpCcBlock;
EndPoint testEp = new IPEndPoint(IPAddress.Loopback, 999); EndPoint testEp = new IPEndPoint(IPAddress.Loopback, 999);
@ -78,7 +92,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
testLLUDPServer.ReceiveData(null); testLLUDPServer.ReceiveData(null);
Assert.IsFalse(testLLUDPServer.HasCircuit(101)); Assert.IsFalse(testLLUDPServer.HasCircuit(101));
Assert.IsTrue(testLLUDPServer.HasCircuit(123456)); Assert.IsTrue(testLLUDPServer.HasCircuit(myCircuitCode));
} }
} }
} }