コード例 #1
0
        public void TestDeleteSceneObjectAsyncToUserInventory()
        {
            TestHelper.InMethod();
            //log4net.Config.XmlConfigurator.Configure();

            UUID   agentId      = UUID.Parse("00000000-0000-0000-0000-000000000001");
            string myObjectName = "Fred";

            TestScene       scene = SceneSetupHelpers.SetupScene();
            SceneObjectPart part  = SceneSetupHelpers.AddSceneObject(scene, myObjectName);

            Assert.That(
                scene.CommsManager.UserAdminService.AddUser(
                    "Bob", "Hoskins", "test", "*****@*****.**", 1000, 1000, agentId),
                Is.EqualTo(agentId));

            IClientAPI client = SceneSetupHelpers.AddRootAgent(scene, agentId);

            CachedUserInfo userInfo = scene.CommsManager.UserProfileCacheService.GetUserDetails(agentId);

            Assert.That(userInfo, Is.Not.Null);
            Assert.That(userInfo.RootFolder, Is.Not.Null);

            SceneSetupHelpers.DeleteSceneObjectAsync(scene, part, DeRezAction.Take, userInfo.RootFolder.ID, client);

            // Check that we now have the taken part in our inventory
            Assert.That(myObjectName, Is.EqualTo(userInfo.RootFolder.FindItemByPath(myObjectName).Name));

            // Check that the taken part has actually disappeared
            SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);

            Assert.That(retrievedPart, Is.Null);
        }
コード例 #2
0
        public void TestDeleteSceneObjectAsync()
        {
            TestHelper.InMethod();
            //log4net.Config.XmlConfigurator.Configure();

            UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001");

            TestScene scene = SceneSetupHelpers.SetupScene();

            // 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 = SceneSetupHelpers.AddSceneObject(scene);

            IClientAPI client = SceneSetupHelpers.AddRootAgent(scene, agentId);

            scene.DeRezObjects(client, new System.Collections.Generic.List <uint>()
            {
                part.LocalId
            }, UUID.Zero, DeRezAction.Delete, UUID.Zero);

            SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);

            Assert.That(retrievedPart, Is.Not.Null);

            sogd.InventoryDeQueueAndDelete();

            SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(part.LocalId);

            Assert.That(retrievedPart2, Is.Null);
        }
コード例 #3
0
        public void Init()
        {
            TestHelper.InMethod();

            scene  = SceneSetupHelpers.SetupScene("Neighbour x", UUID.Random(), 1000, 1000);
            scene2 = SceneSetupHelpers.SetupScene("Neighbour x+1", UUID.Random(), 1001, 1000);

            ISharedRegionModule interregionComms = new LocalSimulationConnectorModule();

            interregionComms.Initialise(new IniConfigSource());
            interregionComms.PostInitialise();
            SceneSetupHelpers.SetupSceneModules(scene, new IniConfigSource(), interregionComms);
            SceneSetupHelpers.SetupSceneModules(scene2, new IniConfigSource(), interregionComms);

            agent1 = UUID.Random();
            random = new Random();
            sog1   = NewSOG(UUID.Random(), scene, agent1);
            sog2   = NewSOG(UUID.Random(), scene, agent1);
            sog3   = NewSOG(UUID.Random(), scene, agent1);

            //ulong neighbourHandle = Utils.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize));
            region1 = scene.RegionInfo.RegionHandle;
            region2 = scene2.RegionInfo.RegionHandle;

            SceneSetupHelpers.AddRootAgent(scene, agent1);
        }
コード例 #4
0
        public void TestShareWithGroup()
        {
            TestHelper.InMethod();
//            log4net.Config.XmlConfigurator.Configure();

            UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001");

            TestScene     scene        = SceneSetupHelpers.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);

            SceneSetupHelpers.SetupSceneModules(
                scene, configSource, new object[]
                { new PermissionsModule(),
                  new GroupsModule(),
                  new MockGroupsServicesConnector() });

            TestClient client = SceneSetupHelpers.AddRootAgent(scene, userId);

            IGroupsModule groupsModule = scene.RequestModuleInterface <IGroupsModule>();

            groupsModule.CreateGroup(client, "group1", "To boldly go", true, UUID.Zero, 5, true, true, true);
        }
