diff options
author | Justin Clark-Casey (justincc) | 2011-08-02 00:52:48 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-08-02 00:52:48 +0100 |
commit | 17e9d61f4383627434b7b8249cea1a487f001099 (patch) | |
tree | db497607c82b32e8567f1a5ff36ca85250c3a225 | |
parent | Revert "In GridService, have GetRegionByName() call GetRegionsByName() with a... (diff) | |
download | opensim-SC-17e9d61f4383627434b7b8249cea1a487f001099.zip opensim-SC-17e9d61f4383627434b7b8249cea1a487f001099.tar.gz opensim-SC-17e9d61f4383627434b7b8249cea1a487f001099.tar.bz2 opensim-SC-17e9d61f4383627434b7b8249cea1a487f001099.tar.xz |
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.
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 | |||
64 | } | 64 | } |
65 | 65 | ||
66 | /// <summary> | 66 | /// <summary> |
67 | /// Test saving a V0.2 OpenSim Region Archive. | 67 | /// Test region registration. |
68 | /// </summary> | 68 | /// </summary> |
69 | [Test] | 69 | [Test] |
70 | public void TestRegisterRegionV0_2() | 70 | public void TestRegisterRegion() |
71 | { | 71 | { |
72 | SetUp(); | 72 | SetUp(); |
73 | 73 | ||
@@ -123,6 +123,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests | |||
123 | m_LocalConnector.RegisterRegion(UUID.Zero, r1); | 123 | m_LocalConnector.RegisterRegion(UUID.Zero, r1); |
124 | 124 | ||
125 | GridRegion result = m_LocalConnector.GetRegionByName(UUID.Zero, "Test"); | 125 | GridRegion result = m_LocalConnector.GetRegionByName(UUID.Zero, "Test"); |
126 | Assert.IsNull(result, "Retrieved GetRegionByName \"Test\" is not null"); | ||
127 | |||
128 | result = m_LocalConnector.GetRegionByName(UUID.Zero, "Test Region 1"); | ||
126 | Assert.IsNotNull(result, "Retrieved GetRegionByName is null"); | 129 | Assert.IsNotNull(result, "Retrieved GetRegionByName is null"); |
127 | Assert.That(result.RegionName, Is.EqualTo("Test Region 1"), "Retrieved region's name does not match"); | 130 | Assert.That(result.RegionName, Is.EqualTo("Test Region 1"), "Retrieved region's name does not match"); |
128 | 131 | ||
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 | |||
322 | 322 | ||
323 | public GridRegion GetRegionByName(UUID scopeID, string regionName) | 323 | public GridRegion GetRegionByName(UUID scopeID, string regionName) |
324 | { | 324 | { |
325 | List<RegionData> rdatas = m_Database.Get(regionName + "%", scopeID); | 325 | List<RegionData> rdatas = m_Database.Get(regionName, scopeID); |
326 | if ((rdatas != null) && (rdatas.Count > 0)) | 326 | if ((rdatas != null) && (rdatas.Count > 0)) |
327 | return RegionData2RegionInfo(rdatas[0]); // get the first | 327 | return RegionData2RegionInfo(rdatas[0]); // get the first |
328 | 328 | ||
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 | |||
71 | /// <returns></returns> | 71 | /// <returns></returns> |
72 | GridRegion GetRegionByPosition(UUID scopeID, int x, int y); | 72 | GridRegion GetRegionByPosition(UUID scopeID, int x, int y); |
73 | 73 | ||
74 | /// <summary> | ||
75 | /// Get information about a region which exactly matches the name given. | ||
76 | /// </summary> | ||
77 | /// <param name="scopeID"></param> | ||
78 | /// <param name="regionName"></param> | ||
79 | /// <returns>Returns the region information if the name matched. Null otherwise.</returns> | ||
74 | GridRegion GetRegionByName(UUID scopeID, string regionName); | 80 | GridRegion GetRegionByName(UUID scopeID, string regionName); |
75 | 81 | ||
76 | /// <summary> | 82 | /// <summary> |