public void TestDeRezSceneObject()
        {
            TestHelper.InMethod();
//            log4net.Config.XmlConfigurator.Configure();
                        
            UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001");
            
            TestScene scene = SceneSetupHelpers.SetupScene();
            IConfigSource configSource = new IniConfigSource();
            IConfig config = configSource.AddConfig("Startup");
            config.Set("serverside_object_permissions", true);
            SceneSetupHelpers.SetupSceneModules(scene, configSource, new object[] { new PermissionsModule() });
            TestClient client = SceneSetupHelpers.AddRootAgent(scene, userId);
            
            // Turn off the timer on the async sog deleter - we'll crank it by hand for this test.
            AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
            sogd.Enabled = false;            
            
            SceneObjectPart part
                = new SceneObjectPart(userId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero);
            part.Name = "obj1";
            scene.AddNewSceneObject(new SceneObjectGroup(part), false);
            List<uint> localIds = new List<uint>();
            localIds.Add(part.LocalId);

            scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.Delete, UUID.Zero);
            sogd.InventoryDeQueueAndDelete();
            
            SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
            Assert.That(retrievedPart, Is.Null);
        }
        public void TestAddAsset()
        {
            TestHelpers.InMethod();
//            TestHelpers.EnableLogging();

            IConfigSource config = new IniConfigSource();
            config.AddConfig("Modules");
            config.Configs["Modules"].Set("AssetServices", "LocalAssetServicesConnector");
            config.AddConfig("AssetService");
            config.Configs["AssetService"].Set("LocalServiceModule", "OpenSim.Services.AssetService.dll:AssetService");
            config.Configs["AssetService"].Set("StorageProvider", "OpenSim.Tests.Common.dll");

            LocalAssetServicesConnector lasc = new LocalAssetServicesConnector();
            lasc.Initialise(config);

            AssetBase a1 = AssetHelpers.CreateNotecardAsset();
            lasc.Store(a1);

            AssetBase retreivedA1 = lasc.Get(a1.ID);
            Assert.That(retreivedA1.ID, Is.EqualTo(a1.ID));
            Assert.That(retreivedA1.Metadata.ID, Is.EqualTo(a1.Metadata.ID));
            Assert.That(retreivedA1.Data.Length, Is.EqualTo(a1.Data.Length));

            AssetMetadata retrievedA1Metadata = lasc.GetMetadata(a1.ID);
            Assert.That(retrievedA1Metadata.ID, Is.EqualTo(a1.ID));

            byte[] retrievedA1Data = lasc.GetData(a1.ID);
            Assert.That(retrievedA1Data.Length, Is.EqualTo(a1.Data.Length));

            // TODO: Add cache and check that this does receive a copy of the asset
        }
        public override void SetUp()
        {
            base.SetUp();

            uint port = 9999;
            uint sslPort = 9998;

            // This is an unfortunate bit of clean up we have to do because MainServer manages things through static
            // variables and the VM is not restarted between tests.
            MainServer.RemoveHttpServer(port);

            BaseHttpServer server = new BaseHttpServer(port, false, sslPort, "");
            MainServer.AddHttpServer(server);
            MainServer.Instance = server;

            IConfigSource config = new IniConfigSource();
            config.AddConfig("Startup");
            config.Configs["Startup"].Set("EventQueue", "true");

            CapabilitiesModule capsModule = new CapabilitiesModule();
            m_eqgMod = new EventQueueGetModule();

            // For NPC test support
            config.AddConfig("NPC");
            config.Configs["NPC"].Set("Enabled", "true");
            m_npcMod = new NPCModule();

            m_scene = new SceneHelpers().SetupScene();
            SceneHelpers.SetupSceneModules(m_scene, config, capsModule, m_eqgMod, m_npcMod);
        }
        private void SetupNeighbourRegions(TestScene sceneA, TestScene sceneB)
        {            
            // XXX: HTTP server is not (and should not be) necessary for this test, though it's absence makes the 
            // CapabilitiesModule complain when it can't set up HTTP endpoints.
            //            BaseHttpServer httpServer = new BaseHttpServer(99999);
            //            MainServer.AddHttpServer(httpServer);
            //            MainServer.Instance = httpServer;

            // We need entity transfer modules so that when sp2 logs into the east region, the region calls 
            // EntityTransferModuleto set up a child agent on the west region.
            // XXX: However, this is not an entity transfer so is misleading.
            EntityTransferModule etmA = new EntityTransferModule();
            EntityTransferModule etmB = new EntityTransferModule();
            LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule();

            IConfigSource config = new IniConfigSource();
            config.AddConfig("Chat");
            IConfig modulesConfig = config.AddConfig("Modules");
            modulesConfig.Set("EntityTransferModule", etmA.Name);
            modulesConfig.Set("SimulationServices", lscm.Name);

            SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm);
            SceneHelpers.SetupSceneModules(sceneA, config, new CapabilitiesModule(), etmA, new ChatModule());           
            SceneHelpers.SetupSceneModules(sceneB, config, new CapabilitiesModule(), etmB, new ChatModule());
        }
        public void Init()
        {
            //AppDomain.CurrentDomain.SetData("APPBASE", Environment.CurrentDirectory + "/bin");
//            Console.WriteLine(AppDomain.CurrentDomain.BaseDirectory);
            m_xEngine = new XEngine();

            // Necessary to stop serialization complaining
            WorldCommModule wcModule = new WorldCommModule();

            IniConfigSource configSource = new IniConfigSource();

            IConfig startupConfig = configSource.AddConfig("Startup");
            startupConfig.Set("DefaultScriptEngine", "XEngine");

            IConfig xEngineConfig = configSource.AddConfig("XEngine");
            xEngineConfig.Set("Enabled", "true");

            // These tests will not run with AppDomainLoading = true, at least on mono.  For unknown reasons, the call
            // to AssemblyResolver.OnAssemblyResolve fails.
            xEngineConfig.Set("AppDomainLoading", "false");

            m_scene = new SceneHelpers().SetupScene("My Test", UUID.Random(), 1000, 1000, configSource);
            SceneHelpers.SetupSceneModules(m_scene, configSource, m_xEngine, wcModule);

            m_scene.EventManager.OnChatFromWorld += OnChatFromWorld;
            m_scene.StartScripts();
        }
        public void AddNewConfigsAndKeys()
        {
            // Add some new configs and keys here and test.
            StringWriter writer = new StringWriter ();
            writer.WriteLine ("[Pets]");
            writer.WriteLine (" cat = muffy");
            writer.WriteLine (" dog = rover");
            IniConfigSource source = new IniConfigSource
                                    (new StringReader (writer.ToString ()));

            IConfig config = source.Configs["Pets"];
            Assert.AreEqual ("Pets", config.Name);
            Assert.AreEqual (2, config.GetKeys ().Length);

            IConfig newConfig = source.AddConfig ("NewTest");
            newConfig.Set ("Author", "Brent");
            newConfig.Set ("Birthday", "February 8th");

            newConfig = source.AddConfig ("AnotherNew");

            Assert.AreEqual (3, source.Configs.Count);
            config = source.Configs["NewTest"];
            Assert.IsNotNull (config);
            Assert.AreEqual (2, config.GetKeys ().Length);
            Assert.AreEqual ("February 8th", config.Get ("Birthday"));
            Assert.AreEqual ("Brent", config.Get ("Author"));
        }
        private bool saveZigFile()
        {
            bool retVal = false;
            try
            {
                IniConfigSource source = new IniConfigSource();
                string appDataPath = System.Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\ZigGIS";
                if (!System.IO.Directory.Exists(appDataPath))
                {
                    System.IO.Directory.CreateDirectory(appDataPath);
                }
                IConfig config = source.AddConfig("connection");
                config.Set("server", this.txtServer.Text);
                config.Set("port", this.txtSchema.Text);
                config.Set("database", this.txtDatabase.Text);
                config.Set("user", this.txtUserName.Text);
                config.Set("password", this.txtPassword.Text);

                config = source.AddConfig("logging");
                config.Set("configfile", this.txtLogFile.Text);

                string zigFileName = this.txtServer.Text + "." + this.txtDatabase.Text + "." + this.txtUserName.Text + "." + System.Guid.NewGuid().ToString() + ".zig";
                source.Save(appDataPath + "\\" + zigFileName);
                return retVal;
            }
            catch(Exception ex)
            {
                MessageBox.Show(ex.ToString());
                return false;
            }
        }
        /// <summary>
        /// Initialises the somer blink configuration file at path.
        /// </summary>
        /// <param name="path">The path.</param>
        public static void InitialiseSomerBlinkConfigFileAtPath(string path)
        {
            var source = new IniConfigSource();
            source.AddConfig("Credentials");
            source.Configs["Credentials"].Set("Username", "");
            source.Configs["Credentials"].Set("Password", "");

            source.AddConfig("Settings");
            source.Configs["Settings"].Set("MinWaitTime", "2000");
            source.Configs["Settings"].Set("MaxWaitTime", "60000");
            source.Configs["Settings"].Set("MinBlinkBidIsk", "2500000");
            source.Configs["Settings"].Set("MaxBlinkBidIsk", "10000000");
            source.Configs["Settings"].Set("DownTime", "4");
            source.Configs["Settings"].Set("RunTime", "4");

            source.AddConfig("Extra");
            source.Configs["Settings"].Set("DebugMode", "0");
            source.Configs["Settings"].Set("proxyIp", "x.x.x.x");
            source.Configs["Settings"].Set("proxyPort", "8080");
            source.Configs["Settings"].Set("proxyUser", "");
            source.Configs["Settings"].Set("proxyPass", "");
            source.Configs["Settings"].Set("useProxy", "false");

            source.Save(path);

            SaveToDesktop(path);
            Logger.LogMessage();
            Logger.LogMessage("--------------------");
            Logger.LogMessage("ConfigFile shortcut created on desktop");
        }
        private static IConfigSource DefaultConfig()
        {
            IConfigSource result = new IniConfigSource();

            {
                IConfig config = result.AddConfig("Config");
                config.Set("listen_port", 8003);
                config.Set("assetset_location", String.Format(".{0}assets{0}AssetSets.xml", Path.DirectorySeparatorChar));
            }

            {
                IConfig config = result.AddConfig("Plugins");
                config.Set("asset_storage_provider", "OpenSimAssetStorage");
                config.Set("inventory_storage_provider", "OpenSimInventoryStorage");
                config.Set("authentication_provider", "NullAuthentication");
                config.Set("authorization_provider", "AuthorizeAll");
                config.Set("metrics_provider", "NullMetrics");
                config.Set("frontends", "ReferenceFrontend,OpenSimAssetFrontend,OpenSimInventoryFrontend,BrowseFrontend");
            }

            {
                IConfig config = result.AddConfig("OpenSim");
                config.Set("asset_database_provider", "OpenSim.Data.MySQL.dll");
                config.Set("inventory_database_provider", "OpenSim.Data.MySQL.dll");
                config.Set("asset_database_connect", String.Empty);
                config.Set("inventory_database_connect", String.Empty);
            }

            return result;
        }
        public void TestShareWithGroup()
        {
            TestHelpers.InMethod();
//            log4net.Config.XmlConfigurator.Configure();
                        
            UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001");
            
            TestScene scene = new SceneHelpers().SetupScene();
            IConfigSource configSource = new IniConfigSource();
            
            IConfig startupConfig = configSource.AddConfig("Startup");
            startupConfig.Set("serverside_object_permissions", true);
            
            IConfig groupsConfig = configSource.AddConfig("Groups");            
            groupsConfig.Set("Enabled", true);
            groupsConfig.Set("Module", "GroupsModule");            
            groupsConfig.Set("DebugEnabled", true);            
                       
            SceneHelpers.SetupSceneModules(
                scene, configSource, new object[] 
                   { new PermissionsModule(), 
                     new GroupsModule(), 
                     new MockGroupsServicesConnector() });
            
            IClientAPI client = SceneHelpers.AddScenePresence(scene, userId).ControllingClient;            
            
            IGroupsModule groupsModule = scene.RequestModuleInterface<IGroupsModule>();     
            
            groupsModule.CreateGroup(client, "group1", "To boldly go", true, UUID.Zero, 5, true, true, true);
        }
    // 'engineName' is the Bullet engine to use. Either null (for unmanaged), "BulletUnmanaged" or "BulletXNA"
    // 'params' is a set of keyValue pairs to set in the engine's configuration file (override defaults)
    //      May be 'null' if there are no overrides.
    public static BSScene CreateBasicPhysicsEngine(Dictionary<string,string> paramOverrides)
    {
        IConfigSource openSimINI = new IniConfigSource();
        IConfig startupConfig = openSimINI.AddConfig("Startup");
        startupConfig.Set("physics", "BulletSim");
        startupConfig.Set("meshing", "Meshmerizer");
        startupConfig.Set("cacheSculptMaps", "false");  // meshmerizer shouldn't save maps

        IConfig bulletSimConfig = openSimINI.AddConfig("BulletSim");
        // If the caller cares, specify the bullet engine otherwise it will default to "BulletUnmanaged".
        // bulletSimConfig.Set("BulletEngine", "BulletUnmanaged");
        // bulletSimConfig.Set("BulletEngine", "BulletXNA");
        bulletSimConfig.Set("MeshSculptedPrim", "false");
        bulletSimConfig.Set("ForceSimplePrimMeshing", "true");
        if (paramOverrides != null)
        {
            foreach (KeyValuePair<string, string> kvp in paramOverrides)
            {
                bulletSimConfig.Set(kvp.Key, kvp.Value);
            }
        }

        // If a special directory exists, put detailed logging therein.
        // This allows local testing/debugging without having to worry that the build engine will output logs.
        if (Directory.Exists("physlogs"))
        {
            bulletSimConfig.Set("PhysicsLoggingDir","./physlogs");
            bulletSimConfig.Set("PhysicsLoggingEnabled","True");
            bulletSimConfig.Set("PhysicsLoggingDoFlush","True");
            bulletSimConfig.Set("VehicleLoggingEnabled","True");
        }

        Vector3 regionExtent = new Vector3(Constants.RegionSize, Constants.RegionSize, Constants.RegionHeight);
       
        RegionInfo info = new RegionInfo();
        info.RegionName = "BSTestRegion";
        info.RegionSizeX = info.RegionSizeY = info.RegionSizeZ = Constants.RegionSize;
        OpenSim.Region.Framework.Scenes.Scene scene = new OpenSim.Region.Framework.Scenes.Scene(info);

        IMesher mesher = new OpenSim.Region.PhysicsModules.Meshing.Meshmerizer();
        INonSharedRegionModule mod = mesher as INonSharedRegionModule;
        mod.Initialise(openSimINI);
        mod.AddRegion(scene);
        mod.RegionLoaded(scene);

        BSScene pScene = new BSScene();
        mod = (pScene as INonSharedRegionModule);
        mod.Initialise(openSimINI);
        mod.AddRegion(scene);
        mod.RegionLoaded(scene);

        // Since the asset requestor is not initialized, any mesh or sculptie will be a cube.
        // In the future, add a fake asset fetcher to get meshes and sculpts.
        // bsScene.RequestAssetMethod = ???;

        return pScene;
    }
        private void SetUp()
        {
            IConfigSource config = new IniConfigSource();
            config.AddConfig("Modules");
            config.AddConfig("GridService");
            config.Configs["Modules"].Set("GridServices", "LocalGridServicesConnector");
            config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Services.GridService.dll:GridService");
            config.Configs["GridService"].Set("StorageProvider", "OpenSim.Data.Null.dll:NullRegionData");

            m_LocalConnector = new LocalGridServicesConnector(config);
        }
        public void SetUp()
        {
            IConfigSource config = new IniConfigSource();

            config.AddConfig("Modules");
            config.Configs["Modules"].Set("AssetCaching", "FlotsamAssetCache");
            config.AddConfig("AssetCache");
            config.Configs["AssetCache"].Set("FileCacheEnabled", "false");
            config.Configs["AssetCache"].Set("MemoryCacheEnabled", "true");

            m_cache = new FlotsamAssetCache();
            m_scene = SceneSetupHelpers.SetupScene();
            SceneSetupHelpers.SetupSceneModules(m_scene, config, m_cache);
        }
        private void SetUp()
        {
            IConfigSource config = new IniConfigSource();
            config.AddConfig("Modules");
            config.AddConfig("PresenceService");
            config.Configs["Modules"].Set("PresenceServices", "LocalPresenceServicesConnector");
            config.Configs["PresenceService"].Set("LocalServiceModule", "OpenSim.Services.PresenceService.dll:PresenceService");
            config.Configs["PresenceService"].Set("StorageProvider", "OpenSim.Data.Null.dll");

            m_LocalConnector = new LocalPresenceServicesConnector(config);

            // Let's stick in a test presence
            m_LocalConnector.m_PresenceService.LoginAgent(UUID.Zero.ToString(), UUID.Zero, UUID.Zero);
        }
    // 'engineName' is the Bullet engine to use. Either null (for unmanaged), "BulletUnmanaged" or "BulletXNA"
    // 'params' is a set of keyValue pairs to set in the engine's configuration file (override defaults)
    //      May be 'null' if there are no overrides.
    public static BSScene CreateBasicPhysicsEngine(Dictionary<string,string> paramOverrides)
    {
        IConfigSource openSimINI = new IniConfigSource();
        IConfig startupConfig = openSimINI.AddConfig("Startup");
        startupConfig.Set("physics", "BulletSim");
        startupConfig.Set("meshing", "Meshmerizer");
        startupConfig.Set("cacheSculptMaps", "false");  // meshmerizer shouldn't save maps

        IConfig bulletSimConfig = openSimINI.AddConfig("BulletSim");
        // If the caller cares, specify the bullet engine otherwise it will default to "BulletUnmanaged".
        // bulletSimConfig.Set("BulletEngine", "BulletUnmanaged");
        // bulletSimConfig.Set("BulletEngine", "BulletXNA");
        bulletSimConfig.Set("MeshSculptedPrim", "false");
        bulletSimConfig.Set("ForceSimplePrimMeshing", "true");
        if (paramOverrides != null)
        {
            foreach (KeyValuePair<string, string> kvp in paramOverrides)
            {
                bulletSimConfig.Set(kvp.Key, kvp.Value);
            }
        }

        // If a special directory exists, put detailed logging therein.
        // This allows local testing/debugging without having to worry that the build engine will output logs.
        if (Directory.Exists("physlogs"))
        {
            bulletSimConfig.Set("PhysicsLoggingDir","./physlogs");
            bulletSimConfig.Set("PhysicsLoggingEnabled","True");
            bulletSimConfig.Set("PhysicsLoggingDoFlush","True");
            bulletSimConfig.Set("VehicleLoggingEnabled","True");
        }

        PhysicsPluginManager physicsPluginManager;
        physicsPluginManager = new PhysicsPluginManager();
        physicsPluginManager.LoadPluginsFromAssemblies("Physics");

        Vector3 regionExtent = new Vector3(Constants.RegionSize, Constants.RegionSize, Constants.RegionHeight);
       
        PhysicsScene pScene = physicsPluginManager.GetPhysicsScene(
                        "BulletSim", "Meshmerizer", openSimINI, "BSTestRegion", regionExtent);

        BSScene bsScene = pScene as BSScene;

        // Since the asset requestor is not initialized, any mesh or sculptie will be a cube.
        // In the future, add a fake asset fetcher to get meshes and sculpts.
        // bsScene.RequestAssetMethod = ???;

        return bsScene;
    }
