GridServerPostHandler finished. GridClient tests all work. More guards on getting parameters and replies over the wire.

remotes/origin/0.6.7-post-fixes
Diva Canto 2009-09-24 15:30:00 -07:00
parent dd3d52ae1f
commit 1faaa0a43a
5 changed files with 327 additions and 84 deletions

View File

@ -101,10 +101,7 @@ namespace OpenSim.Data.Null
ret.Add(r); ret.Add(r);
} }
if (ret.Count > 0)
return ret; return ret;
return null;
} }
public bool Store(RegionData data) public bool Store(RegionData data)

View File

@ -164,6 +164,10 @@ namespace OpenSim.Server.Handlers.Grid
//m_log.DebugFormat("[GRID HANDLER]: neighbours for region {0}: {1}", regionID, rinfos.Count); //m_log.DebugFormat("[GRID HANDLER]: neighbours for region {0}: {1}", regionID, rinfos.Count);
Dictionary<string, object> result = new Dictionary<string, object>(); Dictionary<string, object> result = new Dictionary<string, object>();
if ((rinfos == null) || ((rinfos != null) && (rinfos.Count == 0)))
result["result"] = "null";
else
{
int i = 0; int i = 0;
foreach (GridRegion rinfo in rinfos) foreach (GridRegion rinfo in rinfos)
{ {
@ -171,6 +175,7 @@ namespace OpenSim.Server.Handlers.Grid
result["region" + i] = rinfoDict; result["region" + i] = rinfoDict;
i++; i++;
} }
}
string xmlString = ServerUtils.BuildXmlResponse(result); string xmlString = ServerUtils.BuildXmlResponse(result);
//m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString);
@ -181,32 +186,184 @@ namespace OpenSim.Server.Handlers.Grid
byte[] GetRegionByUUID(Dictionary<string, string> request) byte[] GetRegionByUUID(Dictionary<string, string> request)
{ {
// TODO UUID scopeID = UUID.Zero;
return new byte[0]; if (request["SCOPEID"] != null)
UUID.TryParse(request["SCOPEID"], out scopeID);
else
m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get neighbours");
UUID regionID = UUID.Zero;
if (request["REGIONID"] != null)
UUID.TryParse(request["REGIONID"], out regionID);
else
m_log.WarnFormat("[GRID HANDLER]: no regionID in request to get neighbours");
GridRegion rinfo = m_GridService.GetRegionByUUID(scopeID, regionID);
//m_log.DebugFormat("[GRID HANDLER]: neighbours for region {0}: {1}", regionID, rinfos.Count);
Dictionary<string, object> result = new Dictionary<string, object>();
if (rinfo == null)
result["result"] = "null";
else
result["result"] = rinfo.ToKeyValuePairs();
string xmlString = ServerUtils.BuildXmlResponse(result);
//m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString);
UTF8Encoding encoding = new UTF8Encoding();
return encoding.GetBytes(xmlString);
} }
byte[] GetRegionByPosition(Dictionary<string, string> request) byte[] GetRegionByPosition(Dictionary<string, string> request)
{ {
// TODO UUID scopeID = UUID.Zero;
return new byte[0]; if (request["SCOPEID"] != null)
UUID.TryParse(request["SCOPEID"], out scopeID);
else
m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get region by position");
int x = 0, y = 0;
if (request["X"] != null)
Int32.TryParse(request["X"], out x);
else
m_log.WarnFormat("[GRID HANDLER]: no X in request to get region by position");
if (request["Y"] != null)
Int32.TryParse(request["Y"], out y);
else
m_log.WarnFormat("[GRID HANDLER]: no Y in request to get region by position");
GridRegion rinfo = m_GridService.GetRegionByPosition(scopeID, x, y);
//m_log.DebugFormat("[GRID HANDLER]: neighbours for region {0}: {1}", regionID, rinfos.Count);
Dictionary<string, object> result = new Dictionary<string, object>();
if (rinfo == null)
result["result"] = "null";
else
result["result"] = rinfo.ToKeyValuePairs();
string xmlString = ServerUtils.BuildXmlResponse(result);
//m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString);
UTF8Encoding encoding = new UTF8Encoding();
return encoding.GetBytes(xmlString);
} }
byte[] GetRegionByName(Dictionary<string, string> request) byte[] GetRegionByName(Dictionary<string, string> request)
{ {
// TODO UUID scopeID = UUID.Zero;
return new byte[0]; if (request["SCOPEID"] != null)
UUID.TryParse(request["SCOPEID"], out scopeID);
else
m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get region by name");
string regionName = string.Empty;
if (request["NAME"] != null)
regionName = request["NAME"];
else
m_log.WarnFormat("[GRID HANDLER]: no name in request to get region by name");
GridRegion rinfo = m_GridService.GetRegionByName(scopeID, regionName);
//m_log.DebugFormat("[GRID HANDLER]: neighbours for region {0}: {1}", regionID, rinfos.Count);
Dictionary<string, object> result = new Dictionary<string, object>();
if (rinfo == null)
result["result"] = "null";
else
result["result"] = rinfo.ToKeyValuePairs();
string xmlString = ServerUtils.BuildXmlResponse(result);
//m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString);
UTF8Encoding encoding = new UTF8Encoding();
return encoding.GetBytes(xmlString);
} }
byte[] GetRegionsByName(Dictionary<string, string> request) byte[] GetRegionsByName(Dictionary<string, string> request)
{ {
// TODO UUID scopeID = UUID.Zero;
return new byte[0]; if (request["SCOPEID"] != null)
UUID.TryParse(request["SCOPEID"], out scopeID);
else
m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get regions by name");
string regionName = string.Empty;
if (request["NAME"] != null)
regionName = request["NAME"];
else
m_log.WarnFormat("[GRID HANDLER]: no NAME in request to get regions by name");
int max = 0;
if (request["MAX"] != null)
Int32.TryParse(request["MAX"], out max);
else
m_log.WarnFormat("[GRID HANDLER]: no MAX in request to get regions by name");
List<GridRegion> rinfos = m_GridService.GetRegionsByName(scopeID, regionName, max);
//m_log.DebugFormat("[GRID HANDLER]: neighbours for region {0}: {1}", regionID, rinfos.Count);
Dictionary<string, object> result = new Dictionary<string, object>();
if ((rinfos == null) || ((rinfos != null) && (rinfos.Count == 0)))
result["result"] = "null";
else
{
int i = 0;
foreach (GridRegion rinfo in rinfos)
{
Dictionary<string, object> rinfoDict = rinfo.ToKeyValuePairs();
result["region" + i] = rinfoDict;
i++;
}
}
string xmlString = ServerUtils.BuildXmlResponse(result);
//m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString);
UTF8Encoding encoding = new UTF8Encoding();
return encoding.GetBytes(xmlString);
} }
byte[] GetRegionRange(Dictionary<string, string> request) byte[] GetRegionRange(Dictionary<string, string> request)
{ {
// TODO UUID scopeID = UUID.Zero;
return new byte[0]; if (request["SCOPEID"] != null)
UUID.TryParse(request["SCOPEID"], out scopeID);
else
m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get region range");
int xmin = 0, xmax = 0, ymin = 0, ymax = 0;
if (request["XMIN"] != null)
Int32.TryParse(request["XMIN"], out xmin);
else
m_log.WarnFormat("[GRID HANDLER]: no XMIN in request to get region range");
if (request["XMAX"] != null)
Int32.TryParse(request["XMAX"], out xmax);
else
m_log.WarnFormat("[GRID HANDLER]: no XMAX in request to get region range");
if (request["YMIN"] != null)
Int32.TryParse(request["YMIN"], out ymin);
else
m_log.WarnFormat("[GRID HANDLER]: no YMIN in request to get region range");
if (request["YMAX"] != null)
Int32.TryParse(request["YMAX"], out ymax);
else
m_log.WarnFormat("[GRID HANDLER]: no YMAX in request to get region range");
List<GridRegion> rinfos = m_GridService.GetRegionRange(scopeID, xmin, xmax, ymin, ymax);
Dictionary<string, object> result = new Dictionary<string, object>();
if ((rinfos == null) || ((rinfos != null) && (rinfos.Count == 0)))
result["result"] = "null";
else
{
int i = 0;
foreach (GridRegion rinfo in rinfos)
{
Dictionary<string, object> rinfoDict = rinfo.ToKeyValuePairs();
result["region" + i] = rinfoDict;
i++;
}
}
string xmlString = ServerUtils.BuildXmlResponse(result);
//m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString);
UTF8Encoding encoding = new UTF8Encoding();
return encoding.GetBytes(xmlString);
} }
#endregion #endregion

