コード例 #1
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);
        }
コード例 #2
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);
        }
コード例 #3
0
        public void Init()
        {
            scene  = SceneSetupHelpers.SetupScene("Neighbour x", UUID.Random(), 1000, 1000);
            scene2 = SceneSetupHelpers.SetupScene("Neighbour x+1", UUID.Random(), 1001, 1000);
            scene3 = SceneSetupHelpers.SetupScene("Neighbour x-1", UUID.Random(), 999, 1000);

            ISharedRegionModule interregionComms = new LocalSimulationConnectorModule();

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

            agent1 = UUID.Random();
            agent2 = UUID.Random();
            agent3 = 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;
            region3 = scene3.RegionInfo.RegionHandle;
        }
コード例 #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 TestRemoveGroupObject()
        {
            TestHelper.InMethod();
//            log4net.Config.XmlConfigurator.Configure();

            m_lo.DeedToGroup(m_groupId);

            IPrimCounts pc = m_lo.PrimCounts;

            SceneObjectGroup sogToKeep = SceneSetupHelpers.CreateSceneObject(1, m_userId, "a", 0x1);

            sogToKeep.GroupID = m_groupId;
            m_scene.AddNewSceneObject(sogToKeep, false);

            SceneObjectGroup sogToDelete = SceneSetupHelpers.CreateSceneObject(3, m_userId, "b", 0x10);

            m_scene.AddNewSceneObject(sogToDelete, false);
            m_scene.DeleteSceneObject(sogToDelete, false);

            Assert.That(pc.Owner, Is.EqualTo(0));
            Assert.That(pc.Group, Is.EqualTo(1));
            Assert.That(pc.Others, Is.EqualTo(0));
            Assert.That(pc.Total, Is.EqualTo(1));
            Assert.That(pc.Selected, Is.EqualTo(0));
            Assert.That(pc.Users[m_userId], Is.EqualTo(1));
            Assert.That(pc.Users[m_groupId], Is.EqualTo(0));
            Assert.That(pc.Users[m_otherUserId], Is.EqualTo(0));
            Assert.That(pc.Simulator, Is.EqualTo(1));
        }
コード例 #6
0
        /// <summary>
        /// It shouldn't be possible to add a scene object if one with that uuid already exists in the scene.
        /// </summary>
        public void TestAddExistingSceneObjectUuid()
        {
            TestHelper.InMethod();

            Scene scene = SceneSetupHelpers.SetupScene();

            string obj1Name = "Alfred";
            string obj2Name = "Betty";
            UUID   objUuid  = new UUID("00000000-0000-0000-0000-000000000001");

            SceneObjectPart part1
                = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
                {
                Name = obj1Name, UUID = objUuid
                };

            Assert.That(scene.AddNewSceneObject(new SceneObjectGroup(part1), false), Is.True);

            SceneObjectPart part2
                = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
                {
                Name = obj2Name, UUID = objUuid
                };

            Assert.That(scene.AddNewSceneObject(new SceneObjectGroup(part2), false), Is.False);

            SceneObjectPart retrievedPart = scene.GetSceneObjectPart(objUuid);

            //m_log.Debug("retrievedPart : {0}", retrievedPart);
            // If the parts have the same UUID then we will consider them as one and the same
            Assert.That(retrievedPart.Name, Is.EqualTo(obj1Name));
            Assert.That(retrievedPart.UUID, Is.EqualTo(objUuid));
        }
コード例 #7
0
        public void TestAddGroupObject()
        {
            TestHelper.InMethod();
//            log4net.Config.XmlConfigurator.Configure();

            m_lo.DeedToGroup(m_groupId);

            IPrimCounts pc = m_lo.PrimCounts;

            SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_otherUserId, "a", 0x01);

            sog.GroupID = m_groupId;
            m_scene.AddNewSceneObject(sog, false);

            Assert.That(pc.Owner, Is.EqualTo(0));
            Assert.That(pc.Group, Is.EqualTo(3));
            Assert.That(pc.Others, Is.EqualTo(0));
            Assert.That(pc.Total, Is.EqualTo(3));
            Assert.That(pc.Selected, Is.EqualTo(0));

            // Is this desired behaviour?  Not totally sure.
            Assert.That(pc.Users[m_userId], Is.EqualTo(0));
            Assert.That(pc.Users[m_groupId], Is.EqualTo(0));
            Assert.That(pc.Users[m_otherUserId], Is.EqualTo(3));

            Assert.That(pc.Simulator, Is.EqualTo(3));
        }