Exemple #16
0
        public void Init()
        {
            IConfigSource config = new IniConfigSource();
            config.AddConfig("Modules");
            // Not strictly necessary since FriendsModule assumes it is the default (!)
            config.Configs["Modules"].Set("FriendsModule", "FriendsModule");
            config.AddConfig("Friends");
            config.Configs["Friends"].Set("Connector", "OpenSim.Services.FriendsService.dll");
            config.AddConfig("FriendsService");
            config.Configs["FriendsService"].Set("StorageProvider", "OpenSim.Data.Null.dll");

            m_scene = SceneHelpers.SetupScene();
            m_fm = new FriendsModule();
            SceneHelpers.SetupSceneModules(m_scene, config, m_fm);
        }
        private void SetUp()
        {
            IConfigSource config = new IniConfigSource();
            config.AddConfig("Modules");
            config.AddConfig("GridService");
            config.Configs["Modules"].Set("GridServices", "LocalGridServicesConnector");
            config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Services.GridService.dll:GridService");
            config.Configs["GridService"].Set("StorageProvider", "OpenSim.Data.Null.dll");
            config.Configs["GridService"].Set("Region_Test_Region_1", "DefaultRegion");
            config.Configs["GridService"].Set("Region_Test_Region_2", "FallbackRegion");
            config.Configs["GridService"].Set("Region_Test_Region_3", "FallbackRegion");
            config.Configs["GridService"].Set("Region_Other_Region_4", "FallbackRegion");

            m_LocalConnector = new LocalGridServicesConnector(config);
        }