コード例 #5
0
        public void TestSimpleNotNeighboursTeleport()
        {
            TestHelper.InMethod();

            // Console.WriteLine("Beginning test {0}", MethodBase.GetCurrentMethod());

            log4net.Config.XmlConfigurator.Configure();

            UUID sceneAId = UUID.Parse("00000000-0000-0000-0000-000000000100");
            UUID sceneBId = UUID.Parse("00000000-0000-0000-0000-000000000200");
            TestCommunicationsManager cm = new TestCommunicationsManager();

            // shared module
            IRegionModule interregionComms = new RESTInterregionComms();

            Scene sceneA = SceneSetupHelpers.SetupScene("sceneA", sceneAId, 1000, 1000, cm);

            SceneSetupHelpers.SetupSceneModules(sceneA, new IniConfigSource(), interregionComms);
            sceneA.RegisterRegionWithGrid();

            Scene sceneB = SceneSetupHelpers.SetupScene("sceneB", sceneBId, 1010, 1010, cm);

            SceneSetupHelpers.SetupSceneModules(sceneB, new IniConfigSource(), interregionComms);
            sceneB.RegisterRegionWithGrid();

            UUID       agentId = UUID.Parse("00000000-0000-0000-0000-000000000041");
            TestClient client  = SceneSetupHelpers.AddRootAgent(sceneA, agentId);

            ICapabilitiesModule sceneACapsModule = sceneA.RequestModuleInterface <ICapabilitiesModule>();

            Assert.That(
                sceneACapsModule.GetCapsPath(agentId),
                Is.EqualTo(client.CapsSeedUrl),
                "Incorrect caps object path set up in sceneA");

            // FIXME: This is a hack to get the test working - really the normal OpenSim mechanisms should be used.
            client.TeleportTargetScene = sceneB;
            client.Teleport(sceneB.RegionInfo.RegionHandle, new Vector3(100, 100, 100), new Vector3(40, 40, 40));

            Assert.That(sceneB.GetScenePresence(agentId), Is.Not.Null, "Client does not have an agent in sceneB");
            Assert.That(sceneA.GetScenePresence(agentId), Is.Null, "Client still had an agent in sceneA");

            ICapabilitiesModule sceneBCapsModule = sceneB.RequestModuleInterface <ICapabilitiesModule>();

            // Temporary assertion - caps url construction should at least be doable through a method.
            Assert.That(
                "http://" + sceneB.RegionInfo.ExternalHostName + ":" + sceneB.RegionInfo.HttpPort + "/CAPS/" + sceneBCapsModule.GetCapsPath(agentId) + "0000/",
                Is.EqualTo(client.CapsSeedUrl),
                "Incorrect caps object path set up in sceneB");

            // This assertion will currently fail since we don't remove the caps paths when no longer needed
            //Assert.That(sceneACapsModule.GetCapsPath(agentId), Is.Null, "sceneA still had a caps object path");

            // TODO: Check that more of everything is as it should be

            // TODO: test what happens if we try to teleport to a region that doesn't exist
        }
コード例 #6
0
        public void TestDeRezSceneObjectNotOwner()
        {
            TestHelper.InMethod();
//            log4net.Config.XmlConfigurator.Configure();

            UUID userId        = UUID.Parse("10000000-0000-0000-0000-000000000001");
            UUID objectOwnerId = UUID.Parse("20000000-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(objectOwnerId, 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();

            // Object should still be in the scene.
            SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);

            Assert.That(retrievedPart.UUID, Is.EqualTo(part.UUID));
        }
コード例 #7
0
        public void TestChildAgentEstablished()
        {
            TestHelper.InMethod();
//            log4net.Config.XmlConfigurator.Configure();

            UUID agent1Id = UUID.Parse("00000000-0000-0000-0000-000000000001");

            TestScene myScene1 = SceneSetupHelpers.SetupScene("Neighbour y", UUID.Random(), 1000, 1000);
            TestScene myScene2 = SceneSetupHelpers.SetupScene("Neighbour y + 1", UUID.Random(), 1001, 1000);

            IConfigSource configSource = new IniConfigSource();

            configSource.AddConfig("Modules").Set("EntityTransferModule", "BasicEntityTransferModule");
            EntityTransferModule etm = new EntityTransferModule();

            SceneSetupHelpers.SetupSceneModules(myScene1, configSource, etm);

            SceneSetupHelpers.AddRootAgent(myScene1, agent1Id);
            ScenePresence childPresence = myScene2.GetScenePresence(agent1);

            // TODO: Need to do a fair amount of work to allow synchronous establishment of child agents
//            Assert.That(childPresence, Is.Not.Null);
//            Assert.That(childPresence.IsChildAgent, Is.True);
        }