コード例 #8
0
        public void TestAddOwnerObject()
        {
            TestHelper.InMethod();
//            log4net.Config.XmlConfigurator.Configure();

            IPrimCounts pc = m_lo.PrimCounts;

            SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, "a", 0x01);

            m_scene.AddNewSceneObject(sog, false);

            Assert.That(pc.Owner, Is.EqualTo(3));
            Assert.That(pc.Group, Is.EqualTo(0));
            Assert.That(pc.Others, Is.EqualTo(0));
            Assert.That(pc.Total, Is.EqualTo(3));
            Assert.That(pc.Selected, Is.EqualTo(0));
            Assert.That(pc.Users[m_userId], Is.EqualTo(3));
            Assert.That(pc.Users[m_otherUserId], Is.EqualTo(0));
            Assert.That(pc.Simulator, Is.EqualTo(3));

            // Add a second object and retest
            SceneObjectGroup sog2 = SceneSetupHelpers.CreateSceneObject(2, m_userId, "b", 0x10);

            m_scene.AddNewSceneObject(sog2, false);

            Assert.That(pc.Owner, Is.EqualTo(5));
            Assert.That(pc.Group, Is.EqualTo(0));
            Assert.That(pc.Others, Is.EqualTo(0));
            Assert.That(pc.Total, Is.EqualTo(5));
            Assert.That(pc.Selected, Is.EqualTo(0));
            Assert.That(pc.Users[m_userId], Is.EqualTo(5));
            Assert.That(pc.Users[m_otherUserId], Is.EqualTo(0));
            Assert.That(pc.Simulator, Is.EqualTo(5));
        }
コード例 #9
0
        public void TestLoadIarV0_1ExistingUsers()
        {
            TestHelper.InMethod();
            //log4net.Config.XmlConfigurator.Configure();

            SerialiserModule        serialiserModule = new SerialiserModule();
            InventoryArchiverModule archiverModule   = new InventoryArchiverModule(true);

            // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene
            Scene scene = SceneSetupHelpers.SetupScene("inventory");

            SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);

            UserProfileTestUtils.CreateUserWithInventory(scene, m_ua1, "meowfood");
            UserProfileTestUtils.CreateUserWithInventory(scene, m_ua2, "hampshire");

            archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "/", "meowfood", m_iarStream);

            InventoryItemBase foundItem1
                = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_ua1.PrincipalID, m_item1Name);

            Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1");

// We have to disable this check since loaded items that did find users via OSPA resolution are now only storing the
// UUID, not the OSPA itself.
//            Assert.That(
//                foundItem1.CreatorId, Is.EqualTo(item1.CreatorId),
//                "Loaded item non-uuid creator doesn't match original");
            Assert.That(
                foundItem1.CreatorId, Is.EqualTo(m_ua2.PrincipalID.ToString()),
                "Loaded item non-uuid creator doesn't match original");

            Assert.That(
                foundItem1.CreatorIdAsUuid, Is.EqualTo(m_ua2.PrincipalID),
                "Loaded item uuid creator doesn't match original");
            Assert.That(foundItem1.Owner, Is.EqualTo(m_ua1.PrincipalID),
                        "Loaded item owner doesn't match inventory reciever");

            // Now try loading to a root child folder
            UserInventoryTestUtils.CreateInventoryFolder(scene.InventoryService, m_ua1.PrincipalID, "xA");
            MemoryStream archiveReadStream = new MemoryStream(m_iarStream.ToArray());

            archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "xA", "meowfood", archiveReadStream);

            InventoryItemBase foundItem2
                = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_ua1.PrincipalID, "xA/" + m_item1Name);

            Assert.That(foundItem2, Is.Not.Null, "Didn't find loaded item 2");

            // Now try loading to a more deeply nested folder
            UserInventoryTestUtils.CreateInventoryFolder(scene.InventoryService, m_ua1.PrincipalID, "xB/xC");
            archiveReadStream = new MemoryStream(archiveReadStream.ToArray());
            archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "xB/xC", "meowfood", archiveReadStream);

            InventoryItemBase foundItem3
                = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_ua1.PrincipalID, "xB/xC/" + m_item1Name);

            Assert.That(foundItem3, Is.Not.Null, "Didn't find loaded item 3");
        }