Exemple #18
0
        public void Init()
        {
            IConfigSource config = new IniConfigSource();
            config.AddConfig("NPC");
            config.Configs["NPC"].Set("Enabled", "true");
            config.AddConfig("Modules");
            config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule");

            afm = new AvatarFactoryModule();
            umm = new UserManagementModule();
            am = new AttachmentsModule();

            scene = SceneHelpers.SetupScene();
            SceneHelpers.SetupSceneModules(scene, config, afm, umm, am, new BasicInventoryAccessModule(), new NPCModule());
        }
        public void TestCachedUserNameForNewAgent()
        {
            TestHelpers.InMethod();
//            TestHelpers.EnableLogging();

            HGUserManagementModule hgumm = new HGUserManagementModule();
            UUID userId = TestHelpers.ParseStem("11");
            string firstName = "Fred";
            string lastName = "Astaire";
            string homeUri = "example.com";

            IConfigSource config = new IniConfigSource();
            config.AddConfig("Modules");
            config.Configs["Modules"].Set("UserManagementModule", hgumm.Name);

            SceneHelpers sceneHelpers = new SceneHelpers();
            TestScene scene = sceneHelpers.SetupScene();
            SceneHelpers.SetupSceneModules(scene, config, hgumm);

            AgentCircuitData acd = SceneHelpers.GenerateAgentData(userId);
            acd.firstname = firstName;
            acd.lastname = lastName;
            acd.ServiceURLs["HomeURI"] = "http://" + homeUri;

            SceneHelpers.AddScenePresence(scene, acd);

            string name = hgumm.GetUserName(userId);
            Assert.That(name, Is.EqualTo(string.Format("{0}.{1} @{2}", firstName, lastName, homeUri)));
        }
        public void TestSameRegionTeleport()
        {
            TestHelpers.InMethod();
//            log4net.Config.XmlConfigurator.Configure();

            EntityTransferModule etm = new EntityTransferModule();

            IConfigSource config = new IniConfigSource();
            config.AddConfig("Modules");
            // Not strictly necessary since FriendsModule assumes it is the default (!)
            config.Configs["Modules"].Set("EntityTransferModule", etm.Name);

            TestScene scene = new SceneHelpers().SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000);
            SceneHelpers.SetupSceneModules(scene, config, etm);

            Vector3 teleportPosition = new Vector3(10, 11, 12);
            Vector3 teleportLookAt = new Vector3(20, 21, 22);

            ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1));
            sp.AbsolutePosition = new Vector3(30, 31, 32);
            scene.RequestTeleportLocation(
                sp.ControllingClient,
                scene.RegionInfo.RegionHandle,
                teleportPosition,
                teleportLookAt,
                (uint)TeleportFlags.ViaLocation);

            Assert.That(sp.AbsolutePosition, Is.EqualTo(teleportPosition));

            // Lookat is sent to the client only - sp.Lookat does not yield the same thing (calculation from camera
            // position instead).
