Пример #1
0
        private static void StartInventoryService(Scene testScene, bool real)
        {
            ISharedRegionModule inventoryService = new LocalInventoryServicesConnector();
            IConfigSource       config           = new IniConfigSource();

            config.AddConfig("Modules");
            config.AddConfig("InventoryService");
            config.Configs["Modules"].Set("InventoryServices", "LocalInventoryServicesConnector");

            if (real)
            {
                config.Configs["InventoryService"].Set("LocalServiceModule", "OpenSim.Services.InventoryService.dll:InventoryService");
            }
            else
            {
                config.Configs["InventoryService"].Set("LocalServiceModule", "OpenSim.Tests.Common.dll:MockInventoryService");
            }

            config.Configs["InventoryService"].Set("StorageProvider", "OpenSim.Tests.Common.dll");
            inventoryService.Initialise(config);
            inventoryService.AddRegion(testScene);
            inventoryService.RegionLoaded(testScene);
            testScene.AddRegionModule(inventoryService.Name, inventoryService);
            m_inventoryService = inventoryService;
        }
        public void Initialise(OpenSimBase openSim)
        {
            m_log.DebugFormat("[REGIONMODULES]: Initializing...");
            m_openSim = openSim;
            openSim.ApplicationRegistry.RegisterInterface <IRegionModulesController>(this);

            string id  = AddinManager.CurrentAddin.Id;
            int    pos = id.LastIndexOf(".");

            if (pos == -1)
            {
                m_name = id;
            }
            else
            {
                m_name = id.Substring(pos + 1);
            }

            //ExtensionNodeList list = AddinManager.GetExtensionNodes("/OpenSim/RegionModules");
            // load all the (new) region-module classes
            foreach (TypeExtensionNode node in AddinManager.GetExtensionNodes("/OpenSim/RegionModules"))
            {
                // TODO why does node.Type.isSubclassOf(typeof(ISharedRegionModule)) not work?
                if (node.Type.GetInterface(typeof(ISharedRegionModule).ToString()) != null)
                {
                    m_log.DebugFormat("[REGIONMODULES]: Found shared region module {0}, class {1}", node.Id, node.Type);
                    m_sharedModules.Add(node.Type);
                }
                else if (node.Type.GetInterface(typeof(INonSharedRegionModule).ToString()) != null)
                {
                    m_log.DebugFormat("[REGIONMODULES]: Found non-shared region module {0}, class {1}", node.Id, node.Type);
                    m_nonSharedModules.Add(node.Type);
                }
                else
                {
                    m_log.DebugFormat("[REGIONMODULES]: Found unknown type of module {0}, class {1}", node.Id, node.Type);
                }
            }

            // now we've got all the region-module classes loaded, create one instance of every ISharedRegionModule,
            // initialize and postinitialize it. This Initialise we are in is called before LoadRegion.PostInitialise
            // is called (which loads the regions), so we don't have any regions in the server yet.
            foreach (Type type in m_sharedModules)
            {
                ISharedRegionModule module = (ISharedRegionModule)Activator.CreateInstance(type);
                m_sharedInstances.Add(module);
                module.Initialise(openSim.ConfigSource.Source);
            }

            foreach (ISharedRegionModule module in m_sharedInstances)
            {
                module.PostInitialise();
            }
        }
Пример #3
0
        /// <summary>
        /// Start a presence service
        /// </summary>
        /// <param name="testScene"></param>
        private static void StartPresenceService(Scene testScene)
        {
            IConfigSource config = new IniConfigSource();

            config.AddConfig("Modules");
            config.AddConfig("PresenceService");
            config.Configs["Modules"].Set("PresenceServices", "LocalPresenceServicesConnector");
            config.Configs["PresenceService"].Set("StorageProvider", "OpenSim.Data.Null.dll");
            config.Configs["PresenceService"].Set(
                "LocalServiceModule", "OpenSim.Services.PresenceService.dll:PresenceService");

            if (m_presenceService == null)
            {
                ISharedRegionModule presenceService = new LocalPresenceServicesConnector();
                presenceService.Initialise(config);
                m_presenceService = presenceService;
            }

            m_presenceService.AddRegion(testScene);
            m_presenceService.RegionLoaded(testScene);
            testScene.AddRegionModule(m_presenceService.Name, m_presenceService);
        }
