From 17e9d61f4383627434b7b8249cea1a487f001099 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 2 Aug 2011 00:52:48 +0100
Subject: 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.
---
.../ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs | 7 +++++--
OpenSim/Services/GridService/GridService.cs | 2 +-
OpenSim/Services/Interfaces/IGridService.cs | 6 ++++++
3 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs
index c044407..cd7d6bc 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs
@@ -64,10 +64,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests
}
///
- /// Test saving a V0.2 OpenSim Region Archive.
+ /// Test region registration.
///
[Test]
- public void TestRegisterRegionV0_2()
+ public void TestRegisterRegion()
{
SetUp();
@@ -123,6 +123,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests
m_LocalConnector.RegisterRegion(UUID.Zero, r1);
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.That(result.RegionName, Is.EqualTo("Test Region 1"), "Retrieved region's name does not match");
diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs
index 985d77b..a6fbc00 100644
--- a/OpenSim/Services/GridService/GridService.cs
+++ b/OpenSim/Services/GridService/GridService.cs
@@ -322,7 +322,7 @@ namespace OpenSim.Services.GridService
public GridRegion GetRegionByName(UUID scopeID, string regionName)
{
- List rdatas = m_Database.Get(regionName + "%", scopeID);
+ List rdatas = m_Database.Get(regionName, scopeID);
if ((rdatas != null) && (rdatas.Count > 0))
return RegionData2RegionInfo(rdatas[0]); // get the first
diff --git a/OpenSim/Services/Interfaces/IGridService.cs b/OpenSim/Services/Interfaces/IGridService.cs
index a34f0be..41dd20c 100644
--- a/OpenSim/Services/Interfaces/IGridService.cs
+++ b/OpenSim/Services/Interfaces/IGridService.cs
@@ -71,6 +71,12 @@ namespace OpenSim.Services.Interfaces
///
GridRegion GetRegionByPosition(UUID scopeID, int x, int y);
+ ///
+ /// Get information about a region which exactly matches the name given.
+ ///
+ ///
+ ///
+ /// Returns the region information if the name matched. Null otherwise.
GridRegion GetRegionByName(UUID scopeID, string regionName);
///
--
cgit v1.1