コード例 #10
0
        public void Init()
        {
            // FIXME: We don't need a full scene here - it would be enough to set up the asset service.
            Scene scene = SceneSetupHelpers.SetupScene();

            m_assetService = scene.AssetService;
            m_uuidGatherer = new UuidGatherer(m_assetService);
        }
コード例 #11
0
        public void TestMoveOwnerObject()
        {
            TestHelper.InMethod();
//            log4net.Config.XmlConfigurator.Configure();

            SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, "a", 0x01);

            m_scene.AddNewSceneObject(sog, false);
            SceneObjectGroup sog2 = SceneSetupHelpers.CreateSceneObject(2, m_userId, "b", 0x10);

            m_scene.AddNewSceneObject(sog2, false);

            // Move the first scene object to the eastern strip parcel
            sog.AbsolutePosition = new Vector3(254, 2, 2);

            IPrimCounts pclo1 = m_lo.PrimCounts;

            Assert.That(pclo1.Owner, Is.EqualTo(2));
            Assert.That(pclo1.Group, Is.EqualTo(0));
            Assert.That(pclo1.Others, Is.EqualTo(0));
            Assert.That(pclo1.Total, Is.EqualTo(2));
            Assert.That(pclo1.Selected, Is.EqualTo(0));
            Assert.That(pclo1.Users[m_userId], Is.EqualTo(2));
            Assert.That(pclo1.Users[m_otherUserId], Is.EqualTo(0));
            Assert.That(pclo1.Simulator, Is.EqualTo(5));

            IPrimCounts pclo2 = m_lo2.PrimCounts;

            Assert.That(pclo2.Owner, Is.EqualTo(3));
            Assert.That(pclo2.Group, Is.EqualTo(0));
            Assert.That(pclo2.Others, Is.EqualTo(0));
            Assert.That(pclo2.Total, Is.EqualTo(3));
            Assert.That(pclo2.Selected, Is.EqualTo(0));
            Assert.That(pclo2.Users[m_userId], Is.EqualTo(3));
            Assert.That(pclo2.Users[m_otherUserId], Is.EqualTo(0));
            Assert.That(pclo2.Simulator, Is.EqualTo(5));

            // Now move it back again
            sog.AbsolutePosition = new Vector3(2, 2, 2);

            Assert.That(pclo1.Owner, Is.EqualTo(5));
            Assert.That(pclo1.Group, Is.EqualTo(0));
            Assert.That(pclo1.Others, Is.EqualTo(0));
            Assert.That(pclo1.Total, Is.EqualTo(5));
            Assert.That(pclo1.Selected, Is.EqualTo(0));
            Assert.That(pclo1.Users[m_userId], Is.EqualTo(5));
            Assert.That(pclo1.Users[m_otherUserId], Is.EqualTo(0));
            Assert.That(pclo1.Simulator, Is.EqualTo(5));

            Assert.That(pclo2.Owner, Is.EqualTo(0));
            Assert.That(pclo2.Group, Is.EqualTo(0));
            Assert.That(pclo2.Others, Is.EqualTo(0));
            Assert.That(pclo2.Total, Is.EqualTo(0));
            Assert.That(pclo2.Selected, Is.EqualTo(0));
            Assert.That(pclo2.Users[m_userId], Is.EqualTo(0));
            Assert.That(pclo2.Users[m_otherUserId], Is.EqualTo(0));
            Assert.That(pclo2.Simulator, Is.EqualTo(5));
        }