Пример #4
0
        private static void StartGridService(Scene testScene, bool real)
        {
            IConfigSource config = new IniConfigSource();

            config.AddConfig("Modules");
            config.AddConfig("GridService");
            config.Configs["Modules"].Set("GridServices", "LocalGridServicesConnector");
            config.Configs["GridService"].Set("StorageProvider", "OpenSim.Data.Null.dll:NullRegionData");
            if (real)
            {
                config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Services.GridService.dll:GridService");
            }
            if (m_gridService == null)
            {
                ISharedRegionModule gridService = new LocalGridServicesConnector();
                gridService.Initialise(config);
                m_gridService = gridService;
            }
            //else
            //    config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Tests.Common.dll:TestGridService");
            m_gridService.AddRegion(testScene);
            m_gridService.RegionLoaded(testScene);
            //testScene.AddRegionModule(m_gridService.Name, m_gridService);
        }
Пример #5
0
        private void HandleReload(string module, string[] args)
        {
            // Possible forms:
            // # shim reload some.dll
            // # shim reload some.dll:SomeModule
            if (args.Length < 3)
            {
                MainConsole.Instance.Output("shim reload dll[:class]");
                return;
            }

            string dllName = args[2];

            Modules modules = LoadRegionModules(dllName, new object[] { });
            int     count   = modules.m_Shared.Count;

            foreach (KeyValuePair <Type, List <INonSharedRegionModule> > kvp in modules.m_NonShared)
            {
                count += kvp.Value.Count;
            }

            m_log.DebugFormat("[Diva.ModuleShim]: instantiated {0} module instances", count);

            // Deregister existing instances and register new ones
            foreach (ISharedRegionModule mod in modules.m_Shared)
            {
                RemoveOldModules(mod.GetType());
            }
            foreach (Type t in modules.m_NonShared.Keys)
            {
                if (modules.m_NonShared[t].Count > 0)
                {
                    RemoveOldModules(t);
                }
            }

            // Activate the new ones
            // 1. Initialise
            foreach (IRegionModuleBase mod in modules.m_Shared)
            {
                Manage(mod.GetType(), mod);
                mod.Initialise(m_Config);
            }
            foreach (List <INonSharedRegionModule> mods in modules.m_NonShared.Values)
            {
                foreach (INonSharedRegionModule mod in mods)
                {
                    Manage(mod.GetType(), mod);
                    mod.Initialise(m_Config);
                }
            }
            // 2. PostInitialise the shared modules
            foreach (IRegionModuleBase mod in modules.m_Shared)
            {
                ISharedRegionModule s = (ISharedRegionModule)mod;
                s.PostInitialise();
            }
            // 3. AddRegion
            foreach (IRegionModuleBase mod in modules.m_Shared)
            {
                foreach (Scene s in m_Scenes)
                {
                    mod.AddRegion(s);
                    s.AddRegionModule(mod.Name, mod);
                }
            }
            foreach (KeyValuePair <Type, List <INonSharedRegionModule> > kvp in modules.m_NonShared)
            {
                for (int i = 0; i < m_Scenes.Count; i++)
                {
                    kvp.Value[i].AddRegion(m_Scenes[i]);
                    m_Scenes[i].AddRegionModule(kvp.Value[i].Name, kvp.Value[i]);
                }
            }
            // 4. RegionLoaded
            foreach (IRegionModuleBase mod in modules.m_Shared)
            {
                foreach (Scene s in m_Scenes)
                {
                    mod.RegionLoaded(s);
                }
            }
            foreach (KeyValuePair <Type, List <INonSharedRegionModule> > kvp in modules.m_NonShared)
            {
                for (int i = 0; i < m_Scenes.Count; i++)
                {
                    kvp.Value[i].RegionLoaded(m_Scenes[i]);
                }
            }
        }
