29 using System.Collections.Generic;
33 using NUnit.Framework;
36 using OpenSim.ApplicationPlugins.RegionModulesController;
37 using OpenSim.Framework;
38 using OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid;
39 using OpenSim.Region.Framework.Interfaces;
40 using OpenSim.Tests.Common;
49 TestHelpers.InMethod();
50 TestHelpers.EnableLogging();
52 UUID estateOwnerId = TestHelpers.ParseTail(0x1);
53 UUID regionId = TestHelpers.ParseTail(0x10);
55 IConfigSource configSource =
new IniConfigSource();
56 configSource.AddConfig(
"Startup");
57 configSource.AddConfig(
"Modules");
68 configSource.AddConfig(
"GridService");
69 configSource.Configs[
"Modules"].Set(
"GridServices",
"LocalGridServicesConnector");
70 configSource.Configs[
"GridService"].Set(
"StorageProvider",
"OpenSim.Data.Null.dll:NullRegionData");
71 configSource.Configs[
"GridService"].Set(
"LocalServiceModule",
"OpenSim.Services.GridService.dll:GridService");
72 configSource.Configs[
"GridService"].Set(
"ConnectionString",
"!static");
78 sim.SuppressExit =
true;
79 sim.EnableInitialPluginLoad =
false;
80 sim.LoadEstateDataService =
false;
81 sim.NetServersInfo.HttpListenerPort = 0;
86 ri.RegionID = regionId;
87 ri.EstateSettings.EstateOwner = estateOwnerId;
88 ri.InternalEndPoint =
new IPEndPoint(0, 0);
91 sim.m_plugins =
new List<IApplicationPlugin>() { rmcp };
97 rmcp.AddNode(gridService);
115 sim.CreateRegion(ri, out scene);
119 List<string> co = tsr.CallOrder;
120 int expectedEventCount = 6;
125 "Expected {0} events but only got {1} ({2})",
126 expectedEventCount, co.Count, string.Join(
",", co));
127 Assert.AreEqual(
"Initialise", co[0]);
128 Assert.AreEqual(
"PostInitialise", co[1]);
129 Assert.AreEqual(
"AddRegion", co[2]);
130 Assert.AreEqual(
"RegionLoaded", co[3]);
131 Assert.AreEqual(
"RemoveRegion", co[4]);
132 Assert.AreEqual(
"Close", co[5]);
139 public List<string> CallOrder =
new List<string>();
141 public string Name {
get {
return "TestSharedRegion"; } }
143 public Type ReplaceableInterface {
get {
return null; } }
147 CallOrder.Add(
"PostInitialise");
152 CallOrder.Add(
"Initialise");
157 CallOrder.Add(
"Close");
162 CallOrder.Add(
"AddRegion");
167 CallOrder.Add(
"RemoveRegion");
172 CallOrder.Add(
"RegionLoaded");
179 private List<ISharedRegionModule> m_sharedInstances =
new List<ISharedRegionModule>();
184 public string Version {
get {
return "0"; } }
185 public string Name {
get {
return "MockRegionModulesControllerPlugin"; } }
200 module.PostInitialise();
205 List<ISharedRegionModule> sharedlist =
new List<ISharedRegionModule>();
209 module.AddRegion(scene);
210 scene.AddRegionModule(module.Name, module);
212 sharedlist.Add(module);
217 module.RegionLoaded(scene);
227 module.RemoveRegion(scene);
230 scene.RegionModules.Clear();
235 m_sharedInstances.Add(module);
236 module.Initialise(m_openSim.ConfigSource.Source);
242 while (m_sharedInstances.Count > 0)
244 m_sharedInstances[0].Close();
245 m_sharedInstances.RemoveAt(0);
void RemoveRegionFromModules(Scene scene)
void AddNode(ISharedRegionModule module)
OpenSim.Framework.RegionInfo RegionInfo
OpenSimulator Application Plugin framework interface
void AddRegionToModules(Scene scene)
void Initialise(IConfigSource source)
This is called to initialize the region module. For shared modules, this is called exactly once...
void PostInitialise()
This is called exactly once after all the shared region-modules have been instanciated and IRegionMod...
void AddRegion(Scene scene)
This is called whenever a Scene is added. For shared modules, this can happen several times...
void RegionLoaded(Scene scene)
This will be called once for every scene loaded. In a shared module this will be multiple times in on...
void RemoveRegion(Scene scene)
This is called whenever a Scene is removed. For shared modules, this can happen several times...
void Initialise()
Default-initialises the plugin
void Initialise(OpenSimBase sim)
Initialize the Plugin
Interactive OpenSim region server
Common OpenSimulator simulator code
void Close()
This is the inverse to Initialise. After a Close(), this instance won't be usable anymore...
void PostInitialise()
Called when the application loading is completed