aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs64
1 files changed, 57 insertions, 7 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs
index 2726ae8..ebfba2b 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs
@@ -57,6 +57,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests
57 config.Configs["Modules"].Set("GridServices", "LocalGridServicesConnector"); 57 config.Configs["Modules"].Set("GridServices", "LocalGridServicesConnector");
58 config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Services.GridService.dll:GridService"); 58 config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Services.GridService.dll:GridService");
59 config.Configs["GridService"].Set("StorageProvider", "OpenSim.Data.Null.dll"); 59 config.Configs["GridService"].Set("StorageProvider", "OpenSim.Data.Null.dll");
60 config.Configs["GridService"].Set("Region_Test_Region_1", "DefaultRegion");
61 config.Configs["GridService"].Set("Region_Test_Region_2", "FallbackRegion");
62 config.Configs["GridService"].Set("Region_Test_Region_3", "FallbackRegion");
63 config.Configs["GridService"].Set("Region_Other_Region_4", "FallbackRegion");
60 64
61 m_LocalConnector = new LocalGridServicesConnector(config); 65 m_LocalConnector = new LocalGridServicesConnector(config);
62 } 66 }
@@ -69,7 +73,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests
69 { 73 {
70 SetUp(); 74 SetUp();
71 75
72 // Create 3 regions 76 // Create 4 regions
73 GridRegion r1 = new GridRegion(); 77 GridRegion r1 = new GridRegion();
74 r1.RegionName = "Test Region 1"; 78 r1.RegionName = "Test Region 1";
75 r1.RegionID = new UUID(1); 79 r1.RegionID = new UUID(1);
@@ -82,7 +86,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests
82 s.RegionInfo.RegionID = r1.RegionID; 86 s.RegionInfo.RegionID = r1.RegionID;
83 m_LocalConnector.AddRegion(s); 87 m_LocalConnector.AddRegion(s);
84 88
85
86 GridRegion r2 = new GridRegion(); 89 GridRegion r2 = new GridRegion();
87 r2.RegionName = "Test Region 2"; 90 r2.RegionName = "Test Region 2";
88 r2.RegionID = new UUID(2); 91 r2.RegionID = new UUID(2);
@@ -107,11 +110,28 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests
107 s.RegionInfo.RegionID = r3.RegionID; 110 s.RegionInfo.RegionID = r3.RegionID;
108 m_LocalConnector.AddRegion(s); 111 m_LocalConnector.AddRegion(s);
109 112
113 GridRegion r4 = new GridRegion();
114 r4.RegionName = "Other Region 4";
115 r4.RegionID = new UUID(4);
116 r4.RegionLocX = 1004 * (int)Constants.RegionSize;
117 r4.RegionLocY = 1002 * (int)Constants.RegionSize;
118 r4.ExternalHostName = "127.0.0.1";
119 r4.HttpPort = 9004;
120 r4.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), 0);
121 s = new Scene(new RegionInfo());
122 s.RegionInfo.RegionID = r4.RegionID;
123 m_LocalConnector.AddRegion(s);
124
110 m_LocalConnector.RegisterRegion(UUID.Zero, r1); 125 m_LocalConnector.RegisterRegion(UUID.Zero, r1);
126
111 GridRegion result = m_LocalConnector.GetRegionByName(UUID.Zero, "Test"); 127 GridRegion result = m_LocalConnector.GetRegionByName(UUID.Zero, "Test");
112 Assert.IsNotNull(result, "Retrieved GetRegionByName is null"); 128 Assert.IsNotNull(result, "Retrieved GetRegionByName is null");
113 Assert.That(result.RegionName, Is.EqualTo("Test Region 1"), "Retrieved region's name does not match"); 129 Assert.That(result.RegionName, Is.EqualTo("Test Region 1"), "Retrieved region's name does not match");
114 130
131 m_LocalConnector.RegisterRegion(UUID.Zero, r2);
132 m_LocalConnector.RegisterRegion(UUID.Zero, r3);
133 m_LocalConnector.RegisterRegion(UUID.Zero, r4);
134
115 result = m_LocalConnector.GetRegionByUUID(UUID.Zero, new UUID(1)); 135 result = m_LocalConnector.GetRegionByUUID(UUID.Zero, new UUID(1));
116 Assert.IsNotNull(result, "Retrieved GetRegionByUUID is null"); 136 Assert.IsNotNull(result, "Retrieved GetRegionByUUID is null");
117 Assert.That(result.RegionID, Is.EqualTo(new UUID(1)), "Retrieved region's UUID does not match"); 137 Assert.That(result.RegionID, Is.EqualTo(new UUID(1)), "Retrieved region's UUID does not match");
@@ -120,23 +140,53 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests
120 Assert.IsNotNull(result, "Retrieved GetRegionByPosition is null"); 140 Assert.IsNotNull(result, "Retrieved GetRegionByPosition is null");
121 Assert.That(result.RegionLocX, Is.EqualTo(1000 * (int)Constants.RegionSize), "Retrieved region's position does not match"); 141 Assert.That(result.RegionLocX, Is.EqualTo(1000 * (int)Constants.RegionSize), "Retrieved region's position does not match");
122 142
123 m_LocalConnector.RegisterRegion(UUID.Zero, r2);
124 m_LocalConnector.RegisterRegion(UUID.Zero, r3);
125
126 List<GridRegion> results = m_LocalConnector.GetNeighbours(UUID.Zero, new UUID(1)); 143 List<GridRegion> results = m_LocalConnector.GetNeighbours(UUID.Zero, new UUID(1));
127 Assert.IsNotNull(results, "Retrieved neighbours list is null"); 144 Assert.IsNotNull(results, "Retrieved neighbours list is null");
128 Assert.That(results.Count, Is.EqualTo(1), "Retrieved neighbour collection is greater than expected"); 145 Assert.That(results.Count, Is.EqualTo(1), "Retrieved neighbour collection is greater than expected");
129 Assert.That(results[0].RegionID, Is.EqualTo(new UUID(2)), "Retrieved region's UUID does not match"); 146 Assert.That(results[0].RegionID, Is.EqualTo(new UUID(2)), "Retrieved region's UUID does not match");
130 147
131 results = m_LocalConnector.GetRegionsByName(UUID.Zero, "Test", 10); 148 results = m_LocalConnector.GetRegionsByName(UUID.Zero, "Test", 10);
132 Assert.IsNotNull(results, "Retrieved GetRegionsByName list is null"); 149 Assert.IsNotNull(results, "Retrieved GetRegionsByName collection is null");
133 Assert.That(results.Count, Is.EqualTo(3), "Retrieved neighbour collection is less than expected"); 150 Assert.That(results.Count, Is.EqualTo(3), "Retrieved neighbour collection is less than expected");
134 151
135 results = m_LocalConnector.GetRegionRange(UUID.Zero, 900 * (int)Constants.RegionSize, 1002 * (int)Constants.RegionSize, 152 results = m_LocalConnector.GetRegionRange(UUID.Zero, 900 * (int)Constants.RegionSize, 1002 * (int)Constants.RegionSize,
136 900 * (int)Constants.RegionSize, 1100 * (int)Constants.RegionSize); 153 900 * (int)Constants.RegionSize, 1100 * (int)Constants.RegionSize);
137 Assert.IsNotNull(results, "Retrieved GetRegionRange list is null"); 154 Assert.IsNotNull(results, "Retrieved GetRegionRange collection is null");
138 Assert.That(results.Count, Is.EqualTo(2), "Retrieved neighbour collection is not the number expected"); 155 Assert.That(results.Count, Is.EqualTo(2), "Retrieved neighbour collection is not the number expected");
139 156
157 results = m_LocalConnector.GetDefaultRegions(UUID.Zero);
158 Assert.IsNotNull(results, "Retrieved GetDefaultRegions collection is null");
159 Assert.That(results.Count, Is.EqualTo(1), "Retrieved default regions collection has not the expected size");
160 Assert.That(results[0].RegionID, Is.EqualTo(new UUID(1)), "Retrieved default region's UUID does not match");
161
162 results = m_LocalConnector.GetFallbackRegions(UUID.Zero, r1.RegionLocX, r1.RegionLocY);
163 Assert.IsNotNull(results, "Retrieved GetFallbackRegions collection for region 1 is null");
164 Assert.That(results.Count, Is.EqualTo(3), "Retrieved fallback regions collection for region 1 has not the expected size");
165 Assert.That(results[0].RegionID, Is.EqualTo(new UUID(2)), "Retrieved fallback regions for default region are not in the expected order 2-4-3");
166 Assert.That(results[1].RegionID, Is.EqualTo(new UUID(4)), "Retrieved fallback regions for default region are not in the expected order 2-4-3");
167 Assert.That(results[2].RegionID, Is.EqualTo(new UUID(3)), "Retrieved fallback regions for default region are not in the expected order 2-4-3");
168
169 results = m_LocalConnector.GetFallbackRegions(UUID.Zero, r2.RegionLocX, r2.RegionLocY);
170 Assert.IsNotNull(results, "Retrieved GetFallbackRegions collection for region 2 is null");
171 Assert.That(results.Count, Is.EqualTo(3), "Retrieved fallback regions collection for region 2 has not the expected size");
172 Assert.That(results[0].RegionID, Is.EqualTo(new UUID(2)), "Retrieved fallback regions are not in the expected order 2-4-3");
173 Assert.That(results[1].RegionID, Is.EqualTo(new UUID(4)), "Retrieved fallback regions are not in the expected order 2-4-3");
174 Assert.That(results[2].RegionID, Is.EqualTo(new UUID(3)), "Retrieved fallback regions are not in the expected order 2-4-3");
175
176 results = m_LocalConnector.GetFallbackRegions(UUID.Zero, r3.RegionLocX, r3.RegionLocY);
177 Assert.IsNotNull(results, "Retrieved GetFallbackRegions collection for region 3 is null");
178 Assert.That(results.Count, Is.EqualTo(3), "Retrieved fallback regions collection for region 3 has not the expected size");
179 Assert.That(results[0].RegionID, Is.EqualTo(new UUID(3)), "Retrieved fallback regions are not in the expected order 3-4-2");
180 Assert.That(results[1].RegionID, Is.EqualTo(new UUID(4)), "Retrieved fallback regions are not in the expected order 3-4-2");
181 Assert.That(results[2].RegionID, Is.EqualTo(new UUID(2)), "Retrieved fallback regions are not in the expected order 3-4-2");
182
183 results = m_LocalConnector.GetFallbackRegions(UUID.Zero, r4.RegionLocX, r4.RegionLocY);
184 Assert.IsNotNull(results, "Retrieved GetFallbackRegions collection for region 4 is null");
185 Assert.That(results.Count, Is.EqualTo(3), "Retrieved fallback regions collection for region 4 has not the expected size");
186 Assert.That(results[0].RegionID, Is.EqualTo(new UUID(4)), "Retrieved fallback regions are not in the expected order 4-3-2");
187 Assert.That(results[1].RegionID, Is.EqualTo(new UUID(3)), "Retrieved fallback regions are not in the expected order 4-3-2");
188 Assert.That(results[2].RegionID, Is.EqualTo(new UUID(2)), "Retrieved fallback regions are not in the expected order 4-3-2");
189
140 results = m_LocalConnector.GetHyperlinks(UUID.Zero); 190 results = m_LocalConnector.GetHyperlinks(UUID.Zero);
141 Assert.IsNotNull(results, "Retrieved GetHyperlinks list is null"); 191 Assert.IsNotNull(results, "Retrieved GetHyperlinks list is null");
142 Assert.That(results.Count, Is.EqualTo(0), "Retrieved linked regions collection is not the number expected"); 192 Assert.That(results.Count, Is.EqualTo(0), "Retrieved linked regions collection is not the number expected");