Esempio n. 1
0
        public NpcAgent CreateNpc(UUID sceneid, UGUI owner, UGI group, string firstName, string lastName, Vector3 position, Notecard nc, NpcOptions options = NpcOptions.None)
        {
            SceneInterface   scene;
            AgentServiceList agentServiceList = m_NonpersistentAgentServices;

            if ((options & NpcOptions.Persistent) != NpcOptions.None)
            {
                if (m_NpcPresenceService == null)
                {
                    throw new InvalidOperationException("Persistence of NPCs not configured");
                }
                agentServiceList = m_PersistentAgentServices;
            }

            NpcPresenceServiceInterface presenceService  = agentServiceList.Get <NpcPresenceServiceInterface>();
            InventoryServiceInterface   inventoryService = agentServiceList.Get <InventoryServiceInterface>();

            var npcId = new UGUIWithName
            {
                ID        = UUID.Random,
                FirstName = firstName,
                LastName  = lastName
            };

            if (m_KnownScenes.TryGetValue(sceneid, out scene))
            {
                var agent = new NpcAgent(npcId, agentServiceList, sceneid)
                {
                    NpcOwner = owner,
                    Group    = group
                };
                try
                {
                    m_NpcAgents.Add(agent.ID, agent);
                    var npcInfo = new NpcPresenceInfo
                    {
                        RegionID = sceneid,
                        Npc      = agent.NamedOwner,
                        Owner    = agent.NpcOwner,
                        Group    = agent.Group,
                    };
                    inventoryService.CheckInventory(npcInfo.Npc.ID);
                    presenceService.Store(npcInfo);
                    agent.CurrentScene = scene;
                    agent.Position     = position;
                    scene.Add(agent);
                }
                catch
                {
                    if (m_NpcPresenceService != null)
                    {
                        presenceService.Remove(agent.ID);
                    }
                    inventoryService.Remove(agent.ID);
                    m_NpcAgents.Remove(agent.ID);
                    throw;
                }
                agent.EnableListen();

                scene.SendAgentObjectToAllAgents(agent);
                agent.SendAnimations();

                ThreadPool.QueueUserWorkItem(LoadAppearanceFromNotecardJob, new RebakeJob {
                    Notecard = nc, Agent = agent
                });
                return(agent);
            }

            throw new KeyNotFoundException("Scene not found");
        }
Esempio n. 2
0
        public bool Run()
        {
            m_Log.Info("Create User Inventory");
            try
            {
                m_BackendInventoryService.CheckInventory(m_UserID.ID);
            }
            catch
            {
                return(false);
            }

            InventoryItem item;

            InventoryFolder rootFolder     = m_InventoryService.Folder[m_UserID.ID, AssetType.RootFolder];
            InventoryFolder notecardFolder = m_InventoryService.Folder[m_UserID.ID, AssetType.Notecard];
            UUID            inventoryId    = UUID.Random;

            var testItem = new InventoryItem(inventoryId)
            {
                Name           = "Test Name",
                Description    = "Test Description",
                AssetID        = UUID.Random,
                AssetType      = AssetType.Notecard,
                Creator        = m_UserID,
                Flags          = InventoryFlags.ObjectPermOverwriteNextOwner,
                LastOwner      = m_UserID,
                ParentFolderID = rootFolder.ID,
                SaleInfo       = new InventoryItem.SaleInfoData
                {
                    Price = 10,
                    Type  = InventoryItem.SaleInfoData.SaleType.Copy
                },
                IsGroupOwned  = false,
                Group         = new UGI(UUID.Random),
                InventoryType = InventoryType.Notecard,
                Owner         = m_UserID,
                CreationDate  = Date.Now
            };

            testItem.Permissions.Base      = InventoryPermissionsMask.Every;
            testItem.Permissions.Current   = InventoryPermissionsMask.All;
            testItem.Permissions.NextOwner = InventoryPermissionsMask.Copy;
            testItem.Permissions.Group     = InventoryPermissionsMask.Damage;
            testItem.Permissions.EveryOne  = InventoryPermissionsMask.Move;
            m_BackendInventoryService.Item.Add(testItem);

            m_Log.Info("Move item to notecard folder");
            m_InventoryService.Item.Move(m_UserID.ID, testItem.ID, notecardFolder.ID);

            m_Log.Info("Check for folder change");
            item = m_InventoryService.Item[m_UserID.ID, testItem.ID];
            if (item.ParentFolderID != notecardFolder.ID)
            {
                return(false);
            }

            m_Log.Info("Move item to root folder");
            m_InventoryService.Item.Move(m_UserID.ID, testItem.ID, rootFolder.ID);

            m_Log.Info("Check for folder change");
            item = m_InventoryService.Item[m_UserID.ID, testItem.ID];
            if (item.ParentFolderID != rootFolder.ID)
            {
                return(false);
            }

            m_Log.Info("Move item to unknown folder");
            UUID unknownFolderID;

            do
            {
                unknownFolderID = UUID.Random;
            } while (m_BackendInventoryService.Folder.ContainsKey(m_UserID.ID, unknownFolderID));
            try
            {
                m_InventoryService.Item.Move(m_UserID.ID, testItem.ID, unknownFolderID);
                return(false);
            }
            catch (InvalidParentFolderIdException)
            {
                /* this is the expected case */
            }

            m_Log.Info("Check for folder not being changed");
            item = m_InventoryService.Item[m_UserID.ID, testItem.ID];
            if (item.ParentFolderID != rootFolder.ID)
            {
                return(false);
            }

            m_Log.Info("Deleting item");
            m_InventoryService.Item.Delete(m_UserID.ID, testItem.ID);

            return(true);
        }
        public bool Run()
        {
            m_Log.Info("Create User Inventory");
            try
            {
                m_BackendInventoryService.CheckInventory(m_UserID.ID);
            }
            catch
            {
                return(false);
            }

            InventoryFolder folder;

            InventoryFolder rootFolder     = m_InventoryService.Folder[m_UserID.ID, AssetType.RootFolder];
            InventoryFolder notecardFolder = m_InventoryService.Folder[m_UserID.ID, AssetType.Notecard];
            UUID            inventoryId    = UUID.Random;

            var testFolder = new InventoryFolder(inventoryId)
            {
                Name           = "Test Name",
                ParentFolderID = rootFolder.ID,
                DefaultType    = AssetType.Unknown,
                Owner          = m_UserID,
                Version        = 1
            };

            m_InventoryService.Folder.Add(testFolder);

            m_Log.Info("Move folder to notecard folder");
            m_InventoryService.Folder.Move(m_UserID.ID, testFolder.ID, notecardFolder.ID);

            m_Log.Info("Check for parentfolder change");
            folder = m_InventoryService.Folder[m_UserID.ID, testFolder.ID];
            if (folder.ParentFolderID != notecardFolder.ID)
            {
                return(false);
            }

            m_Log.Info("Move folder to root folder");
            m_InventoryService.Folder.Move(m_UserID.ID, testFolder.ID, rootFolder.ID);

            m_Log.Info("Check for parentfolder change");
            folder = m_InventoryService.Folder[m_UserID.ID, testFolder.ID];
            if (folder.ParentFolderID != rootFolder.ID)
            {
                return(false);
            }

            m_Log.Info("Move folder to unknown parentfolder");
            UUID unknownFolderID;

            do
            {
                unknownFolderID = UUID.Random;
            } while (m_BackendInventoryService.Folder.ContainsKey(m_UserID.ID, unknownFolderID));
            try
            {
                m_InventoryService.Folder.Move(m_UserID.ID, testFolder.ID, unknownFolderID);
                return(false);
            }
            catch (InvalidParentFolderIdException)
            {
                /* this is the expected case */
            }

            m_Log.Info("Check for parentfolder not being changed");
            folder = m_InventoryService.Folder[m_UserID.ID, testFolder.ID];
            if (folder.ParentFolderID != rootFolder.ID)
            {
                return(false);
            }

            m_Log.Info("Deleting folder");
            m_InventoryService.Folder.Delete(m_UserID.ID, testFolder.ID);

            return(true);
        }