コード例 #8
0
        public void run(object o)
        {
            //results.Result = true;
            log4net.Config.XmlConfigurator.Configure();

            UUID sceneAId = UUID.Parse("00000000-0000-0000-0000-000000000100");
            UUID sceneBId = UUID.Parse("00000000-0000-0000-0000-000000000200");

            // shared module
            ISharedRegionModule interregionComms = new LocalSimulationConnectorModule();


            Scene sceneB = SceneSetupHelpers.SetupScene("sceneB", sceneBId, 1010, 1010, "grid");

            SceneSetupHelpers.SetupSceneModules(sceneB, new IniConfigSource(), interregionComms);
            sceneB.RegisterRegionWithGrid();

            Scene sceneA = SceneSetupHelpers.SetupScene("sceneA", sceneAId, 1000, 1000, "grid");

            SceneSetupHelpers.SetupSceneModules(sceneA, new IniConfigSource(), interregionComms);
            sceneA.RegisterRegionWithGrid();

            UUID       agentId = UUID.Parse("00000000-0000-0000-0000-000000000041");
            TestClient client  = SceneSetupHelpers.AddRootAgent(sceneA, agentId);

            ICapabilitiesModule sceneACapsModule = sceneA.RequestModuleInterface <ICapabilitiesModule>();

            results.Result = (sceneACapsModule.GetCapsPath(agentId) == client.CapsSeedUrl);

            if (!results.Result)
            {
                results.Message = "Incorrect caps object path set up in sceneA";
                return;
            }

            /*
             * Assert.That(
             *  sceneACapsModule.GetCapsPath(agentId),
             *  Is.EqualTo(client.CapsSeedUrl),
             *  "Incorrect caps object path set up in sceneA");
             */
            // FIXME: This is a hack to get the test working - really the normal OpenSim mechanisms should be used.


            client.TeleportTargetScene = sceneB;
            client.Teleport(sceneB.RegionInfo.RegionHandle, new Vector3(100, 100, 100), new Vector3(40, 40, 40));

            results.Result = (sceneB.GetScenePresence(agentId) != null);
            if (!results.Result)
            {
                results.Message = "Client does not have an agent in sceneB";
                return;
            }

            //Assert.That(sceneB.GetScenePresence(agentId), Is.Not.Null, "Client does not have an agent in sceneB");

            //Assert.That(sceneA.GetScenePresence(agentId), Is.Null, "Client still had an agent in sceneA");

            results.Result = (sceneA.GetScenePresence(agentId) == null);
            if (!results.Result)
            {
                results.Message = "Client still had an agent in sceneA";
                return;
            }

            ICapabilitiesModule sceneBCapsModule = sceneB.RequestModuleInterface <ICapabilitiesModule>();


            results.Result = ("http://" + sceneB.RegionInfo.ExternalHostName + ":" + sceneB.RegionInfo.HttpPort +
                              "/CAPS/" + sceneBCapsModule.GetCapsPath(agentId) + "0000/" == client.CapsSeedUrl);
            if (!results.Result)
            {
                results.Message = "Incorrect caps object path set up in sceneB";
                return;
            }

            // Temporary assertion - caps url construction should at least be doable through a method.

            /*
             * Assert.That(
             *  "http://" + sceneB.RegionInfo.ExternalHostName + ":" + sceneB.RegionInfo.HttpPort + "/CAPS/" + sceneBCapsModule.GetCapsPath(agentId) + "0000/",
             *  Is.EqualTo(client.CapsSeedUrl),
             *  "Incorrect caps object path set up in sceneB");
             */
            // This assertion will currently fail since we don't remove the caps paths when no longer needed
            //Assert.That(sceneACapsModule.GetCapsPath(agentId), Is.Null, "sceneA still had a caps object path");

            // TODO: Check that more of everything is as it should be

            // TODO: test what happens if we try to teleport to a region that doesn't exist
        }