Пример #6
0
        public void Initialize(OpenSimBase openSim)
        {
            m_openSim = openSim;
            m_openSim.ApplicationRegistry.RegisterInterface <IRegionModulesController>(this);
            m_log.DebugFormat("[REGIONMODULES]: Initializing...");

            // Who we are
            string id = AddinManager.CurrentAddin.Id;

            // Make friendly name
            int pos = id.LastIndexOf(".");

            if (pos == -1)
            {
                m_name = id;
            }
            else
            {
                m_name = id.Substring(pos + 1);
            }

            // The [Modules] section in the ini file
            IConfig modulesConfig =
                m_openSim.ConfigSource.Source.Configs["Modules"];

            if (modulesConfig == null)
            {
                modulesConfig = m_openSim.ConfigSource.Source.AddConfig("Modules");
            }

            // Scan modules and load all that aren't disabled
            foreach (TypeExtensionNode node in
                     AddinManager.GetExtensionNodes("/OpenSim/RegionModules"))
            {
                if (node.Type.GetInterface(typeof(ISharedRegionModule).ToString()) != null)
                {
                    if (CheckModuleEnabled(node, modulesConfig))
                    {
                        m_log.DebugFormat("[REGIONMODULES]: Found shared region module {0}, class {1}", node.Id, node.Type);
                        m_sharedModules.Add(node);
                    }
                }
                else if (node.Type.GetInterface(typeof(INonSharedRegionModule).ToString()) != null)
                {
                    if (CheckModuleEnabled(node, modulesConfig))
                    {
                        m_log.DebugFormat("[REGIONMODULES]: Found non-shared region module {0}, class {1}", node.Id, node.Type);
                        m_nonSharedModules.Add(node);
                    }
                }
                else
                {
                    m_log.DebugFormat("[REGIONMODULES]: Found unknown type of module {0}, class {1}", node.Id, node.Type);
                }
            }

            // Load and init the module. We try a constructor with a port
            // if a port was given, fall back to one without if there is
            // no port or the more specific constructor fails.
            // This will be removed, so that any module capable of using a port
            // must provide a constructor with a port in the future.
            // For now, we do this so migration is easy.
            //
            foreach (TypeExtensionNode node in m_sharedModules)
            {
                Object[] ctorArgs = new Object[] { (uint)0 };

                // Read the config again
                string moduleString =
                    modulesConfig.GetString("Setup_" + node.Id, String.Empty);

                // Get the port number, if there is one
                if (moduleString != String.Empty)
                {
                    // Get the port number from the string
                    string[] moduleParts = moduleString.Split(new char[] { '/' },
                                                              2);
                    if (moduleParts.Length > 1)
                    {
                        ctorArgs[0] = Convert.ToUInt32(moduleParts[0]);
                    }
                }

                // Try loading and initilaizing the module, using the
                // port if appropriate
                ISharedRegionModule module = null;

                try
                {
                    module = (ISharedRegionModule)Activator.CreateInstance(
                        node.Type, ctorArgs);
                }
                catch
                {
                    module = (ISharedRegionModule)Activator.CreateInstance(
                        node.Type);
                }

                // OK, we're up and running
                m_sharedInstances.Add(module);
                module.Initialize(m_openSim.ConfigSource.Source);
            }
        }