View File

@ -98,15 +98,19 @@ namespace OpenSim.Services.Connectors
sendData["METHOD"] = "register"; sendData["METHOD"] = "register";
string reqString = ServerUtils.BuildQueryString(sendData); string reqString = ServerUtils.BuildQueryString(sendData);
m_log.DebugFormat("[GRID CONNECTOR]: queryString = {0}", reqString); //m_log.DebugFormat("[GRID CONNECTOR]: queryString = {0}", reqString);
string reply = SynchronousRestFormsRequester.MakeRequest("POST", string reply = SynchronousRestFormsRequester.MakeRequest("POST",
m_ServerURI + "/grid", m_ServerURI + "/grid",
reqString); reqString);
if (reply != string.Empty)
{
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
if ((replyData["Result"] != null) && (replyData["Result"].ToString().ToLower() == "success")) if ((replyData["Result"] != null) && (replyData["Result"].ToString().ToLower() == "success"))
return true; return true;
}
else
m_log.DebugFormat("[GRID CONNECTOR]: RegisterRegion received null reply");
return false; return false;
} }
@ -123,10 +127,15 @@ namespace OpenSim.Services.Connectors
m_ServerURI + "/grid", m_ServerURI + "/grid",
ServerUtils.BuildQueryString(sendData)); ServerUtils.BuildQueryString(sendData));
if (reply != string.Empty)
{
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
if ((replyData["Result"] != null) && (replyData["Result"].ToString().ToLower() == "success")) if ((replyData["Result"] != null) && (replyData["Result"].ToString().ToLower() == "success"))
return true; return true;
}
else
m_log.DebugFormat("[GRID CONNECTOR]: DeregisterRegion received null reply");
return false; return false;
} }
@ -151,7 +160,7 @@ namespace OpenSim.Services.Connectors
if (replyData != null) if (replyData != null)
{ {
Dictionary<string, object>.ValueCollection rinfosList = replyData.Values; Dictionary<string, object>.ValueCollection rinfosList = replyData.Values;
m_log.DebugFormat("[GRID CONNECTOR]: get neighbours returned {0} elements", rinfosList.Count); //m_log.DebugFormat("[GRID CONNECTOR]: get neighbours returned {0} elements", rinfosList.Count);
foreach (object r in rinfosList) foreach (object r in rinfosList)
{ {
if (r is Dictionary<string, object>) if (r is Dictionary<string, object>)
@ -184,20 +193,26 @@ namespace OpenSim.Services.Connectors
m_ServerURI + "/grid", m_ServerURI + "/grid",
ServerUtils.BuildQueryString(sendData)); ServerUtils.BuildQueryString(sendData));
GridRegion rinfo = null;
if (reply != string.Empty)
{
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
GridRegion rinfo = null;
if ((replyData != null) && (replyData["result"] != null)) if ((replyData != null) && (replyData["result"] != null))
{ {
if (replyData["result"] is Dictionary<string, object>) if (replyData["result"] is Dictionary<string, object>)
rinfo = new GridRegion((Dictionary<string, object>)replyData["result"]); rinfo = new GridRegion((Dictionary<string, object>)replyData["result"]);
else //else
m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByUUID {0}, {1} received invalid response", // m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByUUID {0}, {1} received null response",
scopeID, regionID); // scopeID, regionID);
} }
else else
m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByUUID {0}, {1} received null response", m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByUUID {0}, {1} received null response",
scopeID, regionID); scopeID, regionID);
}
else
m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByUUID received null reply");
return rinfo; return rinfo;
} }
@ -216,9 +231,11 @@ namespace OpenSim.Services.Connectors
m_ServerURI + "/grid", m_ServerURI + "/grid",
ServerUtils.BuildQueryString(sendData)); ServerUtils.BuildQueryString(sendData));
GridRegion rinfo = null;
if (reply != string.Empty)
{
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
GridRegion rinfo = null;
if ((replyData != null) && (replyData["result"] != null)) if ((replyData != null) && (replyData["result"] != null))
{ {
if (replyData["result"] is Dictionary<string, object>) if (replyData["result"] is Dictionary<string, object>)
@ -230,6 +247,9 @@ namespace OpenSim.Services.Connectors
else else
m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByPosition {0}, {1}-{2} received null response", m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByPosition {0}, {1}-{2} received null response",
scopeID, x, y); scopeID, x, y);
}
else
m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByPosition received null reply");
return rinfo; return rinfo;
} }
@ -247,20 +267,22 @@ namespace OpenSim.Services.Connectors
m_ServerURI + "/grid", m_ServerURI + "/grid",
ServerUtils.BuildQueryString(sendData)); ServerUtils.BuildQueryString(sendData));
GridRegion rinfo = null;
if (reply != string.Empty)
{
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
GridRegion rinfo = null;
if ((replyData != null) && (replyData["result"] != null)) if ((replyData != null) && (replyData["result"] != null))
{ {
if (replyData["result"] is Dictionary<string, object>) if (replyData["result"] is Dictionary<string, object>)
rinfo = new GridRegion((Dictionary<string, object>)replyData["result"]); rinfo = new GridRegion((Dictionary<string, object>)replyData["result"]);
else
m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByPosition {0}, {1} received invalid response",
scopeID, regionName);
} }
else else
m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByPosition {0}, {1} received null response", m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByPosition {0}, {1} received null response",
scopeID, regionName); scopeID, regionName);
}
else
m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByName received null reply");
return rinfo; return rinfo;
} }
@ -279,9 +301,12 @@ namespace OpenSim.Services.Connectors
m_ServerURI + "/grid", m_ServerURI + "/grid",
ServerUtils.BuildQueryString(sendData)); ServerUtils.BuildQueryString(sendData));
List<GridRegion> rinfos = new List<GridRegion>();
if (reply != string.Empty)
{
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
List<GridRegion> rinfos = new List<GridRegion>();
if (replyData != null) if (replyData != null)
{ {
Dictionary<string, object>.ValueCollection rinfosList = replyData.Values; Dictionary<string, object>.ValueCollection rinfosList = replyData.Values;
@ -300,6 +325,9 @@ namespace OpenSim.Services.Connectors
else else
m_log.DebugFormat("[GRID CONNECTOR]: GetRegionsByName {0}, {1}, {2} received null response", m_log.DebugFormat("[GRID CONNECTOR]: GetRegionsByName {0}, {1}, {2} received null response",
scopeID, name, maxNumber); scopeID, name, maxNumber);
}
else
m_log.DebugFormat("[GRID CONNECTOR]: GetRegionsByName received null reply");
return rinfos; return rinfos;
} }
@ -316,13 +344,18 @@ namespace OpenSim.Services.Connectors
sendData["METHOD"] = "get_region_range"; sendData["METHOD"] = "get_region_range";
List<GridRegion> rinfos = new List<GridRegion>();
string reply = SynchronousRestFormsRequester.MakeRequest("POST", string reply = SynchronousRestFormsRequester.MakeRequest("POST",
m_ServerURI + "/grid", m_ServerURI + "/grid",
ServerUtils.BuildQueryString(sendData)); ServerUtils.BuildQueryString(sendData));
//m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply);
if (reply != string.Empty)
{
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
List<GridRegion> rinfos = new List<GridRegion>();
if (replyData != null) if (replyData != null)
{ {
Dictionary<string, object>.ValueCollection rinfosList = replyData.Values; Dictionary<string, object>.ValueCollection rinfosList = replyData.Values;
@ -333,14 +366,14 @@ namespace OpenSim.Services.Connectors
GridRegion rinfo = new GridRegion((Dictionary<string, object>)r); GridRegion rinfo = new GridRegion((Dictionary<string, object>)r);
rinfos.Add(rinfo); rinfos.Add(rinfo);
} }
else
m_log.DebugFormat("[GRID CONNECTOR]: GetRegionRange {0}, {1}-{2} {3}-{4} received invalid response",
scopeID, xmin, xmax, ymin, ymax);
} }
} }
else else
m_log.DebugFormat("[GRID CONNECTOR]: GetRegionRange {0}, {1}-{2} {3}-{4} received null response", m_log.DebugFormat("[GRID CONNECTOR]: GetRegionRange {0}, {1}-{2} {3}-{4} received null response",
scopeID, xmin, xmax, ymin, ymax); scopeID, xmin, xmax, ymin, ymax);
}
else
m_log.DebugFormat("[GRID CONNECTOR]: GetRegionRange received null reply");
return rinfos; return rinfos;
} }