Esempio n. 4
0
        public bool Run()
        {
            List <InventoryFolder>        result;
            List <InventoryFolderContent> resultContent;

            m_Log.Info("Create User Inventory");
            try
            {
                m_BackendInventoryService.CheckInventory(m_UserID.ID);
            }
            catch
            {
                return(false);
            }

            InventoryFolder        folder;
            InventoryFolderContent content;

            InventoryFolder rootFolder  = m_InventoryService.Folder[m_UserID.ID, AssetType.RootFolder];
            UUID            inventoryId = UUID.Random;

            m_Log.Info("Testing non-existence 1");
            try
            {
                if (m_InventoryService.Folder.ContainsKey(inventoryId))
                {
                    return(false);
                }
                if (!m_InventoryService.SupportsLegacyFunctions)
                {
                    m_Log.Error("Service does not specify legacy functions supported");
                    return(false);
                }
            }
            catch (NotSupportedException)
            {
                if (m_InventoryService.SupportsLegacyFunctions)
                {
                    m_Log.Error("Service specifies legacy functions supported. Missing function.");
                    return(false);
                }
            }

            m_Log.Info("Testing non-existence 2");
            if (m_InventoryService.Folder.ContainsKey(m_UserID.ID, inventoryId))
            {
                return(false);
            }

            m_Log.Info("Testing non-existence 3");
            try
            {
                if (m_InventoryService.Folder.TryGetValue(inventoryId, out folder))
                {
                    return(false);
                }
                if (!m_InventoryService.SupportsLegacyFunctions)
                {
                    m_Log.Error("Service does not specify legacy functions supported");
                    return(false);
                }
            }
            catch (NotSupportedException)
            {
                if (m_InventoryService.SupportsLegacyFunctions)
                {
                    m_Log.Error("Service specifies legacy functions supported. Missing function.");
                    return(false);
                }
            }

            m_Log.Info("Testing non-existence 4");
            if (m_InventoryService.Folder.TryGetValue(m_UserID.ID, inventoryId, out folder))
            {
                return(false);
            }
            m_Log.Info("Testing non-existence 5");
            try
            {
                folder = m_InventoryService.Folder[inventoryId];
                return(false);
            }
            catch (NotSupportedException)
            {
                if (m_InventoryService.SupportsLegacyFunctions)
                {
                    m_Log.Error("Service specifies legacy functions supported. Missing function.");
                    return(false);
                }
            }
            catch (InventoryFolderNotFoundException)
            {
                /* this is the okay case */
                if (!m_InventoryService.SupportsLegacyFunctions)
                {
                    m_Log.Error("Service does not specify legacy functions supported");
                    return(false);
                }
            }
            m_Log.Info("Testing non-existence 6");
            try
            {
                folder = m_InventoryService.Folder[m_UserID.ID, inventoryId];
                return(false);
            }
            catch (InventoryFolderNotFoundException)
            {
                /* this is the okay case */
            }
            m_Log.Info("Testing non-existence 7");
            result = m_InventoryService.Folder.GetFolders(m_UserID.ID, rootFolder.ID);
            foreach (InventoryFolder checkItem in result)
            {
                if (checkItem.ID == inventoryId)
                {
                    return(false);
                }
            }
            m_Log.Info("Testing non-existence 8");
            result = m_InventoryService.Folder.Content[m_UserID.ID, rootFolder.ID].Folders;
            foreach (InventoryFolder checkItem in result)
            {
                if (checkItem.ID == inventoryId)
                {
                    return(false);
                }
            }
            m_Log.Info("Testing non-existence 9");
            if (m_InventoryService.Folder.Content.ContainsKey(m_UserID.ID, inventoryId))
            {
                return(false);
            }
            m_Log.Info("Testing non-existence 10");
            if (m_InventoryService.Folder.Content.TryGetValue(m_UserID.ID, inventoryId, out content))
            {
                return(false);
            }
            m_Log.Info("Testing non-existence 11");
            try
            {
                content = m_InventoryService.Folder.Content[m_UserID.ID, inventoryId];
                return(false);
            }
            catch (InventoryFolderNotFoundException)
            {
                /* this is the expected one */
            }
            m_Log.Info("Testing non-existence 12");
            resultContent = m_InventoryService.Folder.Content[m_UserID.ID, new UUID[] { inventoryId }];
            foreach (InventoryFolderContent checkItem in resultContent)
            {
                if (checkItem.FolderID == inventoryId)
                {
                    return(false);
                }
            }

            var testFolder = new InventoryFolder(inventoryId)
            {
                Name           = "Test Name",
                Version        = 5,
                ParentFolderID = rootFolder.ID,
                DefaultType    = AssetType.Notecard,
                Owner          = m_UserID,
            };

            m_InventoryService.Folder.Add(testFolder);
            inventoryId = testFolder.ID;

            m_Log.Info("Testing existence 1");
            try
            {
                if (!m_InventoryService.Folder.ContainsKey(inventoryId))
                {
                    return(false);
                }
                if (!m_InventoryService.SupportsLegacyFunctions)
                {
                    m_Log.Error("Service does not specify legacy functions supported");
                    return(false);
                }
            }
            catch (NotSupportedException)
            {
                if (m_InventoryService.SupportsLegacyFunctions)
                {
                    m_Log.Error("Service specifies legacy functions supported. Missing function.");
                    return(false);
                }
            }
            m_Log.Info("Testing existence 2");
            if (!m_InventoryService.Folder.ContainsKey(m_UserID.ID, inventoryId))
            {
                return(false);
            }
            m_Log.Info("Testing existence 3");
            try
            {
                if (!m_InventoryService.Folder.TryGetValue(inventoryId, out folder))
                {
                    return(false);
                }
                if (!m_InventoryService.SupportsLegacyFunctions)
                {
                    m_Log.Error("Service does not specify legacy functions supported");
                    return(false);
                }
                if (!IsDataEqual(folder, testFolder))
                {
                    return(false);
                }
            }
            catch (NotSupportedException)
            {
                if (m_InventoryService.SupportsLegacyFunctions)
                {
                    m_Log.Error("Service specifies legacy functions supported. Missing function.");
                    return(false);
                }
            }

            m_Log.Info("Testing existence 4");
            if (!m_InventoryService.Folder.TryGetValue(m_UserID.ID, inventoryId, out folder))
            {
                return(false);
            }
            if (!IsDataEqual(folder, testFolder))
            {
                return(false);
            }
            m_Log.Info("Testing existence 5");
            try
            {
                folder = m_InventoryService.Folder[inventoryId];
                if (!m_InventoryService.SupportsLegacyFunctions)
                {
                    m_Log.Error("Service does not specify legacy functions supported");
                    return(false);
                }
                if (!IsDataEqual(folder, testFolder))
                {
                    return(false);
                }
            }
            catch (NotSupportedException)
            {
                if (m_InventoryService.SupportsLegacyFunctions)
                {
                    m_Log.Error("Service specifies legacy functions supported. Missing function.");
                    return(false);
                }
            }
            m_Log.Info("Testing existence 6");
            folder = m_InventoryService.Folder[m_UserID.ID, inventoryId];
            if (!IsDataEqual(folder, testFolder))
            {
                return(false);
            }
            folder = null;
            m_Log.Info("Testing existence 7");
            result = m_InventoryService.Folder.GetFolders(m_UserID.ID, rootFolder.ID);
            foreach (InventoryFolder checkItem in result)
            {
                if (checkItem.ID == inventoryId)
                {
                    folder = checkItem;
                }
            }
            if (folder == null)
            {
                return(false);
            }
            if (!IsDataEqual(folder, testFolder))
            {
                return(false);
            }
            m_Log.Info("Testing existence 8");
            result = m_InventoryService.Folder.Content[m_UserID.ID, rootFolder.ID].Folders;
            folder = null;
            foreach (InventoryFolder checkItem in result)
            {
                if (checkItem.ID == inventoryId)
                {
                    folder = checkItem;
                }
            }
            if (folder == null)
            {
                return(false);
            }
            if (!IsDataEqual(folder, testFolder))
            {
                return(false);
            }
            m_Log.Info("Testing existence 9");
            if (!m_InventoryService.Folder.Content.ContainsKey(m_UserID.ID, inventoryId))
            {
                return(false);
            }
            m_Log.Info("Testing existence 10");
            if (!m_InventoryService.Folder.Content.TryGetValue(m_UserID.ID, inventoryId, out content))
            {
                return(false);
            }
            m_Log.Info("Testing existence 11");
            content = m_InventoryService.Folder.Content[m_UserID.ID, inventoryId];
            m_Log.Info("Testing existence 12");
            resultContent = m_InventoryService.Folder.Content[m_UserID.ID, new UUID[] { inventoryId }];
            bool isFound = false;

            foreach (InventoryFolderContent checkItem in resultContent)
            {
                if (checkItem.FolderID == inventoryId)
                {
                    isFound = true;
                }
            }
            if (!isFound)
            {
                return(false);
            }

            m_Log.Info("Updating folder");
            testFolder.Name = "Test Name 2";

            m_InventoryService.Folder.Update(testFolder);

            m_Log.Info("Testing changes");
            folder = m_InventoryService.Folder[m_UserID.ID, inventoryId];
            if (!IsDataEqual(folder, testFolder))
            {
                return(false);
            }

            m_Log.Info("Deleting folder");
            m_InventoryService.Folder.Delete(m_UserID.ID, inventoryId);

            m_Log.Info("Testing non-existence 1");
            try
            {
                if (m_InventoryService.Folder.ContainsKey(inventoryId))
                {
                    return(false);
                }
                if (!m_InventoryService.SupportsLegacyFunctions)
                {
                    m_Log.Error("Service does not specify legacy functions supported");
                    return(false);
                }
            }
            catch (NotSupportedException)
            {
                if (m_InventoryService.SupportsLegacyFunctions)
                {
                    m_Log.Error("Service specifies legacy functions supported. Missing function.");
                    return(false);
                }
            }

            m_Log.Info("Testing non-existence 2");
            if (m_InventoryService.Folder.ContainsKey(m_UserID.ID, inventoryId))
            {
                return(false);
            }

            m_Log.Info("Testing non-existence 3");
            try
            {
                if (m_InventoryService.Folder.TryGetValue(inventoryId, out folder))
                {
                    return(false);
                }
                if (!m_InventoryService.SupportsLegacyFunctions)
                {
                    m_Log.Error("Service does not specify legacy functions supported");
                    return(false);
                }
            }
            catch (NotSupportedException)
            {
                if (m_InventoryService.SupportsLegacyFunctions)
                {
                    m_Log.Error("Service specifies legacy functions supported. Missing function.");
                    return(false);
                }
            }

            m_Log.Info("Testing non-existence 4");
            if (m_InventoryService.Folder.TryGetValue(m_UserID.ID, inventoryId, out folder))
            {
                return(false);
            }
            m_Log.Info("Testing non-existence 5");
            try
            {
                folder = m_InventoryService.Folder[inventoryId];
                if (!m_InventoryService.SupportsLegacyFunctions)
                {
                    m_Log.Error("Service does not specify legacy functions supported");
                    return(false);
                }
                return(false);
            }
            catch (NotSupportedException)
            {
                if (m_InventoryService.SupportsLegacyFunctions)
                {
                    m_Log.Error("Service specifies legacy functions supported. Missing function.");
                    return(false);
                }
            }
            catch (InventoryFolderNotFoundException)
            {
                /* this is the okay case */
                if (!m_InventoryService.SupportsLegacyFunctions)
                {
                    m_Log.Error("Service does not specify legacy functions supported");
                    return(false);
                }
            }
            m_Log.Info("Testing non-existence 6");
            try
            {
                folder = m_InventoryService.Folder[m_UserID.ID, inventoryId];
                return(false);
            }
            catch (InventoryFolderNotFoundException)
            {
                /* this is the okay case */
            }

            m_Log.Info("Testing non-existence 7");
            result = m_InventoryService.Folder.GetFolders(m_UserID.ID, rootFolder.ID);
            foreach (InventoryFolder checkItem in result)
            {
                if (checkItem.ID == inventoryId)
                {
                    return(false);
                }
            }
            m_Log.Info("Testing non-existence 8");
            result = m_InventoryService.Folder.Content[m_UserID.ID, rootFolder.ID].Folders;
            foreach (InventoryFolder checkItem in result)
            {
                if (checkItem.ID == inventoryId)
                {
                    return(false);
                }
            }
            m_Log.Info("Testing non-existence 9");
            if (m_InventoryService.Folder.Content.ContainsKey(m_UserID.ID, inventoryId))
            {
                return(false);
            }
            m_Log.Info("Testing non-existence 10");
            if (m_InventoryService.Folder.Content.TryGetValue(m_UserID.ID, inventoryId, out content))
            {
                return(false);
            }
            m_Log.Info("Testing non-existence 11");
            try
            {
                content = m_InventoryService.Folder.Content[m_UserID.ID, inventoryId];
                return(false);
            }
            catch (InventoryFolderNotFoundException)
            {
                /* this is the expected one */
            }
            m_Log.Info("Testing non-existence 12");
            resultContent = m_InventoryService.Folder.Content[m_UserID.ID, new UUID[] { inventoryId }];
            foreach (InventoryFolderContent checkItem in resultContent)
            {
                if (checkItem.FolderID == inventoryId)
                {
                    return(false);
                }
            }

            m_Log.Info("Creating the folder");
            m_InventoryService.Folder.Add(testFolder);
            inventoryId = testFolder.ID;

            m_Log.Info("Deleting folder");
            List <UUID> deleted = m_InventoryService.Folder.Delete(m_UserID.ID, new List <UUID> {
                inventoryId
            });

            if (!deleted.Contains(inventoryId))
            {
                return(false);
            }

            m_Log.Info("Testing non-existence 1");
            try
            {
                if (m_InventoryService.Folder.ContainsKey(inventoryId))
                {
                    return(false);
                }
                if (!m_InventoryService.SupportsLegacyFunctions)
                {
                    m_Log.Error("Service does not specify legacy functions supported");
                    return(false);
                }
            }
            catch (NotSupportedException)
            {
                if (m_InventoryService.SupportsLegacyFunctions)
                {
                    m_Log.Error("Service specifies legacy functions supported. Missing function.");
                    return(false);
                }
            }

            m_Log.Info("Testing non-existence 2");
            if (m_InventoryService.Folder.ContainsKey(m_UserID.ID, inventoryId))
            {
                return(false);
            }

            m_Log.Info("Testing non-existence 3");
            try
            {
                if (m_InventoryService.Folder.TryGetValue(inventoryId, out folder))
                {
                    return(false);
                }
                if (!m_InventoryService.SupportsLegacyFunctions)
                {
                    m_Log.Error("Service does not specify legacy functions supported");
                    return(false);
                }
            }
            catch (NotSupportedException)
            {
                if (m_InventoryService.SupportsLegacyFunctions)
                {
                    m_Log.Error("Service specifies legacy functions supported. Missing function.");
                    return(false);
                }
            }

            m_Log.Info("Testing non-existence 4");
            if (m_InventoryService.Folder.TryGetValue(m_UserID.ID, inventoryId, out folder))
            {
                return(false);
            }
            m_Log.Info("Testing non-existence 5");
            try
            {
                folder = m_InventoryService.Folder[inventoryId];
                return(false);
            }
            catch (NotSupportedException)
            {
                if (m_InventoryService.SupportsLegacyFunctions)
                {
                    m_Log.Error("Service specifies legacy functions supported. Missing function.");
                    return(false);
                }
            }
            catch (InventoryFolderNotFoundException)
            {
                /* this is the okay case */
                if (!m_InventoryService.SupportsLegacyFunctions)
                {
                    m_Log.Error("Service does not specify legacy functions supported");
                    return(false);
                }
            }
            m_Log.Info("Testing non-existence 6");
            try
            {
                folder = m_InventoryService.Folder[m_UserID.ID, inventoryId];
                return(false);
            }
            catch (InventoryFolderNotFoundException)
            {
                /* this is the okay case */
            }
            m_Log.Info("Testing non-existence 7");
            result = m_InventoryService.Folder.GetFolders(m_UserID.ID, rootFolder.ID);
            foreach (InventoryFolder checkItem in result)
            {
                if (checkItem.ID == inventoryId)
                {
                    return(false);
                }
            }
            m_Log.Info("Testing non-existence 8");
            result = m_InventoryService.Folder.Content[m_UserID.ID, rootFolder.ID].Folders;
            foreach (InventoryFolder checkItem in result)
            {
                if (checkItem.ID == inventoryId)
                {
                    return(false);
                }
            }
            m_Log.Info("Testing non-existence 9");
            if (m_InventoryService.Folder.Content.ContainsKey(m_UserID.ID, inventoryId))
            {
                return(false);
            }
            m_Log.Info("Testing non-existence 10");
            if (m_InventoryService.Folder.Content.TryGetValue(m_UserID.ID, inventoryId, out content))
            {
                return(false);
            }
            m_Log.Info("Testing non-existence 11");
            try
            {
                content = m_InventoryService.Folder.Content[m_UserID.ID, inventoryId];
                return(false);
            }
            catch (InventoryFolderNotFoundException)
            {
                /* this is the expected one */
            }
            m_Log.Info("Testing non-existence 12");
            resultContent = m_InventoryService.Folder.Content[m_UserID.ID, new UUID[] { inventoryId }];
            foreach (InventoryFolderContent checkItem in resultContent)
            {
                if (checkItem.FolderID == inventoryId)
                {
                    return(false);
                }
            }

            return(true);
        }
        public bool Run()
        {
            var foldersToTest = new AssetType[]
            {
                AssetType.RootFolder,
                AssetType.Animation,
                AssetType.Bodypart,
                AssetType.CallingCard,
                AssetType.Clothing,
                AssetType.Gesture,
                AssetType.Landmark,
                AssetType.LostAndFoundFolder,
                AssetType.Notecard,
                AssetType.Object,
                AssetType.SnapshotFolder,
                AssetType.LSLText,
                AssetType.Sound,
                AssetType.Texture,
                AssetType.TrashFolder,
                AssetType.CurrentOutfitFolder,
                AssetType.MyOutfitsFolder,
                AssetType.FavoriteFolder
            };

            m_Log.Info("Testing non-existence of folders");
            InventoryFolder folder;

            foreach (AssetType type in foldersToTest)
            {
                try
                {
                    m_Log.InfoFormat("{0}...", type.ToString());
                    folder = m_InventoryService.Folder[m_UserID, type];
                    return(false);
                }
                catch
                {
                }
            }

            m_Log.Info("Create User Inventory");
            try
            {
                m_BackendInventoryService.CheckInventory(m_UserID);
            }
            catch
            {
                return(false);
            }

            m_Log.Info("Testing existence of created folders");
            foreach (AssetType type in foldersToTest)
            {
                try
                {
                    m_Log.InfoFormat("{0}...", type.ToString());
                    folder = m_InventoryService.Folder[m_UserID, type];
                }
                catch
                {
                    return(false);
                }
            }

            m_Log.Info("Testing IncrementVersion of RootFolder when supported");
            folder = m_InventoryService.Folder[m_UserID, AssetType.RootFolder];
            int oldVersion = folder.Version;

            if (oldVersion == 1)
            {
                m_Log.Info("Expected a non-zero version due to checkInventory");
                return(false);
            }
            m_InventoryService.Folder.IncrementVersion(m_UserID, folder.ID);

            m_Log.Info("Testing IncrementVersion result of RootFolder");
            folder = m_InventoryService.Folder[m_UserID, AssetType.RootFolder];
            if (oldVersion == folder.Version)
            {
                m_Log.InfoFormat("IncrementVersion not supported");
            }
            else if (oldVersion + 1 != folder.Version)
            {
                m_Log.InfoFormat("Expected an incremented version due to IncrementVersion (old {0} new {1})", oldVersion, folder.Version);
                return(false);
            }

            var folders = new UUID[]
            {
                UUID.Random,
                UUID.Random,
                UUID.Random,
                UUID.Random,
            };

            UUID rootFolderID   = folder.ID;
            var  finalfolderids = new List <UUID>();

            m_Log.Info("Creating 4 folders");
            int folderNameCnt = 1;

            foreach (UUID folderid in folders)
            {
                folder                = new InventoryFolder();
                folder.ID             = folderid;
                folder.Version        = 1;
                folder.DefaultType    = AssetType.Unknown;
                folder.Owner.ID       = m_UserID;
                folder.Name           = "A " + (folderNameCnt++).ToString();
                folder.ParentFolderID = rootFolderID;
                try
                {
                    m_InventoryService.Folder.Add(folder);
                    finalfolderids.Add(folder.ID);
                }
                catch (Exception e)
                {
                    m_Log.Warn("Failed to create folder", e);
                    return(false);
                }
            }
            folders = finalfolderids.ToArray();

            m_Log.Info("Testing existence of new folders");
            folderNameCnt = 1;
            foreach (UUID folderid in folders)
            {
                try
                {
                    folder = m_InventoryService.Folder[m_UserID, folderid];
                }
                catch (Exception e)
                {
                    m_Log.Warn("Failed to find folder", e);
                    return(false);
                }
                if (folder.ParentFolderID != rootFolderID)
                {
                    m_Log.WarnFormat("Parent folder does not match of folder {0}", folderid);
                    return(false);
                }
                if (folder.Name != "A " + (folderNameCnt++).ToString())
                {
                    m_Log.WarnFormat("Name does not match of folder {0}", folderid);
                    return(false);
                }
                if (folder.Owner.ID != m_UserID)
                {
                    m_Log.WarnFormat("OwnerID does not match of folder {0}", folderid);
                    return(false);
                }
                if (folder.DefaultType != AssetType.Unknown)
                {
                    m_Log.WarnFormat("DefaultType does not match of folder {0}", folderid);
                    return(false);
                }
                if (folder.Version != 1)
                {
                    m_Log.WarnFormat("Version does not match of folder {0}", folderid);
                    return(false);
                }
            }

            return(true);
        }
Esempio n. 6
0
        public bool Run()
        {
            List <InventoryItem> result;

            m_Log.Info("Create User Inventory");
            try
            {
                m_BackendInventoryService.CheckInventory(m_UserID.ID);
            }
            catch
            {
                return(false);
            }

            InventoryItem item;

            InventoryFolder rootFolder  = m_InventoryService.Folder[m_UserID.ID, AssetType.RootFolder];
            UUID            inventoryId = UUID.Random;

            m_Log.Info("Testing non-existence 1");
            try
            {
                if (m_InventoryService.Item.ContainsKey(inventoryId))
                {
                    return(false);
                }
                if (!m_InventoryService.SupportsLegacyFunctions)
                {
                    m_Log.Error("Service does not specify legacy functions supported");
                    return(false);
                }
            }
            catch (NotSupportedException)
            {
                if (m_InventoryService.SupportsLegacyFunctions)
                {
                    m_Log.Error("Service specifies legacy functions supported. Missing function.");
                    return(false);
                }
            }

            m_Log.Info("Testing non-existence 2");
            if (m_InventoryService.Item.ContainsKey(m_UserID.ID, inventoryId))
            {
                return(false);
            }

            m_Log.Info("Testing non-existence 3");
            try
            {
                if (m_InventoryService.Item.TryGetValue(inventoryId, out item))
                {
                    return(false);
                }
                if (!m_InventoryService.SupportsLegacyFunctions)
                {
                    m_Log.Error("Service does not specify legacy functions supported");
                    return(false);
                }
            }
            catch (NotSupportedException)
            {
                if (m_InventoryService.SupportsLegacyFunctions)
                {
                    m_Log.Error("Service specifies legacy functions supported. Missing function.");
                    return(false);
                }
            }

            m_Log.Info("Testing non-existence 4");
            if (m_InventoryService.Item.TryGetValue(m_UserID.ID, inventoryId, out item))
            {
                return(false);
            }
            m_Log.Info("Testing non-existence 5");
            try
            {
                item = m_InventoryService.Item[inventoryId];
                if (!m_InventoryService.SupportsLegacyFunctions)
                {
                    m_Log.Error("Service does not specify legacy functions supported");
                    return(false);
                }
                return(false);
            }
            catch (NotSupportedException)
            {
                if (m_InventoryService.SupportsLegacyFunctions)
                {
                    m_Log.Error("Service specifies legacy functions supported. Missing function.");
                    return(false);
                }
            }
            catch (InventoryItemNotFoundException)
            {
                /* this is the okay case */
                if (!m_InventoryService.SupportsLegacyFunctions)
                {
                    m_Log.Error("Service does not specify legacy functions supported");
                    return(false);
                }
            }
            m_Log.Info("Testing non-existence 6");
            try
            {
                item = m_InventoryService.Item[m_UserID.ID, inventoryId];
                return(false);
            }
            catch (InventoryItemNotFoundException)
            {
                /* this is the okay case */
            }
            m_Log.Info("Testing non-existence 7");
            result = m_InventoryService.Item[m_UserID.ID, new List <UUID> {
                                                 inventoryId
                                             }];
            if (result.Count != 0)
            {
                return(false);
            }
            m_Log.Info("Testing non-existence 8");
            result = m_InventoryService.Folder.GetItems(m_UserID.ID, rootFolder.ID);
            foreach (InventoryItem checkItem in result)
            {
                if (checkItem.ID == inventoryId)
                {
                    return(false);
                }
            }
            m_Log.Info("Testing non-existence 9");
            result = m_InventoryService.Folder.Content[m_UserID.ID, rootFolder.ID].Items;
            foreach (InventoryItem checkItem in result)
            {
                if (checkItem.ID == inventoryId)
                {
                    return(false);
                }
            }

            var testItem = new InventoryItem(inventoryId)
            {
                Name           = "Test Name",
                Description    = "Test Description",
                AssetID        = UUID.Random,
                AssetType      = AssetType.Notecard,
                Creator        = m_UserID,
                Flags          = InventoryFlags.ObjectPermOverwriteNextOwner,
                LastOwner      = m_UserID,
                ParentFolderID = rootFolder.ID,
                SaleInfo       = new InventoryItem.SaleInfoData
                {
                    Price = 10,
                    Type  = InventoryItem.SaleInfoData.SaleType.Copy
                },
                IsGroupOwned  = false,
                Group         = new UGI(UUID.Random),
                InventoryType = InventoryType.Notecard,
                Owner         = m_UserID,
                CreationDate  = Date.Now
            };

            testItem.Permissions.Base      = InventoryPermissionsMask.Every;
            testItem.Permissions.Current   = InventoryPermissionsMask.Copy | InventoryPermissionsMask.Transfer;
            testItem.Permissions.NextOwner = InventoryPermissionsMask.Copy | InventoryPermissionsMask.Move;
            testItem.Permissions.Group     = InventoryPermissionsMask.Damage;
            testItem.Permissions.EveryOne  = InventoryPermissionsMask.Move;
            m_InventoryService.Item.Add(testItem);
            inventoryId = testItem.ID;

            m_Log.Info("Testing existence 1");
            try
            {
                if (!m_InventoryService.Item.ContainsKey(inventoryId))
                {
                    return(false);
                }
                if (!m_InventoryService.SupportsLegacyFunctions)
                {
                    m_Log.Error("Service does not specify legacy functions supported");
                    return(false);
                }
            }
            catch (NotSupportedException)
            {
                if (m_InventoryService.SupportsLegacyFunctions)
                {
                    m_Log.Error("Service specifies legacy functions supported. Missing function.");
                    return(false);
                }
            }
            m_Log.Info("Testing existence 2");
            if (!m_InventoryService.Item.ContainsKey(m_UserID.ID, inventoryId))
            {
                return(false);
            }
            m_Log.Info("Testing existence 3");
            try
            {
                if (!m_InventoryService.Item.TryGetValue(inventoryId, out item))
                {
                    return(false);
                }
                if (!m_InventoryService.SupportsLegacyFunctions)
                {
                    m_Log.Error("Service does not specify legacy functions supported");
                    return(false);
                }
                if (!IsDataEqual(item, testItem))
                {
                    return(false);
                }
            }
            catch (NotSupportedException)
            {
                if (m_InventoryService.SupportsLegacyFunctions)
                {
                    m_Log.Error("Service specifies legacy functions supported. Missing function.");
                    return(false);
                }
            }

            m_Log.Info("Testing existence 4");
            if (!m_InventoryService.Item.TryGetValue(m_UserID.ID, inventoryId, out item))
            {
                return(false);
            }
            if (!IsDataEqual(item, testItem))
            {
                return(false);
            }
            m_Log.Info("Testing existence 5");
            try
            {
                item = m_InventoryService.Item[inventoryId];
                if (!m_InventoryService.SupportsLegacyFunctions)
                {
                    m_Log.Error("Service does not specify legacy functions supported");
                    return(false);
                }
                if (!IsDataEqual(item, testItem))
                {
                    return(false);
                }
            }
            catch (NotSupportedException)
            {
                if (m_InventoryService.SupportsLegacyFunctions)
                {
                    m_Log.Error("Service specifies legacy functions supported. Missing function.");
                    return(false);
                }
            }
            m_Log.Info("Testing existence 6");
            item = m_InventoryService.Item[m_UserID.ID, inventoryId];
            if (!IsDataEqual(item, testItem))
            {
                return(false);
            }
            m_Log.Info("Testing existence 7");
            result = m_InventoryService.Item[m_UserID.ID, new List <UUID> {
                                                 inventoryId
                                             }];
            if (result.Count != 1)
            {
                return(false);
            }
            if (!IsDataEqual(result[0], testItem))
            {
                return(false);
            }

            item = null;
            m_Log.Info("Testing non-existence 8");
            result = m_InventoryService.Folder.GetItems(m_UserID.ID, rootFolder.ID);
            foreach (InventoryItem checkItem in result)
            {
                if (checkItem.ID == inventoryId)
                {
                    item = checkItem;
                }
            }
            if (item == null)
            {
                return(false);
            }
            if (!IsDataEqual(item, testItem))
            {
                return(false);
            }
            m_Log.Info("Testing non-existence 9");
            result = m_InventoryService.Folder.Content[m_UserID.ID, rootFolder.ID].Items;
            item   = null;
            foreach (InventoryItem checkItem in result)
            {
                if (checkItem.ID == inventoryId)
                {
                    item = checkItem;
                }
            }
            if (item == null)
            {
                return(false);
            }
            if (!IsDataEqual(item, testItem))
            {
                return(false);
            }

            m_Log.Info("Updating item");
            testItem.Name                  = "Test Name 2";
            testItem.Description           = "Test Description 2";
            testItem.Flags                 = InventoryFlags.None;
            testItem.AssetID               = UUID.Random;
            testItem.SaleInfo.Price        = 20;
            testItem.SaleInfo.Type         = InventoryItem.SaleInfoData.SaleType.Original;
            testItem.Permissions.Current   = InventoryPermissionsMask.None;
            testItem.Permissions.EveryOne  = InventoryPermissionsMask.None;
            testItem.Permissions.NextOwner = InventoryPermissionsMask.None;
            testItem.Permissions.Group     = InventoryPermissionsMask.None;

            m_InventoryService.Item.Update(testItem);

            m_Log.Info("Testing changes");
            item = m_InventoryService.Item[m_UserID.ID, inventoryId];
            if (!IsDataEqual(item, testItem))
            {
                return(false);
            }

            m_Log.Info("Deleting item");
            m_InventoryService.Item.Delete(m_UserID.ID, inventoryId);

            m_Log.Info("Testing non-existence 1");
            try
            {
                if (m_InventoryService.Item.ContainsKey(inventoryId))
                {
                    return(false);
                }
                if (!m_InventoryService.SupportsLegacyFunctions)
                {
                    m_Log.Error("Service does not specify legacy functions supported");
                    return(false);
                }
            }
            catch (NotSupportedException)
            {
                if (m_InventoryService.SupportsLegacyFunctions)
                {
                    m_Log.Error("Service specifies legacy functions supported. Missing function.");
                    return(false);
                }
            }

            m_Log.Info("Testing non-existence 2");
            if (m_InventoryService.Item.ContainsKey(m_UserID.ID, inventoryId))
            {
                return(false);
            }

            m_Log.Info("Testing non-existence 3");
            try
            {
                if (m_InventoryService.Item.TryGetValue(inventoryId, out item))
                {
                    return(false);
                }
                if (!m_InventoryService.SupportsLegacyFunctions)
                {
                    m_Log.Error("Service does not specify legacy functions supported");
                    return(false);
                }
            }
            catch (NotSupportedException)
            {
                if (m_InventoryService.SupportsLegacyFunctions)
                {
                    m_Log.Error("Service specifies legacy functions supported. Missing function.");
                    return(false);
                }
            }

            m_Log.Info("Testing non-existence 4");
            if (m_InventoryService.Item.TryGetValue(m_UserID.ID, inventoryId, out item))
            {
                return(false);
            }
            m_Log.Info("Testing non-existence 5");
            try
            {
                item = m_InventoryService.Item[inventoryId];
                if (!m_InventoryService.SupportsLegacyFunctions)
                {
                    m_Log.Error("Service does not specify legacy functions supported");
                    return(false);
                }
                return(false);
            }
            catch (NotSupportedException)
            {
                if (m_InventoryService.SupportsLegacyFunctions)
                {
                    m_Log.Error("Service specifies legacy functions supported. Missing function.");
                    return(false);
                }
            }
            catch (InventoryItemNotFoundException)
            {
                /* this is the okay case */
                if (!m_InventoryService.SupportsLegacyFunctions)
                {
                    m_Log.Error("Service does not specify legacy functions supported");
                    return(false);
                }
            }
            m_Log.Info("Testing non-existence 6");
            try
            {
                item = m_InventoryService.Item[m_UserID.ID, inventoryId];
                return(false);
            }
            catch (InventoryItemNotFoundException)
            {
                /* this is the okay case */
            }

            m_Log.Info("Testing non-existence 7");
            result = m_InventoryService.Item[m_UserID.ID, new List <UUID> {
                                                 inventoryId
                                             }];
            if (result.Count != 0)
            {
                return(false);
            }
            m_Log.Info("Testing non-existence 8");
            result = m_InventoryService.Folder.GetItems(m_UserID.ID, rootFolder.ID);
            foreach (InventoryItem checkItem in result)
            {
                if (checkItem.ID == inventoryId)
                {
                    return(false);
                }
            }
            m_Log.Info("Testing non-existence 9");
            result = m_InventoryService.Folder.Content[m_UserID.ID, rootFolder.ID].Items;
            foreach (InventoryItem checkItem in result)
            {
                if (checkItem.ID == inventoryId)
                {
                    return(false);
                }
            }

            m_Log.Info("Creating the item");
            m_InventoryService.Item.Add(testItem);
            inventoryId = testItem.ID;

            m_Log.Info("Deleting item");
            List <UUID> deleted = m_InventoryService.Item.Delete(m_UserID.ID, new List <UUID> {
                inventoryId
            });

            if (!deleted.Contains(inventoryId))
            {
                return(false);
            }

            m_Log.Info("Testing non-existence 1");
            try
            {
                if (m_InventoryService.Item.ContainsKey(inventoryId))
                {
                    return(false);
                }
                if (!m_InventoryService.SupportsLegacyFunctions)
                {
                    m_Log.Error("Service does not specify legacy functions supported");
                    return(false);
                }
            }
            catch (NotSupportedException)
            {
                if (m_InventoryService.SupportsLegacyFunctions)
                {
                    m_Log.Error("Service specifies legacy functions supported. Missing function.");
                    return(false);
                }
            }

            m_Log.Info("Testing non-existence 2");
            if (m_InventoryService.Item.ContainsKey(m_UserID.ID, inventoryId))
            {
                return(false);
            }

            m_Log.Info("Testing non-existence 3");
            try
            {
                if (m_InventoryService.Item.TryGetValue(inventoryId, out item))
                {
                    return(false);
                }
            }
            catch (NotSupportedException)
            {
                if (m_InventoryService.SupportsLegacyFunctions)
                {
                    m_Log.Error("Service specifies legacy functions supported. Missing function.");
                    return(false);
                }
            }

            m_Log.Info("Testing non-existence 4");
            if (m_InventoryService.Item.TryGetValue(m_UserID.ID, inventoryId, out item))
            {
                return(false);
            }
            m_Log.Info("Testing non-existence 5");
            try
            {
                item = m_InventoryService.Item[inventoryId];
                if (!m_InventoryService.SupportsLegacyFunctions)
                {
                    m_Log.Error("Service does not specify legacy functions supported");
                    return(false);
                }
                return(false);
            }
            catch (NotSupportedException)
            {
                if (m_InventoryService.SupportsLegacyFunctions)
                {
                    m_Log.Error("Service specifies legacy functions supported. Missing function.");
                    return(false);
                }
            }
            catch (InventoryItemNotFoundException)
            {
                /* this is the okay case */
                if (!m_InventoryService.SupportsLegacyFunctions)
                {
                    m_Log.Error("Service does not specify legacy functions supported");
                    return(false);
                }
            }
            m_Log.Info("Testing non-existence 6");
            try
            {
                item = m_InventoryService.Item[m_UserID.ID, inventoryId];
                return(false);
            }
            catch (InventoryItemNotFoundException)
            {
                /* this is the okay case */
            }
            m_Log.Info("Testing non-existence 7");
            result = m_InventoryService.Item[m_UserID.ID, new List <UUID> {
                                                 inventoryId
                                             }];
            if (result.Count != 0)
            {
                return(false);
            }
            m_Log.Info("Testing non-existence 8");
            result = m_InventoryService.Folder.GetItems(m_UserID.ID, rootFolder.ID);
            foreach (InventoryItem checkItem in result)
            {
                if (checkItem.ID == inventoryId)
                {
                    return(false);
                }
            }
            m_Log.Info("Testing non-existence 9");
            result = m_InventoryService.Folder.Content[m_UserID.ID, rootFolder.ID].Items;
            foreach (InventoryItem checkItem in result)
            {
                if (checkItem.ID == inventoryId)
                {
                    return(false);
                }
            }

            return(true);
        }
        public static void Load(
            UGUI principal,
            InventoryServiceInterface inventoryService,
            AssetServiceInterface assetService,
            List <AvatarNameServiceInterface> nameServices,
            LoadOptions options,
            Stream inputFile,
            string topath,
            TTY console_io = null)
        {
            using (var gzipStream = new GZipStream(inputFile, CompressionMode.Decompress))
            {
                using (var reader = new TarArchiveReader(gzipStream))
                {
                    var inventoryPath = new Dictionary <UUID, UUID>();
                    var reassignedIds = new Dictionary <UUID, UUID>();
                    var linkItems     = new List <InventoryItem>();

                    UUID parentFolder;
                    try
                    {
                        inventoryService.CheckInventory(principal.ID);
                    }
                    catch (NotSupportedException)
                    {
                        /* some handlers may not support this call, so ignore that error */
                    }
                    parentFolder = inventoryService.Folder[principal.ID, AssetType.RootFolder].ID;

                    if (!topath.StartsWith("/"))
                    {
                        throw new InvalidInventoryPathException();
                    }

                    if (topath != "/")
                    {
                        foreach (string pathcomp in topath.Substring(1).Split('/'))
                        {
                            List <InventoryFolder> childfolders = inventoryService.Folder.GetFolders(principal.ID, parentFolder);
                            int idx;
                            for (idx = 0; idx < childfolders.Count; ++idx)
                            {
                                if (pathcomp.ToLower() == childfolders[idx].Name.ToLower())
                                {
                                    break;
                                }
                            }

                            if (idx == childfolders.Count)
                            {
                                throw new InvalidInventoryPathException();
                            }

                            parentFolder = childfolders[idx].ID;
                        }
                    }

                    inventoryPath[UUID.Zero] = parentFolder;

                    for (; ;)
                    {
                        TarArchiveReader.Header header;
                        try
                        {
                            header = reader.ReadHeader();
                        }
                        catch (TarArchiveReader.EndOfTarException)
                        {
                            if (console_io != null)
                            {
                                console_io.Write("Creating link items");
                            }
                            foreach (InventoryItem linkitem in linkItems)
                            {
                                UUID newId;
                                if (linkitem.AssetType == AssetType.Link && reassignedIds.TryGetValue(linkitem.AssetID, out newId))
                                {
                                    linkitem.AssetID = newId;
                                }
                                inventoryService.Item.Add(linkitem);
                            }
                            return;
                        }

                        if (header.FileType == TarFileType.File)
                        {
                            if (header.FileName == "archive.xml")
                            {
                                using (Stream s = new ObjectXmlStreamFilter(reader))
                                {
                                    ArchiveXmlLoader.LoadArchiveXml(s);
                                }
                            }

                            if (header.FileName.StartsWith("assets/") && (options & LoadOptions.NoAssets) == 0)
                            {
                                /* Load asset */
                                AssetData ad = reader.LoadAsset(header, principal);
                                if (!assetService.Exists(ad.ID))
                                {
                                    assetService.Store(ad);
                                }
                            }

                            if (header.FileName.StartsWith("inventory/"))
                            {
                                /* Load inventory */
                                InventoryItem item = LoadInventoryItem(reader, principal, nameServices);
                                item.ParentFolderID = GetPath(principal, inventoryService, inventoryPath, header.FileName, options);

                                UUID oldId = item.ID;
                                item.SetNewID(UUID.Random);
                                reassignedIds.Add(oldId, item.ID);

                                if (item.AssetType == AssetType.Link || item.AssetType == AssetType.LinkFolder)
                                {
                                    inventoryService.Item.Add(item);
                                }
                                else
                                {
                                    linkItems.Add(item);
                                }
                            }
                        }
                    }
                }
            }
        }
        public bool Run()
        {
            m_Log.Info("Create User Inventory");
            try
            {
                m_BackendInventoryService.CheckInventory(m_UserID.ID);
            }
            catch
            {
                return(false);
            }

            InventoryFolder rootFolder  = m_InventoryService.Folder[m_UserID.ID, AssetType.RootFolder];
            UUID            inventoryId = UUID.Random;

            var testFolder = new InventoryFolder(inventoryId)
            {
                Name           = "Test Name",
                Version        = 5,
                ParentFolderID = rootFolder.ID,
                DefaultType    = AssetType.Notecard,
                Owner          = m_UserID,
            };

            m_InventoryService.Folder.Add(testFolder);
            inventoryId = testFolder.ID;

            m_Log.Info("Testing existence 1");
            if (!m_InventoryService.Folder.ContainsKey(m_UserID.ID, inventoryId))
            {
                return(false);
            }

            m_Log.Info("Purging folder");
            m_InventoryService.Folder.Purge(m_UserID.ID, testFolder.ID);

            m_Log.Info("Testing existence 1");
            if (!m_InventoryService.Folder.ContainsKey(m_UserID.ID, inventoryId))
            {
                return(false);
            }

            m_Log.Info("Testing Purge(UUID) API available based on SupportsLegacyFunctions");
            try
            {
                m_InventoryService.Folder.Purge(testFolder.ID);
                if (!m_InventoryService.SupportsLegacyFunctions)
                {
                    m_Log.Error("Service does not specify legacy functions supported");
                    return(false);
                }
            }
            catch (NotSupportedException)
            {
                if (m_InventoryService.SupportsLegacyFunctions)
                {
                    m_Log.Error("Service specifies legacy functions supported. Missing function.");
                    return(false);
                }
            }

            m_Log.Info("Deleting folder");
            m_InventoryService.Folder.Delete(m_UserID.ID, inventoryId);

            m_Log.Info("Testing non-existence 1");
            if (m_InventoryService.Folder.ContainsKey(m_UserID.ID, inventoryId))
            {
                return(false);
            }

            return(true);
        }