//            Assert.That(sp.Lookat, Is.EqualTo(teleportLookAt));
        }
        public override void SetUp()
        {
            base.SetUp();

            IConfigSource configSource = new IniConfigSource();
            IConfig jsonStoreConfig = configSource.AddConfig("JsonStore");
            jsonStoreConfig.Set("Enabled", "true");

            m_engine = new MockScriptEngine();
            m_smcm = new ScriptModuleCommsModule();
            JsonStoreModule jsm = new JsonStoreModule();
            m_jssm = new JsonStoreScriptModule();

            m_scene = new SceneHelpers().SetupScene();
            SceneHelpers.SetupSceneModules(m_scene, configSource, m_engine, m_smcm, jsm, m_jssm);

            try
            {
                m_smcm.RegisterScriptInvocation(this, "DummyTestMethod");
            }
            catch (ArgumentException)
            {
                Assert.Ignore("Ignoring test since running on .NET 3.5 or earlier.");
            }

            // XXX: Unfortunately, ICommsModule currently has no way of deregistering methods.
        }
        public void TestCrossOnSameSimulator()
        {
            TestHelpers.InMethod();
//            TestHelpers.EnableLogging();

            UUID userId = TestHelpers.ParseTail(0x1);
            int sceneObjectIdTail = 0x2;

            EntityTransferModule etmA = new EntityTransferModule();
            EntityTransferModule etmB = new EntityTransferModule();
            LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule();

            IConfigSource config = new IniConfigSource();
            IConfig modulesConfig = config.AddConfig("Modules");
            modulesConfig.Set("EntityTransferModule", etmA.Name);
            modulesConfig.Set("SimulationServices", lscm.Name);

            SceneHelpers sh = new SceneHelpers();
            TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000);
            TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1000, 999);

            SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm);
            SceneHelpers.SetupSceneModules(sceneA, config, etmA);
            SceneHelpers.SetupSceneModules(sceneB, config, etmB);

            SceneObjectGroup so1 = SceneHelpers.AddSceneObject(sceneA, 1, userId, "", sceneObjectIdTail);
            UUID so1Id = so1.UUID;
            so1.AbsolutePosition = new Vector3(128, 10, 20);

            // Cross with a negative value
            so1.AbsolutePosition = new Vector3(128, -10, 20);

            Assert.IsNull(sceneA.GetSceneObjectGroup(so1Id));
            Assert.NotNull(sceneB.GetSceneObjectGroup(so1Id));
        }
        public void EmptyConstructor()
        {
            string filePath = "EmptyConstructor.ini";
            IniConfigSource source = new IniConfigSource ();

            IConfig config = source.AddConfig ("Pets");
            config.Set ("cat", "Muffy");
            config.Set ("dog", "Rover");
            config.Set ("bird", "Tweety");
            source.Save (filePath);

            Assert.AreEqual (3, config.GetKeys ().Length);
            Assert.AreEqual ("Muffy", config.Get ("cat"));
            Assert.AreEqual ("Rover", config.Get ("dog"));
            Assert.AreEqual ("Tweety", config.Get ("bird"));

            source = new IniConfigSource (filePath);
            config = source.Configs["Pets"];

            Assert.AreEqual (3, config.GetKeys ().Length);
            Assert.AreEqual ("Muffy", config.Get ("cat"));
            Assert.AreEqual ("Rover", config.Get ("dog"));
            Assert.AreEqual ("Tweety", config.Get ("bird"));

            File.Delete (filePath);
        }
        public void IncludeTests()
        {
            const string mainIniFile = "OpenSimDefaults.ini";
            m_config = new IniConfigSource();

            // Create ini files in a directory structure
            IniConfigSource ini;
            IConfig config;

            ini = new IniConfigSource();
            config = ini.AddConfig("IncludeTest");
            config.Set("Include-absolute", "absolute/*/config/*.ini");
            config.Set("Include-relative", "../" + m_testSubdirectory + "/relative/*/config/*.ini");
            CreateIni(mainIniFile, ini);

            ini = new IniConfigSource();
            ini.AddConfig("Absolute1").Set("name1", "value1");
            CreateIni("absolute/one/config/setting.ini", ini);

            ini = new IniConfigSource();
            ini.AddConfig("Absolute2").Set("name2", 2.3);
            CreateIni("absolute/two/config/setting1.ini", ini);

            ini = new IniConfigSource();
            ini.AddConfig("Absolute2").Set("name3", "value3");
            CreateIni("absolute/two/config/setting2.ini", ini);

            ini = new IniConfigSource();
            ini.AddConfig("Relative1").Set("name4", "value4");
            CreateIni("relative/one/config/setting.ini", ini);

            ini = new IniConfigSource();
            ini.AddConfig("Relative2").Set("name5", true);
            CreateIni("relative/two/config/setting1.ini", ini);

            ini = new IniConfigSource();
            ini.AddConfig("Relative2").Set("name6", 6);
            CreateIni("relative/two/config/setting2.ini", ini);

            // Prepare call to ConfigurationLoader.LoadConfigSettings()
            ConfigurationLoader cl = new ConfigurationLoader();
            IConfigSource argvSource = new IniConfigSource();
            argvSource.AddConfig("Startup").Set("inifile", mainIniFile);
            ConfigSettings configSettings;

            OpenSimConfigSource source = cl.LoadConfigSettings(argvSource, out configSettings);

            // Remove default config
            config = source.Source.Configs["Startup"];
            source.Source.Configs.Remove(config);
            config = source.Source.Configs["Network"];
            source.Source.Configs.Remove(config);

            // Finally, we are able to check the result
            Assert.AreEqual(m_config.ToString(), source.Source.ToString(),
                "Configuration with includes does not contain all settings.");
            // The following would be preferable but fails due to a type mismatch which I am not able to resolve
            //CollectionAssert.AreEquivalent(m_config.Configs, source.Source.Configs,
            //    String.Format("Configuration with includes does not contain all settings.\nAll settings:\n{0}\nSettings read:\n{1}", m_config, source.Source));
        }
        public void TestDeRezSceneObject()
        {
            TestHelpers.InMethod();
                        
            UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001");
            
            TestScene scene = new SceneHelpers().SetupScene();
            IConfigSource configSource = new IniConfigSource();
            IConfig config = configSource.AddConfig("Startup");
            config.Set("serverside_object_permissions", true);
            SceneHelpers.SetupSceneModules(scene, configSource, new object[] { new DefaultPermissionsModule() });
            IClientAPI client = SceneHelpers.AddScenePresence(scene, userId).ControllingClient;
            
            // Turn off the timer on the async sog deleter - we'll crank it by hand for this test.
            AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
            sogd.Enabled = false;            

            SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, "so1", userId);
            uint soLocalId = so.LocalId;

            List<uint> localIds = new List<uint>();
            localIds.Add(so.LocalId);
            scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.Delete, UUID.Zero);

            // Check that object isn't deleted until we crank the sogd handle.
            SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId);
//            Assert.That(retrievedPart, Is.Not.Null);
//            Assert.That(retrievedPart.ParentGroup.IsDeleted, Is.False);

            sogd.InventoryDeQueueAndDelete();
            
//            SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId);
            Assert.That(retrievedPart, Is.Null);              
        }
        public void ConfigCollectionEvents()
        {
            IniConfigSource source = new IniConfigSource ();
            source.Configs.ConfigAdded +=
                            new ConfigEventHandler (this.source_configAdded);
            source.Configs.ConfigRemoved +=
                            new ConfigEventHandler (this.source_configRemoved);

            Assert.AreEqual (configAddedCount, 0);

            eventCollection = null;
            IConfig config = source.AddConfig ("Test");
            Assert.IsTrue (source.Configs == eventCollection);
            Assert.AreEqual (configAddedCount, 1);
            Assert.AreEqual ("Test", eventConfig.Name);

            eventCollection = null;
            config = source.Configs.Add ("Test 2");
            Assert.IsTrue (source.Configs == eventCollection);
            Assert.AreEqual (configAddedCount, 2);
            Assert.AreEqual ("Test 2", eventConfig.Name);

            eventCollection = null;
            source.Configs.RemoveAt (0);
            Assert.IsTrue (source.Configs == eventCollection);
            Assert.AreEqual (configAddedCount, 2);
            Assert.AreEqual ("Test", eventConfig.Name);
        }
        public void SetUpScene(uint sizeX, uint sizeY)
        {
            IConfigSource config = new IniConfigSource();
            config.AddConfig("NPC");
            config.Configs["NPC"].Set("Enabled", "true");
            config.AddConfig("Modules");
            config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule");

            m_afMod = new AvatarFactoryModule();
            m_umMod = new UserManagementModule();
            m_attMod = new AttachmentsModule();
            m_npcMod = new NPCModule();

            m_scene = new SceneHelpers().SetupScene("test scene", UUID.Random(), 1000, 1000, sizeX, sizeY, config);
            SceneHelpers.SetupSceneModules(m_scene, config, m_afMod, m_umMod, m_attMod, m_npcMod, new BasicInventoryAccessModule());
        }