Пример #7
0
        /// <summary>
        /// Set up a scene. If it's more then one scene, use the same CommunicationsManager to link regions
        /// or a different, to get a brand new scene with new shared region modules.
        /// </summary>
        /// <param name="name">Name of the region</param>
        /// <param name="id">ID of the region</param>
        /// <param name="x">X co-ordinate of the region</param>
        /// <param name="y">Y co-ordinate of the region</param>
        /// <param name="cm">This should be the same if simulating two scenes within a standalone</param>
        /// <param name="realServices">Starts real inventory and asset services, as opposed to mock ones, if true</param>
        /// <returns></returns>
        public static TestScene SetupScene(
            string name, UUID id, uint x, uint y, String realServices)
        {
            bool newScene = false;

            Console.WriteLine("Setting up test scene {0}", name);

            // REFACTORING PROBLEM!
            //// If cm is the same as our last commsManager used, this means the tester wants to link
            //// regions. In this case, don't use the sameshared region modules and dont initialize them again.
            //// Also, no need to start another MainServer and MainConsole instance.
            //if (cm == null || cm != commsManager)
            //{
            //    System.Console.WriteLine("Starting a brand new scene");
            //    newScene = true;
            MainConsole.Instance = new MockConsole("TEST PROMPT");
            //    MainServer.Instance = new BaseHttpServer(980);
            //    commsManager = cm;
            //}

            // We must set up a console otherwise setup of some modules may fail
            RegionInfo regInfo = new RegionInfo(x, y, new IPEndPoint(IPAddress.Loopback, 9000), "127.0.0.1");

            regInfo.RegionName = name;
            regInfo.RegionID   = id;

            AgentCircuitManager       acm = new AgentCircuitManager();
            SceneCommunicationService scs = new SceneCommunicationService();

            ISimulationDataService simDataService    = OpenSim.Server.Base.ServerUtils.LoadPlugin <ISimulationDataService>("OpenSim.Tests.Common.dll", null);
            IEstateDataService     estateDataService = null;
            IConfigSource          configSource      = new IniConfigSource();

            TestScene testScene = new TestScene(
                regInfo, acm, scs, simDataService, estateDataService, null, false, false, false, configSource, null);

            INonSharedRegionModule capsModule = new CapabilitiesModule();

            capsModule.Initialise(new IniConfigSource());
            testScene.AddRegionModule(capsModule.Name, capsModule);
            capsModule.AddRegion(testScene);

            IRegionModule godsModule = new GodsModule();

            godsModule.Initialise(testScene, new IniConfigSource());
            testScene.AddModule(godsModule.Name, godsModule);
            realServices = realServices.ToLower();
            // IConfigSource config = new IniConfigSource();

            // If we have a brand new scene, need to initialize shared region modules
            if ((m_assetService == null && m_inventoryService == null) || newScene)
            {
                if (realServices.Contains("asset"))
                {
                    StartAssetService(testScene, true);
                }
                else
                {
                    StartAssetService(testScene, false);
                }

                // For now, always started a 'real' authentication service
                StartAuthenticationService(testScene, true);

                if (realServices.Contains("inventory"))
                {
                    StartInventoryService(testScene, true);
                }
                else
                {
                    StartInventoryService(testScene, false);
                }

                StartGridService(testScene, true);
                StartUserAccountService(testScene);
                StartPresenceService(testScene);
            }
            // If not, make sure the shared module gets references to this new scene
            else
            {
                m_assetService.AddRegion(testScene);
                m_assetService.RegionLoaded(testScene);
                m_inventoryService.AddRegion(testScene);
                m_inventoryService.RegionLoaded(testScene);
                m_userAccountService.AddRegion(testScene);
                m_userAccountService.RegionLoaded(testScene);
                m_presenceService.AddRegion(testScene);
                m_presenceService.RegionLoaded(testScene);
            }

            m_inventoryService.PostInitialise();
            m_assetService.PostInitialise();
            m_userAccountService.PostInitialise();
            m_presenceService.PostInitialise();
            testScene.RegionInfo.EstateSettings.EstateOwner = UUID.Random();
            testScene.SetModuleInterfaces();

            testScene.LandChannel = new TestLandChannel(testScene);
            testScene.LoadWorldMap();

            PhysicsPluginManager physicsPluginManager = new PhysicsPluginManager();

            physicsPluginManager.LoadPluginsFromAssembly("Physics/OpenSim.Region.Physics.BasicPhysicsPlugin.dll");
            testScene.PhysicsScene
                = physicsPluginManager.GetPhysicsScene("basicphysics", "MarchingCubes", "ZeroMesher", new IniConfigSource(), "test");

            // It's really not a good idea to use static variables as they carry over between tests, leading to
            // problems that are extremely hard to debug.  Really, these static fields need to be eliminated -
            // tests using multiple regions that need to share modules need to find another solution.
            m_assetService       = null;
            m_inventoryService   = null;
            m_gridService        = null;
            m_userAccountService = null;
            m_presenceService    = null;

            testScene.RegionInfo.EstateSettings = new EstateSettings();
            testScene.LoginsDisabled            = false;

            return(testScene);
        }
Пример #8
0
 public void AddNode(ISharedRegionModule module)
 {
     m_sharedInstances.Add(module);
     module.Initialise(m_openSim.ConfigSource.Source);
 }
