* Update ScenePresenceTests to reflect current REST communication workflow.
* Fixed an issue with AssetCache where it would break unit tests randomly. From: Arthur Rodrigo S Valadares <arthursv@linux.vnet.ibm.com>GenericGridServerConcept
parent
7b04d1da5e
commit
57ab79e331
|
@ -210,7 +210,7 @@ namespace OpenSim.Framework.Communications.Cache
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error("[ASSET CACHE]: " + e);
|
||||
m_log.Error("[ASSET CACHE]: " + e.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ using Nini.Config;
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using NUnit.Framework;
|
||||
using NUnit.Framework.SyntaxHelpers;
|
||||
using OpenMetaverse;
|
||||
|
@ -136,9 +137,11 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
|||
[Test]
|
||||
public void T012_TestAddNeighbourRegion()
|
||||
{
|
||||
SceneSetupHelpers.AddRootAgent(scene,agent1);
|
||||
scene.NewUserConnection(acd1);
|
||||
scene.AddNewClient(testclient);
|
||||
|
||||
ScenePresence presence = scene.GetScenePresence(agent1);
|
||||
presence.MakeRootAgent(new Vector3(90,90,90),false);
|
||||
|
||||
string cap = presence.ControllingClient.RequestClientInfo().CapsPath;
|
||||
|
||||
|
@ -195,30 +198,43 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
|||
string cap = presence.ControllingClient.RequestClientInfo().CapsPath;
|
||||
presence2.AddNeighbourRegion(region1, cap);
|
||||
|
||||
scene.RegisterRegionWithGrid();
|
||||
scene2.RegisterRegionWithGrid();
|
||||
|
||||
Assert.That(presence.IsChildAgent, Is.False, "Did not start root in origin region.");
|
||||
Assert.That(presence2.IsChildAgent, Is.True, "Is not a child on destination region.");
|
||||
|
||||
// Cross to x+1
|
||||
presence.AbsolutePosition = new Vector3(Constants.RegionSize+1,3,100);
|
||||
scene.RegisterRegionWithGrid();
|
||||
scene2.RegisterRegionWithGrid();
|
||||
presence.Update();
|
||||
/* With RESTComms this test needs more thinking, because of the callback
|
||||
|
||||
EventWaitHandle wh = new EventWaitHandle (false, EventResetMode.AutoReset, "Crossing");
|
||||
|
||||
// Mimicking communication between client and server, by waiting OK from client
|
||||
// sent by TestClient.CrossRegion call. Originally, this is network comm.
|
||||
wh.WaitOne();
|
||||
|
||||
// This is a TestClient specific method that fires OnCompleteMovementToRegion event, which
|
||||
// would normally be fired after receiving the reply packet from comm. done on the last line.
|
||||
testclient.CompleteMovement();
|
||||
|
||||
// Crossings are asynchronous
|
||||
while (presence.IsInTransit) { };
|
||||
while (presence.IsInTransit) { };
|
||||
|
||||
Assert.That(presence.IsChildAgent, Is.True, "Did not complete region cross as expected.");
|
||||
Assert.That(presence2.IsChildAgent, Is.False, "Did not receive root status after receiving agent.");
|
||||
|
||||
// Cross Back
|
||||
presence2.AbsolutePosition = new Vector3(-1, 3, 100);
|
||||
presence2.AbsolutePosition = new Vector3(-10, 3, 100);
|
||||
presence2.Update();
|
||||
// Crossings are asynchronous
|
||||
while (presence2.IsInTransit) { };
|
||||
|
||||
wh.WaitOne();
|
||||
testclient.CompleteMovement();
|
||||
|
||||
while (presence2.IsInTransit) { };
|
||||
|
||||
Assert.That(presence2.IsChildAgent, Is.True, "Did not return from region as expected.");
|
||||
Assert.That(presence.IsChildAgent, Is.False, "Presence was not made root in old region again.");
|
||||
*/
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
|
@ -29,6 +29,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using log4net;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.Packets;
|
||||
|
@ -45,6 +46,7 @@ namespace OpenSim.Tests.Common.Mock
|
|||
// Mock testing variables
|
||||
public List<ImageDataPacket> sentdatapkt = new List<ImageDataPacket>();
|
||||
public List<ImagePacketPacket> sentpktpkt = new List<ImagePacketPacket>();
|
||||
EventWaitHandle wh = new EventWaitHandle (false, EventResetMode.AutoReset, "Crossing");
|
||||
|
||||
// TODO: This is a really nasty (and temporary) means of telling the test client which scene to invoke setup
|
||||
// methods on when a teleport is requested
|
||||
|
@ -541,6 +543,12 @@ namespace OpenSim.Tests.Common.Mock
|
|||
public virtual void CrossRegion(ulong newRegionHandle, Vector3 pos, Vector3 lookAt,
|
||||
IPEndPoint newRegionExternalEndPoint, string capsURL)
|
||||
{
|
||||
// This is supposed to send a packet to the client telling it's ready to start region crossing.
|
||||
// Instead I will just signal I'm ready, mimicking the communication behavior.
|
||||
// It's ugly, but avoids needless communication setup. This is used in ScenePresenceTests.cs.
|
||||
// Arthur V.
|
||||
|
||||
wh.Set();
|
||||
}
|
||||
|
||||
public virtual void SendMapBlock(List<MapBlockData> mapBlocks, uint flag)
|
||||
|
|
|
@ -187,7 +187,10 @@ namespace OpenSim.Tests.Common.Setup
|
|||
|
||||
// Stage 3: Invoke agent crossing, which converts the child agent into a root agent (with appearance,
|
||||
// inventory, etc.)
|
||||
scene.AgentCrossing(agentData.AgentID, new Vector3(90, 90, 90), false);
|
||||
//scene.AgentCrossing(agentData.AgentID, new Vector3(90, 90, 90), false); OBSOLETE
|
||||
|
||||
ScenePresence scp = scene.GetScenePresence(agentData.AgentID);
|
||||
scp.MakeRootAgent(new Vector3(90,90,90), true);
|
||||
|
||||
return client;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue