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
        /// <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");
        }