Beispiel #1
0
        //        [Test]
        public void TestLifecycle()
        {
            TestHelpers.InMethod();
            TestHelpers.EnableLogging();

            UUID estateOwnerId = TestHelpers.ParseTail(0x1);
            UUID regionId      = TestHelpers.ParseTail(0x10);

            IConfigSource configSource = new IniConfigSource();

            configSource.AddConfig("Startup");
            configSource.AddConfig("Modules");

            //            // We use this to skip estate questions
            // Turns out not to be needed is estate owner id is pre-set in region information.
            //            IConfig estateConfig = configSource.AddConfig(OpenSimBase.ESTATE_SECTION_NAME);
            //            estateConfig.Set("DefaultEstateOwnerName", "Zaphod Beeblebrox");
            //            estateConfig.Set("DefaultEstateOwnerUUID", estateOwnerId);
            //            estateConfig.Set("DefaultEstateOwnerEMail", "*****@*****.**");
            //            estateConfig.Set("DefaultEstateOwnerPassword", "two heads");

            // For grid servic
            configSource.AddConfig("GridService");
            configSource.Configs["Modules"].Set("GridServices", "RegionGridServicesConnector");
            configSource.Configs["GridService"].Set("StorageProvider", "OpenSim.Data.Null.dll:NullRegionData");
            configSource.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Services.GridService.dll:GridService");
            configSource.Configs["GridService"].Set("ConnectionString", "!static");

            RegionGridServicesConnector gridService = new RegionGridServicesConnector();
//
            OpenSim sim = new OpenSim(configSource);

            sim.SuppressExit                    = true;
            sim.EnableInitialPluginLoad         = false;
            sim.LoadEstateDataService           = false;
            sim.NetServersInfo.HttpListenerPort = 0;

            IRegistryCore reg = sim.ApplicationRegistry;

            RegionInfo ri = new RegionInfo();

            ri.RegionID = regionId;
            ri.EstateSettings.EstateOwner = estateOwnerId;
            ri.InternalEndPoint           = new IPEndPoint(0, 0);

            MockRegionModulesControllerPlugin rmcp = new MockRegionModulesControllerPlugin();

            sim.m_plugins = new List <IApplicationPlugin>()
            {
                rmcp
            };
            reg.RegisterInterface <IRegionModulesController>(rmcp);

            // XXX: Have to initialize directly for now
            rmcp.Initialise(sim);

            rmcp.AddNode(gridService);

            TestSharedRegion tsr = new TestSharedRegion();

            rmcp.AddNode(tsr);

            // FIXME: Want to use the real one eventually but this is currently directly tied into Mono.Addins
            // which has been written in such a way that makes it impossible to use for regression tests.
            //            RegionModulesControllerPlugin rmcp = new RegionModulesControllerPlugin();
            //            rmcp.LoadModulesFromAddins = false;
            ////            reg.RegisterInterface<IRegionModulesController>(rmcp);
            //            rmcp.Initialise(sim);
            //            rmcp.PostInitialise();
            //            TypeExtensionNode node = new TypeExtensionNode();
            //            node.
            //            rmcp.AddNode(node, configSource.Configs["Modules"], new Dictionary<RuntimeAddin, IList<int>>());

            sim.Startup();
            IScene scene;

            sim.CreateRegion(ri, out scene);

            sim.Shutdown();

            List <string> co = tsr.CallOrder;
            int           expectedEventCount = 6;

            Assert.AreEqual(
                expectedEventCount,
                co.Count,
                "Expected {0} events but only got {1} ({2})",
                expectedEventCount, co.Count, string.Join(",", co));
            Assert.AreEqual("Initialise", co[0]);
            Assert.AreEqual("PostInitialise", co[1]);
            Assert.AreEqual("AddRegion", co[2]);
            Assert.AreEqual("RegionLoaded", co[3]);
            Assert.AreEqual("RemoveRegion", co[4]);
            Assert.AreEqual("Close", co[5]);
        }