Пример #9
0
        public void Initialise(OpenSimBase openSim)
        {
            m_openSim = openSim;
            m_openSim.ApplicationRegistry.RegisterInterface <IRegionModulesController>(this);
            m_log.DebugFormat("[REGIONMODULES]: Initializing...");

            if (!LoadModulesFromAddins)
            {
                return;
            }

            // Who we are
            string id = AddinManager.CurrentAddin.Id;

            // Make friendly name
            int pos = id.LastIndexOf(".");

            if (pos == -1)
            {
                m_name = id;
            }
            else
            {
                m_name = id.Substring(pos + 1);
            }

            // The [Modules] section in the ini file
            IConfig modulesConfig =
                m_openSim.ConfigSource.Source.Configs["Modules"];

            if (modulesConfig == null)
            {
                modulesConfig = m_openSim.ConfigSource.Source.AddConfig("Modules");
            }

            Dictionary <RuntimeAddin, IList <int> > loadedModules = new Dictionary <RuntimeAddin, IList <int> >();

            // Scan modules and load all that aren't disabled
            foreach (TypeExtensionNode node in AddinManager.GetExtensionNodes("/OpenSim/RegionModules"))
            {
                AddNode(node, modulesConfig, loadedModules);
            }

            foreach (KeyValuePair <RuntimeAddin, IList <int> > loadedModuleData in loadedModules)
            {
                m_log.InfoFormat(
                    "[REGIONMODULES]: From plugin {0}, (version {1}), loaded {2} modules, {3} shared, {4} non-shared {5} unknown",
                    loadedModuleData.Key.Id,
                    loadedModuleData.Key.Version,
                    loadedModuleData.Value[0] + loadedModuleData.Value[1] + loadedModuleData.Value[2],
                    loadedModuleData.Value[0], loadedModuleData.Value[1], loadedModuleData.Value[2]);
            }

            // Load and init the module. We try a constructor with a port
            // if a port was given, fall back to one without if there is
            // no port or the more specific constructor fails.
            // This will be removed, so that any module capable of using a port
            // must provide a constructor with a port in the future.
            // For now, we do this so migration is easy.
            //
            foreach (TypeExtensionNode node in m_sharedModules)
            {
                Object[] ctorArgs = new Object[] { (uint)0 };

                // Read the config again
                string moduleString =
                    modulesConfig.GetString("Setup_" + node.Id, String.Empty);

                // Get the port number, if there is one
                if (moduleString != String.Empty)
                {
                    // Get the port number from the string
                    string[] moduleParts = moduleString.Split(new char[] { '/' },
                                                              2);
                    if (moduleParts.Length > 1)
                    {
                        ctorArgs[0] = Convert.ToUInt32(moduleParts[0]);
                    }
                }

                // Try loading and initilaizing the module, using the
                // port if appropriate
                ISharedRegionModule module = null;

                try
                {
                    module = (ISharedRegionModule)Activator.CreateInstance(
                        node.Type, ctorArgs);
                }
                catch
                {
                    module = (ISharedRegionModule)Activator.CreateInstance(
                        node.Type);
                }

                // OK, we're up and running
                m_sharedInstances.Add(module);
                module.Initialise(m_openSim.ConfigSource.Source);
            }
        }
Пример #10
0
 public void AddNode(ISharedRegionModule module)
 {
     m_sharedInstances.Add(module);
     module.Initialise(m_openSim.ConfigSource.Source);
 }
Пример #11
0
 private static void StartGridService(Scene testScene, bool real)
 {
     IConfigSource config = new IniConfigSource();
     config.AddConfig("Modules");
     config.AddConfig("GridService");
     config.Configs["Modules"].Set("GridServices", "LocalGridServicesConnector");
     config.Configs["GridService"].Set("StorageProvider", "OpenSim.Data.Null.dll:NullRegionData");
     if (real)
         config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Services.GridService.dll:GridService");
     if (m_gridService == null)
     {
         ISharedRegionModule gridService = new LocalGridServicesConnector();
         gridService.Initialise(config);
         m_gridService = gridService;
     }
     //else
     //    config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Tests.Common.dll:TestGridService");
     m_gridService.AddRegion(testScene);
     m_gridService.RegionLoaded(testScene);
     //testScene.AddRegionModule(m_gridService.Name, m_gridService);
 }
Пример #12
0
 private static void StartInventoryService(Scene testScene, bool real)
 {
     ISharedRegionModule inventoryService = new LocalInventoryServicesConnector();
     IConfigSource config = new IniConfigSource();
     config.AddConfig("Modules");
     config.AddConfig("InventoryService");
     config.Configs["Modules"].Set("InventoryServices", "LocalInventoryServicesConnector");
     if (real)
         config.Configs["InventoryService"].Set("LocalServiceModule", "OpenSim.Services.InventoryService.dll:InventoryService");
     else
         config.Configs["InventoryService"].Set("LocalServiceModule", "OpenSim.Tests.Common.dll:TestInventoryService");
     config.Configs["InventoryService"].Set("StorageProvider", "OpenSim.Tests.Common.dll");
     inventoryService.Initialise(config);
     inventoryService.AddRegion(testScene);
     inventoryService.RegionLoaded(testScene);
     testScene.AddRegionModule(inventoryService.Name, inventoryService);
     m_inventoryService = inventoryService;
 }