コード例 #12
0
        /// <summary>
        /// Test merging a V0.2 OpenSim Region Archive into an existing scene
        /// </summary>
        //[Test]
        public void TestMergeOarV0_2()
        {
            TestHelper.InMethod();
            //XmlConfigurator.Configure();

            MemoryStream archiveWriteStream = new MemoryStream();

//            string part2Name = "objectMerge";
//            PrimitiveBaseShape part2Shape = PrimitiveBaseShape.CreateCylinder();
//            Vector3 part2GroupPosition = new Vector3(90, 80, 70);
//            Quaternion part2RotationOffset = new Quaternion(60, 70, 80, 90);
//            Vector3 part2OffsetPosition = new Vector3(20, 25, 30);

            SceneObjectPart part2 = CreateSceneObjectPart2();

            // Create an oar file that we can use for the merge
            {
                ArchiverModule   archiverModule   = new ArchiverModule();
                SerialiserModule serialiserModule = new SerialiserModule();
                TerrainModule    terrainModule    = new TerrainModule();

                Scene scene = SceneSetupHelpers.SetupScene();
                SceneSetupHelpers.SetupSceneModules(scene, archiverModule, serialiserModule, terrainModule);

                m_scene.AddNewSceneObject(new SceneObjectGroup(part2), false);

                // Write out this scene
                scene.EventManager.OnOarFileSaved += SaveCompleted;

                lock (this)
                {
                    m_archiverModule.ArchiveRegion(archiveWriteStream);
                    Monitor.Wait(this, 60000);
                }
            }

            {
                SceneObjectPart part1 = CreateSceneObjectPart1();
                m_scene.AddNewSceneObject(new SceneObjectGroup(part1), false);

                // Merge in the archive we created earlier
                byte[]       archive           = archiveWriteStream.ToArray();
                MemoryStream archiveReadStream = new MemoryStream(archive);

                m_archiverModule.DearchiveRegion(archiveReadStream, true, false, Guid.Empty);

                SceneObjectPart object1Existing = m_scene.GetSceneObjectPart(part1.Name);
                Assert.That(object1Existing, Is.Not.Null, "object1 was not present after merge");
                Assert.That(object1Existing.Name, Is.EqualTo(part1.Name), "object1 names not identical after merge");
                Assert.That(object1Existing.GroupPosition, Is.EqualTo(part1.GroupPosition), "object1 group position not equal after merge");

                SceneObjectPart object2PartMerged = m_scene.GetSceneObjectPart(part2.Name);
                Assert.That(object2PartMerged, Is.Not.Null, "object2 was not present after merge");
                Assert.That(object2PartMerged.Name, Is.EqualTo(part2.Name), "object2 names not identical after merge");
                Assert.That(object2PartMerged.GroupPosition, Is.EqualTo(part2.GroupPosition), "object2 group position not equal after merge");
            }
        }
コード例 #13
0
        public void TestLoadIarV0_1AbsentUsers()
        {
            TestHelper.InMethod();
            //log4net.Config.XmlConfigurator.Configure();

            string userFirstName            = "Charlie";
            string userLastName             = "Chan";
            UUID   userUuid                 = UUID.Parse("00000000-0000-0000-0000-000000000999");
            string userItemCreatorFirstName = "Bat";
            string userItemCreatorLastName  = "Man";
            //UUID userItemCreatorUuid = UUID.Parse("00000000-0000-0000-0000-000000008888");

            string itemName        = "b.lsl";
            string archiveItemName = InventoryArchiveWriteRequest.CreateArchiveItemName(itemName, UUID.Random());

            MemoryStream     archiveWriteStream = new MemoryStream();
            TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream);

            InventoryItemBase item1 = new InventoryItemBase();

            item1.Name      = itemName;
            item1.AssetID   = UUID.Random();
            item1.GroupID   = UUID.Random();
            item1.CreatorId = OspResolver.MakeOspa(userItemCreatorFirstName, userItemCreatorLastName);
            //item1.CreatorId = userUuid.ToString();
            //item1.CreatorId = "00000000-0000-0000-0000-000000000444";
            item1.Owner = UUID.Zero;

            string item1FileName
                = string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName);

            tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1));
            tar.Close();

            MemoryStream            archiveReadStream = new MemoryStream(archiveWriteStream.ToArray());
            SerialiserModule        serialiserModule  = new SerialiserModule();
            InventoryArchiverModule archiverModule    = new InventoryArchiverModule(true);

            // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene
            Scene scene = SceneSetupHelpers.SetupScene("inventory");

            SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
            UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userUuid, "meowfood");

            archiverModule.DearchiveInventory(userFirstName, userLastName, "/", "meowfood", archiveReadStream);

            InventoryItemBase foundItem1
                = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userUuid, itemName);

            Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1");
