Example #1
0
        public void TestReplicateArchivePathToUserInventory()
        {
            TestHelper.InMethod();
            CommunicationsManager commsManager = new TestCommunicationsManager();
            CachedUserInfo        userInfo     = UserProfileTestUtils.CreateUserWithInventory(commsManager);
            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)
            .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");
        }
Example #2
0
        public void Init()
        {
            cm     = new TestCommunicationsManager();
            scene  = SceneSetupHelpers.SetupScene("Neighbour x", UUID.Random(), 1000, 1000, cm);
            scene2 = SceneSetupHelpers.SetupScene("Neighbour x+1", UUID.Random(), 1001, 1000, cm);
            scene3 = SceneSetupHelpers.SetupScene("Neighbour x-1", UUID.Random(), 999, 1000, cm);

            IRegionModule interregionComms = new RESTInterregionComms();

            interregionComms.Initialise(scene, new IniConfigSource());
            interregionComms.Initialise(scene2, new IniConfigSource());
            interregionComms.Initialise(scene3, 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;
        }
Example #3
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
        }
Example #4
0
        /// <summary>
        /// Set up a test scene
        /// </summary>
        /// <param name="name">Name of the region</param>
        /// <param name="id">ID of the region</param>
        /// <param name="x">X co-ordinate of the region</param>
        /// <param name="y">Y co-ordinate of the region</param>
        /// <param name="cm">This should be the same if simulating two scenes within a standalone</param>
        /// <param name="startServices">Start associated threads for the services used by the scene</param>
        /// <returns></returns>
        public static TestScene SetupScene(
            string name, UUID id, uint x, uint y, TestCommunicationsManager cm, bool startServices)
        {
            Console.WriteLine("Setting up test scene {0}", name);

            RegionInfo regInfo = new RegionInfo(x, y, new IPEndPoint(IPAddress.Loopback, 9000), "127.0.0.1");

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

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

            StorageManager sm           = new StorageManager("OpenSim.Data.Null.dll", "", "");
            IConfigSource  configSource = new IniConfigSource();

            TestScene testScene = new TestScene(
                regInfo, acm, cm, scs, sm, null, false, false, false, configSource, null);

            IRegionModule capsModule = new CapabilitiesModule();

            capsModule.Initialise(testScene, new IniConfigSource());
            testScene.AddModule(capsModule.Name, capsModule);

            IRegionModule godsModule = new GodsModule();

            godsModule.Initialise(testScene, new IniConfigSource());
            testScene.AddModule(godsModule.Name, godsModule);

            testScene.SetModuleInterfaces();

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

            PhysicsPluginManager physicsPluginManager = new PhysicsPluginManager();

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

            if (startServices)
            {
                cm.StartServices();
            }

            return(testScene);
        }
Example #5
0
 public void Init()
 {
     TestCommunicationsManager cm = new TestCommunicationsManager();
     scene = SceneSetupHelpers.SetupScene("My Test", UUID.Random(), 1000, 1000, cm);
     random = new Random();
 }
Example #6
0
 /// <summary>
 /// Set up a test scene
 /// </summary>
 /// <param name="name">Name of the region</param>
 /// <param name="id">ID of the region</param>
 /// <param name="x">X co-ordinate of the region</param>
 /// <param name="y">Y co-ordinate of the region</param>
 /// <param name="cm">This should be the same if simulating two scenes within a standalone</param>
 /// <returns></returns>
 public static TestScene SetupScene(string name, UUID id, uint x, uint y, TestCommunicationsManager cm)
 {
     return(SetupScene(name, id, x, y, cm, true));
 }