Пример #13
0
        /// <summary>
        /// Start a presence service
        /// </summary>
        /// <param name="testScene"></param>
        private static void StartPresenceService(Scene testScene)
        {
            IConfigSource config = new IniConfigSource();
            config.AddConfig("Modules");
            config.AddConfig("PresenceService");
            config.Configs["Modules"].Set("PresenceServices", "LocalPresenceServicesConnector");
            config.Configs["PresenceService"].Set("StorageProvider", "OpenSim.Data.Null.dll");
            config.Configs["PresenceService"].Set(
                "LocalServiceModule", "OpenSim.Services.PresenceService.dll:PresenceService");

            if (m_presenceService == null)
            {
                ISharedRegionModule presenceService = new LocalPresenceServicesConnector();
                presenceService.Initialise(config);
                m_presenceService = presenceService;
            }

            m_presenceService.AddRegion(testScene);
            m_presenceService.RegionLoaded(testScene);
            testScene.AddRegionModule(m_presenceService.Name, m_presenceService);
        }
Пример #14
0
 private static void StartAssetService(Scene testScene, bool real)
 {
     ISharedRegionModule assetService = new LocalAssetServicesConnector();
     IConfigSource config = new IniConfigSource();
     config.AddConfig("Modules");
     config.AddConfig("AssetService");
     config.Configs["Modules"].Set("AssetServices", "LocalAssetServicesConnector");
     if (real)
         config.Configs["AssetService"].Set("LocalServiceModule", "OpenSim.Services.AssetService.dll:AssetService");
     else
         config.Configs["AssetService"].Set("LocalServiceModule", "OpenSim.Tests.Common.dll:MockAssetService");
     config.Configs["AssetService"].Set("StorageProvider", "OpenSim.Tests.Common.dll");
     assetService.Initialise(config);
     assetService.AddRegion(testScene);
     assetService.RegionLoaded(testScene);
     testScene.AddRegionModule(assetService.Name, assetService);
     m_assetService = assetService;
 }
