/// <summary>
        /// Gets the list of email folders from the server
        /// </summary>
        /// <returns>GetHierarchy command response.</returns>
        public GetHierarchyResponse GetHierarchy()
        {
            GetHierarchyResponse response = this.activeSyncClient.GetHierarchy();

            this.VerifyGetHierarchyCommand(response);
            return(response);
        }
Exemplo n.º 2
0
        void OnResponseReceived(BaseResponse response)
        {
            Repaint();
            //Debug.Log("Hierarchy OnResponseReceived");

            if (response is GetHierarchyResponse)
            {
                GetHierarchyResponse hierarchyResponse = (GetHierarchyResponse)response;
                List <TreeViewItem>  displays          = new List <TreeViewItem>();

                int index = 0;
                foreach (var scene in hierarchyResponse.Scenes)
                {
                    displays.Add(new TreeViewItem {
                        id = index, depth = 0, displayName = scene.SceneName
                    });
                    treeView.SetExpanded(index, true);
                    index++;

                    foreach (var node in scene.HierarchyNodes)
                    {
                        displays.Add(new TreeViewItem {
                            id = index, depth = node.Depth + 1, displayName = node.ObjectName
                        });
                        index++;
                    }
                }

                treeView.SetDisplays(displays);
            }
        }
Exemplo n.º 3
0
        public override BaseResponse GenerateResponse()
        {
            GetHierarchyResponse response = new GetHierarchyResponse();

            for (int i = 0; i < SceneManager.sceneCount; i++)
            {
                Scene scene = SceneManager.GetSceneAt(i);
                SceneHierarchyDescription sceneHierarchyDescription = new SceneHierarchyDescription();

                sceneHierarchyDescription.SceneName = scene.name;
                GameObject[] rootObjects = scene.GetRootGameObjects();

                foreach (GameObject rootObject in rootObjects)
                {
                    RecurseHierarchy(sceneHierarchyDescription.HierarchyNodes, rootObject.transform, 0);
                }
                response.Scenes.Add(sceneHierarchyDescription);
            }

            return(response);
        }
Exemplo n.º 4
0
        public override BaseResponse GenerateResponse()
        {
            GetHierarchyResponse response = new GetHierarchyResponse();

            List <Scene> scenes = HierarchyHelper.GetAllScenes();

            foreach (Scene scene in scenes)
            {
                SceneHierarchyDescription sceneHierarchyDescription = new SceneHierarchyDescription();

                sceneHierarchyDescription.SceneName = scene.name;
                GameObject[] rootObjects = scene.GetRootGameObjects();

                foreach (GameObject rootObject in rootObjects)
                {
                    RecurseHierarchy(sceneHierarchyDescription.HierarchyNodes, rootObject.transform, 0);
                }
                response.Scenes.Add(sceneHierarchyDescription);
            }

            return(response);
        }
Exemplo n.º 5
0
        public static string GetDebugStringForResponse(BaseResponse response)
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.AppendLine(response.GetType().Name);

            if (response is GetGameObjectResponse)
            {
                GetGameObjectResponse gameObjectResponse = (GetGameObjectResponse)response;

                stringBuilder.AppendLine(gameObjectResponse.GameObjectName);
                foreach (var component in gameObjectResponse.Components)
                {
                    stringBuilder.Append(" ");
                    stringBuilder.AppendLine(component.TypeFullName);
                    foreach (var scope in component.Scopes)
                    {
                        foreach (var field in scope.Fields)
                        {
                            stringBuilder.Append("  ");
                            stringBuilder.Append(field.VariableName);
                            stringBuilder.Append(" ");
                            stringBuilder.Append(field.DataType);
                            stringBuilder.Append(" = ");
                            stringBuilder.Append(field.Value);
                            stringBuilder.AppendLine();
                        }
                        foreach (var property in scope.Properties)
                        {
                            stringBuilder.Append("  ");
                            stringBuilder.Append(property.VariableName);
                            stringBuilder.Append(" ");
                            stringBuilder.Append(property.DataType);
                            stringBuilder.Append(" = ");
                            stringBuilder.Append(property.Value);
                            stringBuilder.AppendLine();
                        }
                        foreach (var method in scope.Methods)
                        {
                            stringBuilder.Append("  ");
                            stringBuilder.Append(method.MethodName);
                            stringBuilder.Append(" ");
                            stringBuilder.Append(method.ReturnType);
                            stringBuilder.Append(" ");
                            stringBuilder.Append(method.ParameterCount);
                            stringBuilder.Append(" ");
                            if (method.Parameters.Count > 0)
                            {
                                stringBuilder.Append(method.Parameters[0].DataType);
                            }
                            stringBuilder.AppendLine();
                        }
                    }
                }
            }
            else if (response is GetHierarchyResponse)
            {
                GetHierarchyResponse hierarchyResponse = (GetHierarchyResponse)response;
                foreach (var scene in hierarchyResponse.Scenes)
                {
                    stringBuilder.AppendLine(scene.SceneName);

                    foreach (var item in scene.HierarchyNodes)
                    {
                        for (int i = 0; i < item.Depth + 1; i++)
                        {
                            stringBuilder.Append(" ");
                        }
                        stringBuilder.AppendLine(item.ObjectName);
                    }
                }
            }

            return(stringBuilder.ToString());
        }
        public void MSASCMD_S22_TC01_GetHierarchySuccess()
        {
            Site.Assume.AreNotEqual <string>("14.0", Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site), "The GetHierarchy command is not supported when the MS-ASProtocolVersion header is set to 14.0. MS-ASProtocolVersion header value is determined using Common PTFConfig property named ActiveSyncProtocolVersion.");
            Site.Assume.AreNotEqual <string>("14.1", Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site), "The GetHierarchy command is not supported when the MS-ASProtocolVersion header is set to 14.1. MS-ASProtocolVersion header value is determined using Common PTFConfig property named ActiveSyncProtocolVersion.");
            Site.Assume.AreNotEqual <string>("16.0", Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site), "The GetHierarchy command is not supported when the MS-ASProtocolVersion header is set to 16.0. MS-ASProtocolVersion header value is determined using Common PTFConfig property named ActiveSyncProtocolVersion.");
            Site.Assume.AreNotEqual <string>("16.1", Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site), "The GetHierarchy command is not supported when the MS-ASProtocolVersion header is set to 16.1. MS-ASProtocolVersion header value is determined using Common PTFConfig property named ActiveSyncProtocolVersion.");

            #region The client calls FolderCreate command to create a new folder as a child folder of the specified parent folder, then server returns ServerId for FolderCreate command.
            FolderCreateResponse folderCreateResponse = this.GetFolderCreateResponse(this.LastFolderSyncKey, (byte)FolderType.UserCreatedMail, Common.GenerateResourceName(Site, "FolderSync"), "0");
            Site.Assert.AreEqual <int>(1, int.Parse(folderCreateResponse.ResponseData.Status), "The server should return a status code 1 in the FolderCreate command response to indicate success.");
            TestSuiteBase.RecordCaseRelativeFolders(this.User1Information, folderCreateResponse.ResponseData.ServerId);
            #endregion

            #region Call method FolderSync to synchronize the collection hierarchy.
            FolderSyncResponse folderSyncResponse = this.FolderSync();
            Site.Assert.AreEqual <int>(1, int.Parse(folderCreateResponse.ResponseData.Status), "The server should return a status code 1 in the FolderSync command response to indicate success.");
            string sentItemFolderCollectionId   = string.Empty;
            string deleteItemFolderCollectionId = string.Empty;

            foreach (Response.FolderSyncChangesAdd folderAdd in folderSyncResponse.ResponseData.Changes.Add)
            {
                if (string.Compare(folderAdd.DisplayName, "Sent Items", true) == 0)
                {
                    sentItemFolderCollectionId = folderAdd.ServerId;
                }

                if (string.Compare(folderAdd.DisplayName, "Deleted Items", true) == 0)
                {
                    deleteItemFolderCollectionId = folderAdd.ServerId;
                }
            }
            #endregion

            #region Call method GetHierarchy to get the list of email folders from the server.
            GetHierarchyResponse getHierarchyResponse = this.CMDAdapter.GetHierarchy();

            bool isVerifiedR7505 = false;
            bool isVerifiedR7507 = false;
            foreach (Response.FoldersFolder folder in getHierarchyResponse.ResponseData.Folder)
            {
                if (folder.DisplayName.Equals("Sent Items"))
                {
                    isVerifiedR7505 = true;
                }

                if (folder.DisplayName.Equals("Deleted Items"))
                {
                    isVerifiedR7507 = true;
                }
            }

            this.Site.CaptureRequirementIfIsTrue(
                isVerifiedR7505,
                7505,
                @"[In GetHierarchy] The client can use the GetHierarchy command to obtain the collection ID of a folder, such as Sent Items folder [or Deleted Items folder], that cannot be deleted.");

            this.Site.CaptureRequirementIfIsTrue(
                isVerifiedR7507,
                7507,
                @"[In GetHierarchy] The client can use the GetHierarchy command to obtain the collection ID of a folder, such as [Sent Items folder or] Deleted Items folder, that cannot be deleted.");

            // If R6030 have been verfied and sentItemFolderCollectionId is not null , then the client can obtain the collection ID of folder from ServerId element of previous FOlderSync
            this.Site.CaptureRequirementIfIsTrue(
                string.IsNullOrEmpty(sentItemFolderCollectionId) == false,
                6031,
                @"[In GetHierarchy] The collection ID is obtained from the ServerId element of a previous FolderSync [or FolderCreate] command.");

            bool isVerifiedR6032 = string.IsNullOrEmpty(folderCreateResponse.ResponseData.ServerId) == false;

            this.Site.CaptureRequirementIfIsTrue(
                isVerifiedR6032,
                6032,
                @"[In GetHierarchy] The collection ID is obtained from the ServerId element of a previous [FolderSync or] FolderCreate command.");

            bool isVerifiedR6025 = false;

            foreach (Response.FoldersFolder folder in getHierarchyResponse.ResponseData.Folder)
            {
                if (!string.IsNullOrEmpty(folder.ParentId))
                {
                    isVerifiedR6025 = true;
                }
                else
                {
                    isVerifiedR6025 = false;
                    break;
                }
            }

            this.Site.CaptureRequirementIfIsTrue(
                isVerifiedR6025,
                6025,
                @"[In GetHierarchy] Each folder's place within the folder hierarchy is indicated by its parent ID.");

            bool isVerifiedR6026 = false;
            foreach (Response.FoldersFolder folder in getHierarchyResponse.ResponseData.Folder)
            {
                // According Open Specification, if the type of the folder is not 1, 2, 3, 4, 5 and 6 then this folder is not a email folder.
                if (folder.Type == 1 || folder.Type == 2 || folder.Type == 3 || folder.Type == 4 || folder.Type == 5 || folder.Type == 6)
                {
                    isVerifiedR6026 = true;
                }
                else
                {
                    isVerifiedR6026 = false;
                }
            }

            this.Site.CaptureRequirementIfIsTrue(
                isVerifiedR6026,
                6026,
                @"[In GetHierarchy] The list of folders returned by the GetHierarchy command includes only email folders.");

            // If above requirements have been verified, the R6024 will be verified.
            this.Site.CaptureRequirement(
                6024,
                @"[In GetHierarchy] The GetHierarchy command gets the list of email folders from the server.");
            #endregion
        }
Exemplo n.º 7
0
        /// <summary>
        /// This method is used to verify the GetHierarchy response related requirements.
        /// </summary>
        /// <param name="response">GetHierarchy command response.</param>
        private void VerifyGetHierarchyCommand(GetHierarchyResponse response)
        {
            Site.Assert.IsTrue(this.activeSyncClient.ValidationResult, "The schema validation result should be true.");
            Site.Assert.IsNotNull(response.ResponseData, "The Folders element should not be null.");

            // If the schema validation result is true and response is not null, this requirement can be verified.
            this.Site.CaptureRequirement(
                6046,
                @"[In GetHierarchy] That is, there is no such top-level element called ""GetHierarchy"" that identifies the body of the HTTP POST as containing a GetHierarchy command. ");

            // If the schema validation result is true and response is not null, this requirement can be verified.
            this.Site.CaptureRequirement(
                6047,
                @"[In GetHierarchy] Instead, the Folders element is the top-level element.");

            // If the schema validation result is true and response is not null, this requirement can be verified.
            this.Site.CaptureRequirement(
                6600,
                @"[In Folders(GetHierarchy)] None [Element Folders in GetHierarchy command response (section 2.2.2.7) has no parent element.]");

            // If the schema validation result is true and response is not null, this requirement can be verified.
            this.Site.CaptureRequirement(
                6601,
                @"[In Folders(GetHierarchy)] Element Folders in GetHierarchy command response (section 2.2.2.7), the child element is Folder (section 2.2.3.66).");

            // If the schema validation result is true and response is not null, this requirement can be verified.
            this.Site.CaptureRequirement(
                6602,
                @"[In Folders(GetHierarchy)] Element Folders in GetHierarchy command response (section 2.2.2.7), the data type is container ([MS-ASDTYPE] section 2.2).");

            // If the schema validation result is true and response is not null, this requirement can be verified.
            this.Site.CaptureRequirement(
                6603,
                @"[In Folders(GetHierarchy)] Element Folders in GetHierarchy command response (section 2.2.2.7), the number allowed is 1...1 (required).");

            foreach (FoldersFolder folder in response.ResponseData.Folder)
            {
                this.VerifyFolderElement(folder);
            }
        }