aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-12-03 18:59:54 +0000
committerJustin Clark-Casey (justincc)2011-12-03 18:59:54 +0000
commit4919c6056022053f8632b030a06fd8f48ac02a8e (patch)
tree098bfeaf1aa751f20e2bc4791f26302e74417d05
parentImprove locking in AgentCircuitManager (diff)
downloadopensim-SC-4919c6056022053f8632b030a06fd8f48ac02a8e.zip
opensim-SC-4919c6056022053f8632b030a06fd8f48ac02a8e.tar.gz
opensim-SC-4919c6056022053f8632b030a06fd8f48ac02a8e.tar.bz2
opensim-SC-4919c6056022053f8632b030a06fd8f48ac02a8e.tar.xz
Add beginning of ScenePresenceAgentTests.TestCreateChildScenePresence()
This required an option to be added to NullRegionData via ConnectionString for it to act as a non-static instance, so that regression tests (which only load this class once) don't get hopeless confused and complex to compensate. Normal standalone operation unaffected.
-rw-r--r--OpenSim/Data/Null/NullRegionData.cs40
-rw-r--r--OpenSim/Framework/Tests/AgentCircuitManagerTests.cs2
-rw-r--r--OpenSim/Framework/Tests/AnimationTests.cs2
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs1
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs9
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs57
-rw-r--r--OpenSim/Tests/Common/Helpers/SceneHelpers.cs3
-rw-r--r--prebuild.xml1
8 files changed, 86 insertions, 29 deletions
diff --git a/OpenSim/Data/Null/NullRegionData.cs b/OpenSim/Data/Null/NullRegionData.cs
index 9d09af7..deb50cb 100644
--- a/OpenSim/Data/Null/NullRegionData.cs
+++ b/OpenSim/Data/Null/NullRegionData.cs
@@ -40,24 +40,40 @@ namespace OpenSim.Data.Null
40 { 40 {
41 private static NullRegionData Instance = null; 41 private static NullRegionData Instance = null;
42 42
43 /// <summary>
44 /// Should we use the static instance for all invocations?
45 /// </summary>
46 private bool m_useStaticInstance = true;
47
43// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 48// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
44 49
45 Dictionary<UUID, RegionData> m_regionData = new Dictionary<UUID, RegionData>(); 50 Dictionary<UUID, RegionData> m_regionData = new Dictionary<UUID, RegionData>();
46 51
47 public NullRegionData(string connectionString, string realm) 52 public NullRegionData(string connectionString, string realm)
48 { 53 {
49 if (Instance == null) 54// m_log.DebugFormat(
55// "[NULL REGION DATA]: Constructor got connectionString {0}, realm {1}", connectionString, realm);
56
57 // The !static connection string is a hack so that regression tests can use this module without a high degree of fragility
58 // in having to deal with the static reference in the once-loaded NullRegionData class.
59 //
60 // In standalone operation, we have to use only one instance of this class since the login service and
61 // simulator have no other way of using a common data store.
62 if (connectionString == "!static")
63 m_useStaticInstance = false;
64 else if (Instance == null)
50 Instance = this; 65 Instance = this;
51 //Console.WriteLine("[XXX] NullRegionData constructor");
52 } 66 }
53 67
54 private delegate bool Matcher(string value); 68 private delegate bool Matcher(string value);
55 69
56 public List<RegionData> Get(string regionName, UUID scopeID) 70 public List<RegionData> Get(string regionName, UUID scopeID)
57 { 71 {
58 if (Instance != this) 72 if (m_useStaticInstance && Instance != this)
59 return Instance.Get(regionName, scopeID); 73 return Instance.Get(regionName, scopeID);
60 74
75// m_log.DebugFormat("[NULL REGION DATA]: Getting region {0}, scope {1}", regionName, scopeID);
76
61 string cleanName = regionName.ToLower(); 77 string cleanName = regionName.ToLower();
62 78
63 // Handle SQL wildcards 79 // Handle SQL wildcards
@@ -82,6 +98,7 @@ namespace OpenSim.Data.Null
82 cleanName = cleanName.Remove(cleanName.Length - 1); 98 cleanName = cleanName.Remove(cleanName.Length - 1);
83 } 99 }
84 } 100 }
101
85 Matcher queryMatch; 102 Matcher queryMatch;
86 if (wildcardPrefix && wildcardSuffix) 103 if (wildcardPrefix && wildcardSuffix)
87 queryMatch = delegate(string s) { return s.Contains(cleanName); }; 104 queryMatch = delegate(string s) { return s.Contains(cleanName); };
@@ -110,7 +127,7 @@ namespace OpenSim.Data.Null
110 127
111 public RegionData Get(int posX, int posY, UUID scopeID) 128 public RegionData Get(int posX, int posY, UUID scopeID)
112 { 129 {
113 if (Instance != this) 130 if (m_useStaticInstance && Instance != this)
114 return Instance.Get(posX, posY, scopeID); 131 return Instance.Get(posX, posY, scopeID);
115 132
116 List<RegionData> ret = new List<RegionData>(); 133 List<RegionData> ret = new List<RegionData>();
@@ -129,7 +146,7 @@ namespace OpenSim.Data.Null
129 146
130 public RegionData Get(UUID regionID, UUID scopeID) 147 public RegionData Get(UUID regionID, UUID scopeID)
131 { 148 {
132 if (Instance != this) 149 if (m_useStaticInstance && Instance != this)
133 return Instance.Get(regionID, scopeID); 150 return Instance.Get(regionID, scopeID);
134 151
135 if (m_regionData.ContainsKey(regionID)) 152 if (m_regionData.ContainsKey(regionID))
@@ -140,7 +157,7 @@ namespace OpenSim.Data.Null
140 157
141 public List<RegionData> Get(int startX, int startY, int endX, int endY, UUID scopeID) 158 public List<RegionData> Get(int startX, int startY, int endX, int endY, UUID scopeID)
142 { 159 {
143 if (Instance != this) 160 if (m_useStaticInstance && Instance != this)
144 return Instance.Get(startX, startY, endX, endY, scopeID); 161 return Instance.Get(startX, startY, endX, endY, scopeID);
145 162
146 List<RegionData> ret = new List<RegionData>(); 163 List<RegionData> ret = new List<RegionData>();
@@ -156,9 +173,12 @@ namespace OpenSim.Data.Null
156 173
157 public bool Store(RegionData data) 174 public bool Store(RegionData data)
158 { 175 {
159 if (Instance != this) 176 if (m_useStaticInstance && Instance != this)
160 return Instance.Store(data); 177 return Instance.Store(data);
161 178
179// m_log.DebugFormat(
180// "[NULL REGION DATA]: Storing region {0} {1}, scope {2}", data.RegionName, data.RegionID, data.ScopeID);
181
162 m_regionData[data.RegionID] = data; 182 m_regionData[data.RegionID] = data;
163 183
164 return true; 184 return true;
@@ -166,7 +186,7 @@ namespace OpenSim.Data.Null
166 186
167 public bool SetDataItem(UUID regionID, string item, string value) 187 public bool SetDataItem(UUID regionID, string item, string value)
168 { 188 {
169 if (Instance != this) 189 if (m_useStaticInstance && Instance != this)
170 return Instance.SetDataItem(regionID, item, value); 190 return Instance.SetDataItem(regionID, item, value);
171 191
172 if (!m_regionData.ContainsKey(regionID)) 192 if (!m_regionData.ContainsKey(regionID))
@@ -179,9 +199,11 @@ namespace OpenSim.Data.Null
179 199
180 public bool Delete(UUID regionID) 200 public bool Delete(UUID regionID)
181 { 201 {
182 if (Instance != this) 202 if (m_useStaticInstance && Instance != this)
183 return Instance.Delete(regionID); 203 return Instance.Delete(regionID);
184 204
205// m_log.DebugFormat("[NULL REGION DATA]: Deleting region {0}", regionID);
206
185 if (!m_regionData.ContainsKey(regionID)) 207 if (!m_regionData.ContainsKey(regionID))
186 return false; 208 return false;
187 209
diff --git a/OpenSim/Framework/Tests/AgentCircuitManagerTests.cs b/OpenSim/Framework/Tests/AgentCircuitManagerTests.cs
index 9615f1b..ae132c8 100644
--- a/OpenSim/Framework/Tests/AgentCircuitManagerTests.cs
+++ b/OpenSim/Framework/Tests/AgentCircuitManagerTests.cs
@@ -194,8 +194,6 @@ namespace OpenSim.Framework.Tests
194 194
195 resp = agentCircuitManager.AuthenticateSession(SessionId2, AgentId2, circuitcode2); 195 resp = agentCircuitManager.AuthenticateSession(SessionId2, AgentId2, circuitcode2);
196 Assert.That(!resp.Authorised); 196 Assert.That(!resp.Authorised);
197
198 } 197 }
199
200 } 198 }
201} 199}
diff --git a/OpenSim/Framework/Tests/AnimationTests.cs b/OpenSim/Framework/Tests/AnimationTests.cs
index aa4c6aa..967a355 100644
--- a/OpenSim/Framework/Tests/AnimationTests.cs
+++ b/OpenSim/Framework/Tests/AnimationTests.cs
@@ -87,8 +87,6 @@ namespace OpenSim.Framework.Tests
87 anim4.SequenceNum = anim2.SequenceNum; 87 anim4.SequenceNum = anim2.SequenceNum;
88 88
89 Assert.That(anim4.ObjectID == objUUID2 && anim4.AnimID == animUUID2 && anim4.SequenceNum == 1, "void constructor and manual field population failed to set the properties correctly."); 89 Assert.That(anim4.ObjectID == objUUID2 && anim4.AnimID == animUUID2 && anim4.SequenceNum == 1, "void constructor and manual field population failed to set the properties correctly.");
90
91
92 } 90 }
93 } 91 }
94} \ No newline at end of file 92} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index 99064c8..2f947fd 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -1341,7 +1341,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1341 1341
1342 string reason = String.Empty; 1342 string reason = String.Empty;
1343 1343
1344
1345 bool regionAccepted = m_scene.SimulationService.CreateAgent(reg, a, (uint)TeleportFlags.Default, out reason); 1344 bool regionAccepted = m_scene.SimulationService.CreateAgent(reg, a, (uint)TeleportFlags.Default, out reason);
1346 1345
1347 if (regionAccepted && newAgent) 1346 if (regionAccepted && newAgent)
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs
index cd7d6bc..b286d17 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs
@@ -31,11 +31,10 @@ using System.IO;
31using System.Reflection; 31using System.Reflection;
32using System.Threading; 32using System.Threading;
33using log4net.Config; 33using log4net.Config;
34using Nini.Config;
34using NUnit.Framework; 35using NUnit.Framework;
35using OpenMetaverse; 36using OpenMetaverse;
36using OpenSim.Framework; 37using OpenSim.Framework;
37using Nini.Config;
38
39using OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid; 38using OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid;
40using OpenSim.Region.Framework.Scenes; 39using OpenSim.Region.Framework.Scenes;
41using GridRegion = OpenSim.Services.Interfaces.GridRegion; 40using GridRegion = OpenSim.Services.Interfaces.GridRegion;
@@ -69,6 +68,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests
69 [Test] 68 [Test]
70 public void TestRegisterRegion() 69 public void TestRegisterRegion()
71 { 70 {
71 TestHelpers.InMethod();
72// log4net.Config.XmlConfigurator.Configure();
73
72 SetUp(); 74 SetUp();
73 75
74 // Create 4 regions 76 // Create 4 regions
@@ -191,7 +193,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests
191 results = m_LocalConnector.GetHyperlinks(UUID.Zero); 193 results = m_LocalConnector.GetHyperlinks(UUID.Zero);
192 Assert.IsNotNull(results, "Retrieved GetHyperlinks list is null"); 194 Assert.IsNotNull(results, "Retrieved GetHyperlinks list is null");
193 Assert.That(results.Count, Is.EqualTo(0), "Retrieved linked regions collection is not the number expected"); 195 Assert.That(results.Count, Is.EqualTo(0), "Retrieved linked regions collection is not the number expected");
194
195 } 196 }
196 } 197 }
197} 198} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
index 57d22bd..f479e12 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
@@ -31,7 +31,7 @@ using System.Reflection;
31using System.Text; 31using System.Text;
32using System.Threading; 32using System.Threading;
33using System.Timers; 33using System.Timers;
34using Timer=System.Timers.Timer; 34using Timer = System.Timers.Timer;
35using Nini.Config; 35using Nini.Config;
36using NUnit.Framework; 36using NUnit.Framework;
37using OpenMetaverse; 37using OpenMetaverse;
@@ -39,11 +39,13 @@ using OpenSim.Framework;
39using OpenSim.Framework.Communications; 39using OpenSim.Framework.Communications;
40using OpenSim.Region.Framework.Scenes; 40using OpenSim.Region.Framework.Scenes;
41using OpenSim.Region.Framework.Interfaces; 41using OpenSim.Region.Framework.Interfaces;
42using OpenSim.Region.ClientStack.Linden;
42using OpenSim.Region.CoreModules.Framework.EntityTransfer; 43using OpenSim.Region.CoreModules.Framework.EntityTransfer;
43using OpenSim.Region.CoreModules.World.Serialiser; 44using OpenSim.Region.CoreModules.World.Serialiser;
44using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; 45using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
45using OpenSim.Tests.Common; 46using OpenSim.Tests.Common;
46using OpenSim.Tests.Common.Mock; 47using OpenSim.Tests.Common.Mock;
48using GridRegion = OpenSim.Services.Interfaces.GridRegion;
47 49
48namespace OpenSim.Region.Framework.Scenes.Tests 50namespace OpenSim.Region.Framework.Scenes.Tests
49{ 51{
@@ -112,14 +114,40 @@ namespace OpenSim.Region.Framework.Scenes.Tests
112 Assert.That(scene.AuthenticateHandler.GetAgentCircuits().Count, Is.EqualTo(0)); 114 Assert.That(scene.AuthenticateHandler.GetAgentCircuits().Count, Is.EqualTo(0));
113 } 115 }
114 116
117 [Test]
118 public void TestCreateChildScenePresence()
119 {
120 TestHelpers.InMethod();
121// log4net.Config.XmlConfigurator.Configure();
122
123 LocalSimulationConnectorModule lsc = new LocalSimulationConnectorModule();
124
125 IConfigSource configSource = new IniConfigSource();
126 IConfig config = configSource.AddConfig("Modules");
127 config.Set("SimulationServices", "LocalSimulationConnectorModule");
128
129 TestScene scene = SceneHelpers.SetupScene();
130 SceneHelpers.SetupSceneModules(scene, configSource, lsc);
131
132 UUID agentId = TestHelpers.ParseTail(0x01);
133 AgentCircuitData acd = SceneHelpers.GenerateAgentData(agentId);
134
135 GridRegion region = scene.GridService.GetRegionByName(UUID.Zero, scene.RegionInfo.RegionName);
136 string reason;
137 scene.SimulationService.CreateAgent(region, acd, (uint)TeleportFlags.ViaLogin, out reason);
138
139 Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(agentId), Is.Not.Null);
140 Assert.That(scene.AuthenticateHandler.GetAgentCircuits().Count, Is.EqualTo(1));
141 }
142
115 /// <summary> 143 /// <summary>
116 /// Test that if a root agent logs into a region, a child agent is also established in the neighbouring region 144 /// Test that if a root agent logs into a region, a child agent is also established in the neighbouring region
117 /// </summary> 145 /// </summary>
118 /// <remarks> 146 /// <remarks>
119 /// Please note that unlike the other tests here, this doesn't rely on structures 147 /// Please note that unlike the other tests here, this doesn't rely on anything set up in the instance fields.
120 /// </remarks> 148 /// </remarks>
121 [Test] 149 [Test]
122 public void TestChildAgentEstablished() 150 public void TestChildAgentEstablishedInNeighbour()
123 { 151 {
124 TestHelpers.InMethod(); 152 TestHelpers.InMethod();
125// log4net.Config.XmlConfigurator.Configure(); 153// log4net.Config.XmlConfigurator.Configure();
@@ -127,18 +155,25 @@ namespace OpenSim.Region.Framework.Scenes.Tests
127 UUID agent1Id = UUID.Parse("00000000-0000-0000-0000-000000000001"); 155 UUID agent1Id = UUID.Parse("00000000-0000-0000-0000-000000000001");
128 156
129 TestScene myScene1 = SceneHelpers.SetupScene("Neighbour y", UUID.Random(), 1000, 1000); 157 TestScene myScene1 = SceneHelpers.SetupScene("Neighbour y", UUID.Random(), 1000, 1000);
130// TestScene myScene2 = SceneHelpers.SetupScene("Neighbour y + 1", UUID.Random(), 1001, 1000); 158 TestScene myScene2 = SceneHelpers.SetupScene("Neighbour y + 1", UUID.Random(), 1001, 1000);
131 159
132 IConfigSource configSource = new IniConfigSource(); 160 IConfigSource configSource = new IniConfigSource();
133 configSource.AddConfig("Modules").Set("EntityTransferModule", "BasicEntityTransferModule"); 161 IConfig config = configSource.AddConfig("Startup");
162 config.Set("serverside_object_permissions", true);
163 config.Set("EventQueue", true);
164
134 EntityTransferModule etm = new EntityTransferModule(); 165 EntityTransferModule etm = new EntityTransferModule();
166
167 EventQueueGetModule eqgm1 = new EventQueueGetModule();
168 SceneHelpers.SetupSceneModules(myScene1, configSource, etm, eqgm1);
169
170 EventQueueGetModule eqgm2 = new EventQueueGetModule();
171 SceneHelpers.SetupSceneModules(myScene2, configSource, etm, eqgm2);
135 172
136 SceneHelpers.SetupSceneModules(myScene1, configSource, etm); 173// SceneHelpers.AddScenePresence(myScene1, agent1Id);
137
138 SceneHelpers.AddScenePresence(myScene1, agent1Id);
139// ScenePresence childPresence = myScene2.GetScenePresence(agent1); 174// ScenePresence childPresence = myScene2.GetScenePresence(agent1);
140 175//
141 // TODO: Need to do a fair amount of work to allow synchronous establishment of child agents 176// // TODO: Need to do a fair amount of work to allow synchronous establishment of child agents
142// Assert.That(childPresence, Is.Not.Null); 177// Assert.That(childPresence, Is.Not.Null);
143// Assert.That(childPresence.IsChildAgent, Is.True); 178// Assert.That(childPresence.IsChildAgent, Is.True);
144 } 179 }
diff --git a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs
index d358ae8..e4640be 100644
--- a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs
+++ b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs
@@ -49,6 +49,7 @@ using OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts;
49using OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence; 49using OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence;
50using OpenSim.Services.Interfaces; 50using OpenSim.Services.Interfaces;
51using OpenSim.Tests.Common.Mock; 51using OpenSim.Tests.Common.Mock;
52using GridRegion = OpenSim.Services.Interfaces.GridRegion;
52 53
53namespace OpenSim.Tests.Common 54namespace OpenSim.Tests.Common
54{ 55{
@@ -139,6 +140,7 @@ namespace OpenSim.Tests.Common
139 140
140 testScene.RegionInfo.EstateSettings = new EstateSettings(); 141 testScene.RegionInfo.EstateSettings = new EstateSettings();
141 testScene.LoginsDisabled = false; 142 testScene.LoginsDisabled = false;
143 testScene.RegisterRegionWithGrid();
142 144
143 return testScene; 145 return testScene;
144 } 146 }
@@ -222,6 +224,7 @@ namespace OpenSim.Tests.Common
222 config.Configs["Modules"].Set("GridServices", "LocalGridServicesConnector"); 224 config.Configs["Modules"].Set("GridServices", "LocalGridServicesConnector");
223 config.Configs["GridService"].Set("StorageProvider", "OpenSim.Data.Null.dll:NullRegionData"); 225 config.Configs["GridService"].Set("StorageProvider", "OpenSim.Data.Null.dll:NullRegionData");
224 config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Services.GridService.dll:GridService"); 226 config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Services.GridService.dll:GridService");
227 config.Configs["GridService"].Set("ConnectionString", "!static");
225 228
226 LocalGridServicesConnector gridService = new LocalGridServicesConnector(); 229 LocalGridServicesConnector gridService = new LocalGridServicesConnector();
227 gridService.Initialise(config); 230 gridService.Initialise(config);
diff --git a/prebuild.xml b/prebuild.xml
index a7e3bde..4e36172 100644
--- a/prebuild.xml
+++ b/prebuild.xml
@@ -3016,6 +3016,7 @@
3016 <Reference name="OpenSim.Framework.Servers"/> 3016 <Reference name="OpenSim.Framework.Servers"/>
3017 <Reference name="OpenSim.Framework.Statistics"/> 3017 <Reference name="OpenSim.Framework.Statistics"/>
3018 <Reference name="OpenSim.Framework.Servers.HttpServer"/> 3018 <Reference name="OpenSim.Framework.Servers.HttpServer"/>
3019 <Reference name="OpenSim.Region.ClientStack.LindenCaps"/>
3019 <Reference name="OpenSim.Region.Framework"/> 3020 <Reference name="OpenSim.Region.Framework"/>
3020 <Reference name="OpenSim.Region.CoreModules"/> 3021 <Reference name="OpenSim.Region.CoreModules"/>
3021 <Reference name="OpenSim.Region.OptionalModules"/> 3022 <Reference name="OpenSim.Region.OptionalModules"/>