//            Assert.That(
//                foundItem1.CreatorId, Is.EqualTo(userUuid),
//                "Loaded item non-uuid creator doesn't match that of the loading user");
            Assert.That(
                foundItem1.CreatorIdAsUuid, Is.EqualTo(userUuid),
                "Loaded item uuid creator doesn't match that of the loading user");
        }
コード例 #14
0
        public void SetUp()
        {
            m_archiverModule = new ArchiverModule();
            SerialiserModule serialiserModule = new SerialiserModule();
            TerrainModule    terrainModule    = new TerrainModule();

            m_scene = SceneSetupHelpers.SetupScene();
            SceneSetupHelpers.SetupSceneModules(m_scene, m_archiverModule, serialiserModule, terrainModule);
        }
コード例 #15
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
        }
コード例 #16
0
        public void TestUpdateScene()
        {
            TestHelper.InMethod();

            Scene scene = SceneSetupHelpers.SetupScene();

            scene.Update();

            Assert.That(scene.Frame, Is.EqualTo(1));
        }
コード例 #17
0
        public override void SetUp()
        {
            base.SetUp();

            SerialiserModule serialiserModule = new SerialiserModule();

            m_archiverModule = new InventoryArchiverModule();

            m_scene = SceneSetupHelpers.SetupScene();
            SceneSetupHelpers.SetupSceneModules(m_scene, serialiserModule, m_archiverModule);
        }
コード例 #18
0
        public void TestAddSceneObject()
        {
            TestHelper.InMethod();

            Scene           scene         = SceneSetupHelpers.SetupScene();
            SceneObjectPart part          = SceneSetupHelpers.AddSceneObject(scene);
            SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);

            //m_log.Debug("retrievedPart : {0}", retrievedPart);
            // If the parts have the same UUID then we will consider them as one and the same
            Assert.That(retrievedPart.UUID, Is.EqualTo(part.UUID));
        }
コード例 #19
0
        public void TestDeleteSceneObject()
        {
            TestHelper.InMethod();

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

            scene.DeleteSceneObject(part.ParentGroup, false);

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

            Assert.That(retrievedPart, Is.Null);
        }
コード例 #20
0
        public void TestDuplicateObject()
        {
            TestHelper.InMethod();
            Scene scene = SceneSetupHelpers.SetupScene();

            UUID   ownerId   = new UUID("00000000-0000-0000-0000-000000000010");
            string part1Name = "part1";
            UUID   part1Id   = new UUID("00000000-0000-0000-0000-000000000001");
            string part2Name = "part2";
            UUID   part2Id   = new UUID("00000000-0000-0000-0000-000000000002");

            SceneObjectPart part1
                = new SceneObjectPart(ownerId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
                {
                Name = part1Name, UUID = part1Id
                };
            SceneObjectGroup so = new SceneObjectGroup(part1);
            SceneObjectPart  part2
                = new SceneObjectPart(ownerId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
                {
                Name = part2Name, UUID = part2Id
                };

            so.AddPart(part2);

            scene.AddNewSceneObject(so, false);

            SceneObjectGroup dupeSo
                = scene.SceneGraph.DuplicateObject(
                      part1.LocalId, new Vector3(10, 0, 0), 0, ownerId, UUID.Zero, Quaternion.Identity);

            Assert.That(dupeSo.Parts.Length, Is.EqualTo(2));

            SceneObjectPart dupePart1 = dupeSo.GetLinkNumPart(1);
            SceneObjectPart dupePart2 = dupeSo.GetLinkNumPart(2);

            Assert.That(dupePart1.LocalId, Is.Not.EqualTo(part1.LocalId));
            Assert.That(dupePart2.LocalId, Is.Not.EqualTo(part2.LocalId));

            Assert.That(dupePart1.Flags, Is.EqualTo(part1.Flags));
            Assert.That(dupePart2.Flags, Is.EqualTo(part2.Flags));

            /*
             * Assert.That(part1.PhysActor, Is.Not.Null);
             * Assert.That(part2.PhysActor, Is.Not.Null);
             * Assert.That(dupePart1.PhysActor, Is.Not.Null);
             * Assert.That(dupePart2.PhysActor, Is.Not.Null);
             */
        }
コード例 #21
0
        public void TestBasic()
        {
            TestHelper.InMethod();
//            log4net.Config.XmlConfigurator.Configure();

            TestScene     scene        = SceneSetupHelpers.SetupScene();
            IConfigSource configSource = new IniConfigSource();
            IConfig       config       = configSource.AddConfig("Groups");

            config.Set("Enabled", true);
            config.Set("Module", "GroupsModule");
            config.Set("DebugEnabled", true);
            SceneSetupHelpers.SetupSceneModules(
                scene, configSource, new object[] { new MockGroupsServicesConnector() });
        }
コード例 #22
0
        public void TestPartExistingIarPath()
        {
            TestHelper.InMethod();
            //log4net.Config.XmlConfigurator.Configure();

            Scene       scene = SceneSetupHelpers.SetupScene("inventory");
            UserAccount ua1   = UserProfileTestUtils.CreateUserWithInventory(scene);

            string folder1ExistingName = "a";
            string folder2Name         = "b";

            InventoryFolderBase folder1
                = UserInventoryTestUtils.CreateInventoryFolder(
                      scene.InventoryService, ua1.PrincipalID, folder1ExistingName);

            string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1ExistingName, UUID.Random());
            string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random());

            string itemArchivePath = string.Join("", new string[] { folder1ArchiveName, folder2ArchiveName });

            new InventoryArchiveReadRequest(scene, ua1, null, (Stream)null, false)
            .ReplicateArchivePathToUserInventory(
                itemArchivePath, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
                new Dictionary <string, InventoryFolderBase>(), new HashSet <InventoryNodeBase>());

            List <InventoryFolderBase> folder1PostCandidates
                = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, ua1.PrincipalID, folder1ExistingName);

            Assert.That(folder1PostCandidates.Count, Is.EqualTo(2));

            // FIXME: Temporarily, we're going to do something messy to make sure we pick up the created folder.
            InventoryFolderBase folder1Post = null;

            foreach (InventoryFolderBase folder in folder1PostCandidates)
            {
                if (folder.ID != folder1.ID)
                {
                    folder1Post = folder;
                    break;
                }
            }
//            Assert.That(folder1Post.ID, Is.EqualTo(folder1.ID));

            List <InventoryFolderBase> folder2PostCandidates
                = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1Post, "b");

            Assert.That(folder2PostCandidates.Count, Is.EqualTo(1));
        }
コード例 #23
0
        /// <summary>
        /// Test replication of an archive path to the user's inventory.
        /// </summary>
        //[Test]
        public void TestReplicateArchivePathToUserInventory()
        {
            TestHelper.InMethod();
            Scene scene = SceneSetupHelpers.SetupScene(false);
            CommunicationsManager commsManager = scene.CommsManager;

            CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager);

            userInfo.FetchInventory();
            for (int i = 0; i < 50; i++)
            {
                if (userInfo.HasReceivedInventory == true)
                {
                    break;
                }
                Thread.Sleep(200);
            }
            Assert.That(userInfo.HasReceivedInventory, Is.True, "FetchInventory timed out (10 seconds)");
            Dictionary <string, InventoryFolderImpl> foldersCreated = new Dictionary <string, InventoryFolderImpl>();
            List <InventoryNodeBase> nodesLoaded = new List <InventoryNodeBase>();

            string folder1Name = "a";
            string folder2Name = "b";
            string itemName    = "c.lsl";

            string folder1ArchiveName
                = string.Format(
                      "{0}{1}{2}", folder1Name, ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR, UUID.Random());
            string folder2ArchiveName
                = string.Format(
                      "{0}{1}{2}", folder2Name, ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR, UUID.Random());
            string itemArchivePath
                = string.Format(
                      "{0}{1}/{2}/{3}",
                      ArchiveConstants.INVENTORY_PATH, folder1ArchiveName, folder2ArchiveName, itemName);

            new InventoryArchiveReadRequest(userInfo, null, (Stream)null, null, null)
            .ReplicateArchivePathToUserInventory(itemArchivePath, false, userInfo.RootFolder, foldersCreated, nodesLoaded);

            InventoryFolderImpl folder1 = userInfo.RootFolder.FindFolderByPath("a");

            Assert.That(folder1, Is.Not.Null, "Could not find folder a");
            InventoryFolderImpl folder2 = folder1.FindFolderByPath("b");

            Assert.That(folder2, Is.Not.Null, "Could not find folder b");
        }
