Change GridService.GetRegionByName() to only return info if there is an exact region name match, unlike GetRegionsByName()

This should fix the first part of http://opensimulator.org/mantis/view.php?id=5606, and maybe 5605.
Thanks to Melanie for helping with this.
bulletsim
Justin Clark-Casey (justincc) 2011-08-02 00:52:48 +01:00
parent e6fb9d74ef
commit 17e9d61f43
3 changed files with 12 additions and 3 deletions

View File

@ -64,10 +64,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests
} }
/// <summary> /// <summary>
/// Test saving a V0.2 OpenSim Region Archive. /// Test region registration.
/// </summary> /// </summary>
[Test] [Test]
public void TestRegisterRegionV0_2() public void TestRegisterRegion()
{ {
SetUp(); SetUp();
@ -123,6 +123,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests
m_LocalConnector.RegisterRegion(UUID.Zero, r1); m_LocalConnector.RegisterRegion(UUID.Zero, r1);
GridRegion result = m_LocalConnector.GetRegionByName(UUID.Zero, "Test"); GridRegion result = m_LocalConnector.GetRegionByName(UUID.Zero, "Test");
Assert.IsNull(result, "Retrieved GetRegionByName \"Test\" is not null");
result = m_LocalConnector.GetRegionByName(UUID.Zero, "Test Region 1");
Assert.IsNotNull(result, "Retrieved GetRegionByName is null"); Assert.IsNotNull(result, "Retrieved GetRegionByName is null");
Assert.That(result.RegionName, Is.EqualTo("Test Region 1"), "Retrieved region's name does not match"); Assert.That(result.RegionName, Is.EqualTo("Test Region 1"), "Retrieved region's name does not match");

View File

@ -322,7 +322,7 @@ namespace OpenSim.Services.GridService
public GridRegion GetRegionByName(UUID scopeID, string regionName) public GridRegion GetRegionByName(UUID scopeID, string regionName)
{ {
List<RegionData> rdatas = m_Database.Get(regionName + "%", scopeID); List<RegionData> rdatas = m_Database.Get(regionName, scopeID);
if ((rdatas != null) && (rdatas.Count > 0)) if ((rdatas != null) && (rdatas.Count > 0))
return RegionData2RegionInfo(rdatas[0]); // get the first return RegionData2RegionInfo(rdatas[0]); // get the first

View File

@ -71,6 +71,12 @@ namespace OpenSim.Services.Interfaces
/// <returns></returns> /// <returns></returns>
GridRegion GetRegionByPosition(UUID scopeID, int x, int y); GridRegion GetRegionByPosition(UUID scopeID, int x, int y);
/// <summary>
/// Get information about a region which exactly matches the name given.
/// </summary>
/// <param name="scopeID"></param>
/// <param name="regionName"></param>
/// <returns>Returns the region information if the name matched. Null otherwise.</returns>
GridRegion GetRegionByName(UUID scopeID, string regionName); GridRegion GetRegionByName(UUID scopeID, string regionName);
/// <summary> /// <summary>