Пример #15
0
        /// <summary>
        /// Set up a scene. If it's more then one scene, use the same CommunicationsManager to link regions
        /// or a different, to get a brand new scene with new shared region modules.
        /// </summary>
        /// <param name="name">Name of the region</param>
        /// <param name="id">ID of the region</param>
        /// <param name="x">X co-ordinate of the region</param>
        /// <param name="y">Y co-ordinate of the region</param>
        /// <param name="cm">This should be the same if simulating two scenes within a standalone</param>
        /// <param name="realServices">Starts real inventory and asset services, as opposed to mock ones, if true</param>
        /// <returns></returns>
        public static TestScene SetupScene(
            string name, UUID id, uint x, uint y, String realServices)
        {
            bool newScene = false;

            Console.WriteLine("Setting up test scene {0}", name);

            // REFACTORING PROBLEM!
            //// If cm is the same as our last commsManager used, this means the tester wants to link
            //// regions. In this case, don't use the sameshared region modules and dont initialize them again.
            //// Also, no need to start another MainServer and MainConsole instance.
            //if (cm == null || cm != commsManager)
            //{
            //    System.Console.WriteLine("Starting a brand new scene");
            //    newScene = true;
            MainConsole.Instance = new MockConsole("TEST PROMPT");
            //    MainServer.Instance = new BaseHttpServer(980);
            //    commsManager = cm;
            //}

            // We must set up a console otherwise setup of some modules may fail
            RegionInfo regInfo = new RegionInfo(x, y, new IPEndPoint(IPAddress.Loopback, 9000), "127.0.0.1");
            regInfo.RegionName = name;
            regInfo.RegionID = id;

            AgentCircuitManager acm = new AgentCircuitManager();
            SceneCommunicationService scs = new SceneCommunicationService();

            ISimulationDataService simDataService = OpenSim.Server.Base.ServerUtils.LoadPlugin<ISimulationDataService>("OpenSim.Tests.Common.dll", null);
            IEstateDataService estateDataService = null;
            IConfigSource configSource = new IniConfigSource();

            TestScene testScene = new TestScene(
                regInfo, acm, scs, simDataService, estateDataService, null, false, false, false, configSource, null);

            INonSharedRegionModule capsModule = new CapabilitiesModule();
            capsModule.Initialise(new IniConfigSource());
            testScene.AddRegionModule(capsModule.Name, capsModule);
            capsModule.AddRegion(testScene);

            IRegionModule godsModule = new GodsModule();
            godsModule.Initialise(testScene, new IniConfigSource());
            testScene.AddModule(godsModule.Name, godsModule);
            realServices = realServices.ToLower();
            // IConfigSource config = new IniConfigSource();

            // If we have a brand new scene, need to initialize shared region modules
            if ((m_assetService == null && m_inventoryService == null) || newScene)
            {
                if (realServices.Contains("asset"))
                    StartAssetService(testScene, true);
                else
                    StartAssetService(testScene, false);

                // For now, always started a 'real' authentication service
                StartAuthenticationService(testScene, true);

                if (realServices.Contains("inventory"))
                    StartInventoryService(testScene, true);
                else
                    StartInventoryService(testScene, false);

                StartGridService(testScene, true);
                StartUserAccountService(testScene);
                StartPresenceService(testScene);
            }
            // If not, make sure the shared module gets references to this new scene
            else
            {
                m_assetService.AddRegion(testScene);
                m_assetService.RegionLoaded(testScene);
                m_inventoryService.AddRegion(testScene);
                m_inventoryService.RegionLoaded(testScene);
                m_userAccountService.AddRegion(testScene);
                m_userAccountService.RegionLoaded(testScene);
                m_presenceService.AddRegion(testScene);
                m_presenceService.RegionLoaded(testScene);

            }

            m_inventoryService.PostInitialise();
            m_assetService.PostInitialise();
            m_userAccountService.PostInitialise();
            m_presenceService.PostInitialise();
            testScene.RegionInfo.EstateSettings.EstateOwner = UUID.Random();
            testScene.SetModuleInterfaces();

            testScene.LandChannel = new TestLandChannel(testScene);
            testScene.LoadWorldMap();

            PhysicsPluginManager physicsPluginManager = new PhysicsPluginManager();
            physicsPluginManager.LoadPluginsFromAssembly("Physics/OpenSim.Region.Physics.BasicPhysicsPlugin.dll");
            testScene.PhysicsScene
                = physicsPluginManager.GetPhysicsScene("basicphysics", "MarchingCubes", "ZeroMesher",   new IniConfigSource(), "test");

            // It's really not a good idea to use static variables as they carry over between tests, leading to
            // problems that are extremely hard to debug.  Really, these static fields need to be eliminated -
            // tests using multiple regions that need to share modules need to find another solution.
            m_assetService = null;
            m_inventoryService = null;
            m_gridService = null;
            m_userAccountService = null;
            m_presenceService = null;

            testScene.RegionInfo.EstateSettings = new EstateSettings();
            testScene.LoginsDisabled = false;

            return testScene;
        }
 /// <summary>
 /// Start a user account service, whether real or mock
 /// </summary>
 /// <param name="testScene"></param>
 /// <param name="real">Starts a real service if true, a mock service if not</param>
 private static void StartUserAccountService(Scene testScene, bool real)
 {
     IConfigSource config = new IniConfigSource();
     config.AddConfig("Modules");
     config.AddConfig("UserAccountService");
     config.Configs["Modules"].Set("UserAccountServices", "LocalUserAccountServicesConnector");
     config.Configs["UserAccountService"].Set("StorageProvider", "OpenSim.Data.Null.dll");
     
     if (real)
         config.Configs["UserAccountService"].Set(
             "LocalServiceModule", "OpenSim.Services.UserAccountService.dll:UserAccountService");
     else
         config.Configs["UserAccountService"].Set(
             "LocalServiceModule", "OpenSim.Tests.Common.dll:MockUserAccountService");
     
     if (m_userAccountService == null)
     {
         ISharedRegionModule userAccountService = new LocalUserAccountServicesConnector();
         userAccountService.Initialise(config);
         m_userAccountService = userAccountService;
     }
     //else
     //    config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Tests.Common.dll:TestGridService");
     m_userAccountService.AddRegion(testScene);
     m_userAccountService.RegionLoaded(testScene);
     testScene.AddRegionModule(m_userAccountService.Name, m_userAccountService);
 }