コード例 #24
0
        public void SetUp()
        {
            IConfigSource initConfigSource = new IniConfigSource();
            IConfig       config           = initConfigSource.AddConfig("XEngine");

            config.Set("Enabled", "true");

            Scene           scene = SceneSetupHelpers.SetupScene();
            SceneObjectPart part  = SceneSetupHelpers.AddSceneObject(scene);

            XEngine.XEngine engine = new XEngine.XEngine();
            engine.Initialise(initConfigSource);
            engine.AddRegion(scene);

            m_lslApi = new LSL_Api();
            m_lslApi.Initialize(engine, part, part.LocalId, part.UUID);
        }
コード例 #25
0
        public void TestDelinkPersistence()
        {
            TestHelper.InMethod();
            //log4net.Config.XmlConfigurator.Configure();

            TestScene scene = SceneSetupHelpers.SetupScene();

            string rootPartName = "rootpart";
            UUID   rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001");
            string linkPartName = "linkpart";
            UUID   linkPartUuid = new UUID("00000000-0000-0000-0001-000000000000");

            SceneObjectPart rootPart
                = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
                {
                Name = rootPartName, UUID = rootPartUuid
                };
            SceneObjectPart linkPart
                = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
                {
                Name = linkPartName, UUID = linkPartUuid
                };

            SceneObjectGroup sog = new SceneObjectGroup(rootPart);

            sog.AddPart(linkPart);
            scene.AddNewSceneObject(sog, true);

            // In a test, we have to crank the backup handle manually.  Normally this would be done by the timer invoked
            // scene backup thread.
            scene.Backup(true);

            // These changes should occur immediately without waiting for a backup pass
            SceneObjectGroup groupToDelete = sog.DelinkFromGroup(linkPart, false);

            Assert.That(groupToDelete.HasGroupChangedDueToDelink, Is.True);
            scene.DeleteSceneObject(groupToDelete, false);
            Assert.That(groupToDelete.HasGroupChangedDueToDelink, Is.False);

            List <SceneObjectGroup> storedObjects = scene.SimulationDataService.LoadObjects(scene.RegionInfo.RegionID);

            Assert.That(storedObjects.Count, Is.EqualTo(1));
            Assert.That(storedObjects[0].Parts.Length, Is.EqualTo(1));
            Assert.That(storedObjects[0].ContainsPart(rootPartUuid));
        }
コード例 #26
0
        public void TestSetMediaUrl()
        {
            TestHelper.InMethod();

            string homeUrl = "opensimulator.org";

            SceneObjectPart part = SceneSetupHelpers.AddSceneObject(m_scene);
            MediaEntry      me   = new MediaEntry()
            {
                HomeURL = homeUrl
            };

            m_module.SetMediaEntry(part, 1, me);

            Assert.That(part.Shape.Media[1].HomeURL, Is.EqualTo(homeUrl));
            Assert.That(part.MediaUrl, Is.EqualTo("x-mv:0000000000/" + UUID.Zero));
            Assert.That(part.Shape.Textures.FaceTextures[1].MediaFlags, Is.True);
        }