Exemple #28
0
        public void Init()
        {
            IConfigSource config = new IniConfigSource();
            config.AddConfig("NPC");
            config.Configs["NPC"].Set("Enabled", "true");
            config.AddConfig("Modules");
            config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule");

            m_afMod = new AvatarFactoryModule();
            m_umMod = new UserManagementModule();
            m_attMod = new AttachmentsModule();
            m_npcMod = new NPCModule();

            m_scene = SceneHelpers.SetupScene();
            SceneHelpers.SetupSceneModules(m_scene, config, m_afMod, m_umMod, m_attMod, m_npcMod, new BasicInventoryAccessModule());
        }
Exemple #29
0
        public void TestCreate()
        {
            TestHelper.InMethod();
//            log4net.Config.XmlConfigurator.Configure();

            IConfigSource config = new IniConfigSource();
            config.AddConfig("NPC");
            config.Configs["NPC"].Set("Enabled", "true");

            AvatarFactoryModule afm = new AvatarFactoryModule();
            TestScene scene = SceneSetupHelpers.SetupScene();
            SceneSetupHelpers.SetupSceneModules(scene, config, afm, new NPCModule());
            TestClient originalClient = SceneSetupHelpers.AddClient(scene, TestHelper.ParseTail(0x1));
//            ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId);

            // 8 is the index of the first baked texture in AvatarAppearance
            UUID originalFace8TextureId = TestHelper.ParseTail(0x10);
            Primitive.TextureEntry originalTe = new Primitive.TextureEntry(UUID.Zero);
            Primitive.TextureEntryFace originalTef = originalTe.CreateFace(8);
            originalTef.TextureID = originalFace8TextureId;

            // We also need to add the texture to the asset service, otherwise the AvatarFactoryModule will tell
            // ScenePresence.SendInitialData() to reset our entire appearance.
            scene.AssetService.Store(AssetHelpers.CreateAsset(originalFace8TextureId));

            afm.SetAppearance(originalClient, originalTe, null);

            INPCModule npcModule = scene.RequestModuleInterface<INPCModule>();
            UUID npcId = npcModule.CreateNPC("John", "Smith", new Vector3(128, 128, 30), scene, originalClient.AgentId);

            ScenePresence npc = scene.GetScenePresence(npcId);

            Assert.That(npc, Is.Not.Null);
            Assert.That(npc.Appearance.Texture.FaceTextures[8].TextureID, Is.EqualTo(originalFace8TextureId));
        }
        public void TestGoodAssetStoreRequest()
        {
            TestHelpers.InMethod();

            UUID assetId = TestHelpers.ParseTail(0x1);

            IConfigSource config = new IniConfigSource();         
            config.AddConfig("AssetService");           
            config.Configs["AssetService"].Set("StorageProvider", "OpenSim.Tests.Common.dll");

            AssetService assetService = new AssetService(config);

            AssetServerPostHandler asph = new AssetServerPostHandler(assetService);

            AssetBase asset = AssetHelpers.CreateNotecardAsset(assetId, "Hello World");

            MemoryStream buffer = new MemoryStream();

            XmlWriterSettings settings = new XmlWriterSettings();
            settings.Encoding = Encoding.UTF8;

            using (XmlWriter writer = XmlWriter.Create(buffer, settings))
            {
                XmlSerializer serializer = new XmlSerializer(typeof(AssetBase));
                serializer.Serialize(writer, asset);
                writer.Flush();
            }            

            buffer.Position = 0;
            asph.Handle(null, buffer, null, null);

            AssetBase retrievedAsset = assetService.Get(assetId.ToString());

            Assert.That(retrievedAsset, Is.Not.Null);
        }