View File

@ -263,6 +263,7 @@ namespace OpenSim.Services.Interfaces
kvp["uuid"] = RegionID.ToString(); kvp["uuid"] = RegionID.ToString();
kvp["locX"] = RegionLocX.ToString(); kvp["locX"] = RegionLocX.ToString();
kvp["locY"] = RegionLocY.ToString(); kvp["locY"] = RegionLocY.ToString();
kvp["name"] = RegionName;
kvp["external_ip_address"] = ExternalEndPoint.Address.ToString(); kvp["external_ip_address"] = ExternalEndPoint.Address.ToString();
kvp["external_port"] = ExternalEndPoint.Port.ToString(); kvp["external_port"] = ExternalEndPoint.Port.ToString();
kvp["external_host_name"] = ExternalHostName; kvp["external_host_name"] = ExternalHostName;
@ -286,6 +287,9 @@ namespace OpenSim.Services.Interfaces
if (kvp["locY"] != null) if (kvp["locY"] != null)
RegionLocY = Convert.ToInt32((string)kvp["locY"]); RegionLocY = Convert.ToInt32((string)kvp["locY"]);
if (kvp["name"] != null)
RegionName = (string)kvp["name"];
if ((kvp["external_ip_address"] != null) && (kvp["external_port"] != null)) if ((kvp["external_ip_address"] != null) && (kvp["external_port"] != null))
{ {
int port = 0; int port = 0;

View File

@ -35,21 +35,21 @@ namespace OpenSim.Tests.Clients.GridClient
GridRegion r2 = CreateRegion("Test Region 2", 1001, 1000); GridRegion r2 = CreateRegion("Test Region 2", 1001, 1000);
GridRegion r3 = CreateRegion("Test Region 3", 1005, 1000); GridRegion r3 = CreateRegion("Test Region 3", 1005, 1000);
Console.WriteLine("[GRID CLIENT]: Registering region 1"); Console.WriteLine("[GRID CLIENT]: *** Registering region 1");
bool success = m_Connector.RegisterRegion(UUID.Zero, r1); bool success = m_Connector.RegisterRegion(UUID.Zero, r1);
if (success) if (success)
Console.WriteLine("[GRID CLIENT]: Successfully registered region 1"); Console.WriteLine("[GRID CLIENT]: Successfully registered region 1");
else else
Console.WriteLine("[GRID CLIENT]: region 1 failed to register"); Console.WriteLine("[GRID CLIENT]: region 1 failed to register");
Console.WriteLine("[GRID CLIENT]: Registering region 2"); Console.WriteLine("[GRID CLIENT]: *** Registering region 2");
success = m_Connector.RegisterRegion(UUID.Zero, r2); success = m_Connector.RegisterRegion(UUID.Zero, r2);
if (success) if (success)
Console.WriteLine("[GRID CLIENT]: Successfully registered region 2"); Console.WriteLine("[GRID CLIENT]: Successfully registered region 2");
else else
Console.WriteLine("[GRID CLIENT]: region 2 failed to register"); Console.WriteLine("[GRID CLIENT]: region 2 failed to register");
Console.WriteLine("[GRID CLIENT]: Registering region 3"); Console.WriteLine("[GRID CLIENT]: *** Registering region 3");
success = m_Connector.RegisterRegion(UUID.Zero, r3); success = m_Connector.RegisterRegion(UUID.Zero, r3);
if (success) if (success)
Console.WriteLine("[GRID CLIENT]: Successfully registered region 3"); Console.WriteLine("[GRID CLIENT]: Successfully registered region 3");
@ -57,20 +57,20 @@ namespace OpenSim.Tests.Clients.GridClient
Console.WriteLine("[GRID CLIENT]: region 3 failed to register"); Console.WriteLine("[GRID CLIENT]: region 3 failed to register");
Console.WriteLine("[GRID CLIENT]: Deregistering region 3"); Console.WriteLine("[GRID CLIENT]: *** Deregistering region 3");
success = m_Connector.DeregisterRegion(r3.RegionID); success = m_Connector.DeregisterRegion(r3.RegionID);
if (success) if (success)
Console.WriteLine("[GRID CLIENT]: Successfully deregistered region 3"); Console.WriteLine("[GRID CLIENT]: Successfully deregistered region 3");
else else
Console.WriteLine("[GRID CLIENT]: region 3 failed to deregister"); Console.WriteLine("[GRID CLIENT]: region 3 failed to deregister");
Console.WriteLine("[GRID CLIENT]: Registering region 3 again"); Console.WriteLine("[GRID CLIENT]: *** Registering region 3 again");
success = m_Connector.RegisterRegion(UUID.Zero, r3); success = m_Connector.RegisterRegion(UUID.Zero, r3);
if (success) if (success)
Console.WriteLine("[GRID CLIENT]: Successfully registered region 3"); Console.WriteLine("[GRID CLIENT]: Successfully registered region 3");
else else
Console.WriteLine("[GRID CLIENT]: region 3 failed to register"); Console.WriteLine("[GRID CLIENT]: region 3 failed to register");
Console.WriteLine("[GRID CLIENT]: GetNeighbours of region 1"); Console.WriteLine("[GRID CLIENT]: *** GetNeighbours of region 1");
List<GridRegion> regions = m_Connector.GetNeighbours(UUID.Zero, r1.RegionID); List<GridRegion> regions = m_Connector.GetNeighbours(UUID.Zero, r1.RegionID);
if (regions == null) if (regions == null)
Console.WriteLine("[GRID CLIENT]: GetNeighbours of region 1 failed"); Console.WriteLine("[GRID CLIENT]: GetNeighbours of region 1 failed");
@ -85,6 +85,58 @@ namespace OpenSim.Tests.Clients.GridClient
Console.WriteLine("[GRID CLIENT]: GetNeighbours of region 1 returned 0 neighbours"); Console.WriteLine("[GRID CLIENT]: GetNeighbours of region 1 returned 0 neighbours");
Console.WriteLine("[GRID CLIENT]: *** GetRegionByUUID of region 2 (this should succeed)");
GridRegion region = m_Connector.GetRegionByUUID(UUID.Zero, r2.RegionID);
if (region == null)
Console.WriteLine("[GRID CLIENT]: GetRegionByUUID returned null");
else
Console.WriteLine("[GRID CLIENT]: GetRegionByUUID returned region " + region.RegionName);
Console.WriteLine("[GRID CLIENT]: *** GetRegionByUUID of non-existent region (this should fail)");
region = m_Connector.GetRegionByUUID(UUID.Zero, UUID.Random());
if (region == null)
Console.WriteLine("[GRID CLIENT]: GetRegionByUUID returned null");
else
Console.WriteLine("[GRID CLIENT]: GetRegionByUUID returned region " + region.RegionName);
Console.WriteLine("[GRID CLIENT]: *** GetRegionByName of region 3 (this should succeed)");
region = m_Connector.GetRegionByName(UUID.Zero, r3.RegionName);
if (region == null)
Console.WriteLine("[GRID CLIENT]: GetRegionByName returned null");
else
Console.WriteLine("[GRID CLIENT]: GetRegionByName returned region " + region.RegionName);
Console.WriteLine("[GRID CLIENT]: *** GetRegionByName of non-existent region (this should fail)");
region = m_Connector.GetRegionByName(UUID.Zero, "Foo");
if (region == null)
Console.WriteLine("[GRID CLIENT]: GetRegionByName returned null");
else
Console.WriteLine("[GRID CLIENT]: GetRegionByName returned region " + region.RegionName);
Console.WriteLine("[GRID CLIENT]: *** GetRegionsByName (this should return 3 regions)");
regions = m_Connector.GetRegionsByName(UUID.Zero, "Test", 10);
if (regions == null)
Console.WriteLine("[GRID CLIENT]: GetRegionsByName returned null");
else
Console.WriteLine("[GRID CLIENT]: GetRegionsByName returned " + regions.Count + " regions");
Console.WriteLine("[GRID CLIENT]: *** GetRegionRange (this should return 2 regions)");
regions = m_Connector.GetRegionRange(UUID.Zero,
900 * (int)Constants.RegionSize, 1002 * (int) Constants.RegionSize,
900 * (int)Constants.RegionSize, 1002 * (int) Constants.RegionSize);
if (regions == null)
Console.WriteLine("[GRID CLIENT]: GetRegionRange returned null");
else
Console.WriteLine("[GRID CLIENT]: GetRegionRange returned " + regions.Count + " regions");
Console.WriteLine("[GRID CLIENT]: *** GetRegionRange (this should return 0 regions)");
regions = m_Connector.GetRegionRange(UUID.Zero,
900 * (int)Constants.RegionSize, 950 * (int)Constants.RegionSize,
900 * (int)Constants.RegionSize, 950 * (int)Constants.RegionSize);
if (regions == null)
Console.WriteLine("[GRID CLIENT]: GetRegionRange returned null");
else
Console.WriteLine("[GRID CLIENT]: GetRegionRange returned " + regions.Count + " regions");
} }
private static GridRegion CreateRegion(string name, uint xcell, uint ycell) private static GridRegion CreateRegion(string name, uint xcell, uint ycell)