コード例 #27
0
        public void TestLoadIarToInventoryPaths()
        {
            TestHelper.InMethod();
//            log4net.Config.XmlConfigurator.Configure();

            SerialiserModule        serialiserModule = new SerialiserModule();
            InventoryArchiverModule archiverModule   = new InventoryArchiverModule();

            // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene
            Scene scene = SceneSetupHelpers.SetupScene();

            SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);

            UserProfileTestUtils.CreateUserWithInventory(scene, m_uaMT, "meowfood");
            UserProfileTestUtils.CreateUserWithInventory(scene, m_uaLL1, "hampshire");

            archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "/", "meowfood", m_iarStream);
            InventoryItemBase foundItem1
                = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_uaMT.PrincipalID, m_item1Name);

            Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1");

            // Now try loading to a root child folder
            UserInventoryTestUtils.CreateInventoryFolder(scene.InventoryService, m_uaMT.PrincipalID, "xA");
            MemoryStream archiveReadStream = new MemoryStream(m_iarStream.ToArray());

            archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "xA", "meowfood", archiveReadStream);

            InventoryItemBase foundItem2
                = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_uaMT.PrincipalID, "xA/" + m_item1Name);

            Assert.That(foundItem2, Is.Not.Null, "Didn't find loaded item 2");

            // Now try loading to a more deeply nested folder
            UserInventoryTestUtils.CreateInventoryFolder(scene.InventoryService, m_uaMT.PrincipalID, "xB/xC");
            archiveReadStream = new MemoryStream(archiveReadStream.ToArray());
            archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "xB/xC", "meowfood", archiveReadStream);

            InventoryItemBase foundItem3
                = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_uaMT.PrincipalID, "xB/xC/" + m_item1Name);

            Assert.That(foundItem3, Is.Not.Null, "Didn't find loaded item 3");
        }
コード例 #28
0
        public void TestMoveTaskInventoryItemNoParent()
        {
            TestHelper.InMethod();
//            log4net.Config.XmlConfigurator.Configure();

            Scene             scene    = SceneSetupHelpers.SetupScene("inventory");
            UserAccount       user1    = CreateUser(scene);
            SceneObjectGroup  sog1     = CreateSO1(scene, user1.PrincipalID);
            SceneObjectPart   sop1     = sog1.RootPart;
            TaskInventoryItem sopItem1 = CreateSOItem1(scene, sop1);

            // Perform test
            scene.MoveTaskInventoryItem(user1.PrincipalID, UUID.Zero, sop1, sopItem1.ItemID);

            InventoryItemBase ncUserItem
                = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, user1.PrincipalID, "Notecards/ncItem");

            Assert.That(ncUserItem, Is.Not.Null, "Notecards/ncItem was not found");
        }
コード例 #29
0
        public void TestTaint()
        {
            TestHelper.InMethod();
            IPrimCounts pc = m_lo.PrimCounts;

            SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, "a", 0x01);

            m_scene.AddNewSceneObject(sog, false);

            m_pcm.TaintPrimCount();

            Assert.That(pc.Owner, Is.EqualTo(3));
            Assert.That(pc.Group, Is.EqualTo(0));
            Assert.That(pc.Others, Is.EqualTo(0));
            Assert.That(pc.Total, Is.EqualTo(3));
            Assert.That(pc.Selected, Is.EqualTo(0));
            Assert.That(pc.Users[m_userId], Is.EqualTo(3));
            Assert.That(pc.Users[m_otherUserId], Is.EqualTo(0));
            Assert.That(pc.Simulator, Is.EqualTo(3));
        }
コード例 #30
0
        public void TestLoadIarPathStartsWithSlash()
        {
            TestHelper.InMethod();
//            log4net.Config.XmlConfigurator.Configure();

            SerialiserModule        serialiserModule = new SerialiserModule();
            InventoryArchiverModule archiverModule   = new InventoryArchiverModule(true);
            Scene scene = SceneSetupHelpers.SetupScene("inventory");

            SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);

            UserProfileTestUtils.CreateUserWithInventory(scene, m_ua1, "password");
            archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "/Objects", "password", m_iarStream);

            InventoryItemBase foundItem1
                = InventoryArchiveUtils.FindItemByPath(
                      scene.InventoryService, m_ua1.PrincipalID, "/Objects/" + m_item1Name);

            Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1 in TestLoadIarFolderStartsWithSlash()");
        }