/// <summary> /// Synchronizes the collection hierarchy. /// </summary> /// <param name="folderSyncRequest">A FolderSyncRequest object that contains the request information.</param> /// <returns>The FolderSync response which is returned from the server.</returns> public FolderSyncResponse FolderSync(FolderSyncRequest folderSyncRequest) { FolderSyncResponse response = this.activeSyncClient.FolderSync(folderSyncRequest); Site.Assert.IsNotNull(response, "If the operation is successful, the response should not be null."); this.VerifyTransport(); return(response); }
/// <summary> /// Synchronizes the collection hierarchy /// </summary> /// <param name="folderSyncRequest">A FolderSyncRequest object that contains the request information.</param> /// <returns>FolderSync command response.</returns> public FolderSyncResponse FolderSync(FolderSyncRequest folderSyncRequest) { FolderSyncResponse folderSyncResponse = this.activeSyncClient.FolderSync(folderSyncRequest); Site.Assert.IsNotNull(folderSyncResponse, "The FolderSync response returned from server should not be null."); return(folderSyncResponse); }
/// <summary> /// Initial folder sync /// </summary> /// <returns>SyncKey returned from server</returns> private string GetFolderSyncKey() { FolderSyncRequest folderSyncRequest = Common.CreateFolderSyncRequest("0"); FolderSyncResponse foldersyncResponse = this.CMDAdapter.FolderSync(folderSyncRequest); string folderSynKey = foldersyncResponse.ResponseData.SyncKey; return(folderSynKey); }
/// <summary> /// Synchronizes the collection hierarchy. /// </summary> /// <param name="request">A FolderSyncRequest object which contains the request information.</param> /// <returns>A FolderSyncResponse object.</returns> public FolderSyncResponse FolderSync(FolderSyncRequest request) { FolderSyncResponse response = this.activeSyncClient.FolderSync(request); Site.Assert.IsNotNull(response, "If the FolderSync command executes successfully, the response from server should not be null."); this.VerifyTransport(); return(response); }
/// <summary> /// Synchronize the collection hierarchy. /// </summary> /// <returns>A FolderSync command response returned from the server.</returns> public FolderSyncResponse FolderSync() { FolderSyncRequest request = Common.CreateFolderSyncRequest("0"); FolderSyncResponse folderSyncResponse = this.activeSyncClient.FolderSync(request); Site.Assert.IsNotNull(folderSyncResponse, "The FolderSync response should be returned."); return(folderSyncResponse); }
/// <summary> /// FolderSync command to synchronize the collection hierarchy /// </summary> /// <returns>The FolderSync response</returns> public FolderSyncResponse FolderSync() { FolderSyncRequest request = Common.CreateFolderSyncRequest("0"); FolderSyncResponse response = this.activeSyncClient.FolderSync(request); this.calendarId = Common.GetDefaultFolderServerId(response, FolderType.Calendar, this.Site); return(response); }
internal FolderSyncResponse FolderSync(string syncKey) { FolderSyncRequest folderSyncRequest = new FolderSyncRequest { SyncKey = syncKey }; return(this.FolderSync(folderSyncRequest)); }
public void MSASCMD_S04_TC08_FolderSync_UpdateFolder() { #region Call method FolderCreate command to create a new folder as a child folder of the specified parent folder. string folderName = Common.GenerateResourceName(Site, "FolderSync"); FolderCreateResponse folderCreateResponse = this.GetFolderCreateResponse(this.LastFolderSyncKey, (byte)FolderType.UserCreatedMail, folderName, "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 Change DeviceID this.CMDAdapter.ChangeDeviceID("NewDeviceID"); this.RecordDeviceInfoChanged(); string folderSyncKey = folderCreateResponse.ResponseData.SyncKey; #endregion #region Call method FolderSync to synchronize the collection hierarchy. FolderSyncResponse foldersyncResponseForNewDeviceID = this.FolderSync(); string changeDeviceIDFolderId = TestSuiteBase.GetCollectionId(foldersyncResponseForNewDeviceID, folderName); Site.Assert.IsFalse(string.IsNullOrEmpty(changeDeviceIDFolderId), "If the new folder created by FolderCreate command, server should return a server ID for the new created folder."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R5020"); // If client sends the FolderSync request successfully, the server must send a synchronization key to the client in a response. Site.CaptureRequirementIfIsTrue( (foldersyncResponseForNewDeviceID.ResponseData.SyncKey != null) && (foldersyncResponseForNewDeviceID.ResponseData.SyncKey != folderSyncKey), 5020, @"[In Synchronizing a Folder Hierarchy] [FolderSync sequence for folder hierarchy synchronization, order 1:] The server responds with [the folder hierarchy and] a new folderhierarchy:SyncKey value."); #endregion #region Call method FolderUpdate to rename a folder. string folderUpdateName = Common.GenerateResourceName(Site, "FolderUpdate"); FolderUpdateRequest folderUpdateRequest = Common.CreateFolderUpdateRequest(foldersyncResponseForNewDeviceID.ResponseData.SyncKey, changeDeviceIDFolderId, folderUpdateName, "0"); this.CMDAdapter.FolderUpdate(folderUpdateRequest); #endregion #region Restore DeviceID and call FolderSync command. this.CMDAdapter.ChangeDeviceID(Common.GetConfigurationPropertyValue("DeviceID", this.Site)); // The client calls FolderSync command to synchronize the collection hierarchy with original device id. FolderSyncRequest folderSyncRequest = Common.CreateFolderSyncRequest(folderSyncKey); FolderSyncResponse folderSyncResponse = this.CMDAdapter.FolderSync(folderSyncRequest); bool isUpdated = false; foreach (Response.FolderSyncChangesUpdate update in folderSyncResponse.ResponseData.Changes.Update) { if (update.DisplayName == folderUpdateName) { isUpdated = true; break; } } Site.Assert.IsTrue(isUpdated, "Rename successfully"); #endregion }
public void MSASPROV_S03_TC04_VerifyInvalidPolicyKey() { #region Call Provision command to download the policy settings. // Download the policy setting. ProvisionResponse provisionResponse = this.CallProvisionCommand(string.Empty, "MS-EAS-Provisioning-WBXML", "1"); string temporaryPolicyKey = provisionResponse.ResponseData.Policies.Policy.PolicyKey; #endregion #region Call Provision command to acknowledge the policy settings and get the valid PolicyKey // Acknowledge the policy setting. provisionResponse = this.CallProvisionCommand(temporaryPolicyKey, "MS-EAS-Provisioning-WBXML", "1"); string finalPolicyKey = provisionResponse.ResponseData.Policies.Policy.PolicyKey; #endregion #region Call FolderSync command with an invalid PolicyKey which is different from the one got from last step. // Apply an invalid policy key this.PROVAdapter.ApplyPolicyKey(finalPolicyKey.Substring(0, 1)); // Call folder sync with "0" in initialization phase. FolderSyncRequest folderSyncRequest = Common.CreateFolderSyncRequest("0"); if ("12.1" == Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site)) { string httpErrorCode = null; try { this.PROVAdapter.FolderSync(folderSyncRequest); } catch (WebException exception) { httpErrorCode = Common.GetErrorCodeFromException(exception); } Site.Assert.IsFalse(string.IsNullOrEmpty(httpErrorCode), "Server should return expected [449] error code if client do not have policy key"); } else { FolderSyncResponse folderSyncResponse = this.PROVAdapter.FolderSync(folderSyncRequest); Site.Assert.AreEqual(144, int.Parse(folderSyncResponse.ResponseData.Status), "The server should return status 144 to indicate a invalid policy key."); } if (Common.IsRequirementEnabled(537, this.Site)) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R537"); // Verify MS-ASPROV requirement: MS-ASPROV_R537 // If the above capture or assert passed, it means the server did returns a status code when the policy key is mismatched. Site.CaptureRequirement( 537, @"[In Appendix B: Product Behavior] If the policy key received from the client does not match the stored policy key on the server [, or if the server determines that policy settings need to be updated on the client], the implementation does return a status code, as specified in [MS-ASCMD] section 2.2.4, in the next command response indicating that the client needs to send another Provision command to request the security policy settings and obtain a new policy key. (Exchange 2007 and above follow this behavior.)"); } #endregion }
public void MSASCMD_S11_TC05_Ping_Status7_Outdate() { #region Change a new user to call ActiveSync operation with a new DeviceID. this.CMDAdapter.SwitchUser(this.User3Information.UserName, this.User3Information.UserPassword, this.User3Information.UserDomain); // Record user that uses new DeviceID this.RecordDeviceInfoChanged(); this.CMDAdapter.ChangeDeviceID("FirstDeviceID"); #endregion #region Sync user folder changes this.FolderSync(); #endregion #region Switch to new device and create one folder this.CMDAdapter.ChangeDeviceID("SecondDeviceID"); string folderSynKey = this.GetFolderSyncKey(); // Create one mail type folder string newFolderName = Guid.NewGuid().ToString().Replace("-", string.Empty); FolderCreateRequest folderCreateRequest = Common.CreateFolderCreateRequest(folderSynKey, 12, newFolderName, this.User1Information.InboxCollectionId); FolderCreateResponse folderCreateResponse = this.CMDAdapter.FolderCreate(folderCreateRequest); Site.Assert.AreEqual <int>( 1, int.Parse(folderCreateResponse.ResponseData.Status), "After folder create success, server should return status 1"); #endregion #region Switch back to old device and send one ping request this.CMDAdapter.ChangeDeviceID("FirstDeviceID"); PingRequest pingRequest = CreatePingRequest(this.User1Information.InboxCollectionId, Request.PingFolderClass.Email); PingResponse pingResponse = this.CMDAdapter.Ping(pingRequest); #endregion // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R4257"); // Verify MS-ASCMD requirement: MS-ASCMD_R4257 Site.CaptureRequirementIfAreEqual <int>( 7, int.Parse(pingResponse.ResponseData.Status), 4257, @"[In Status(Ping)] [When the scope is Global], [the cause of the status value 7 is] The folder hierarchy is out of date."); #region Record new created folder collection ID. // Get new created folder collection ID FolderSyncRequest folderSyncRequestForNewFolder = Common.CreateFolderSyncRequest("0"); FolderSyncResponse folderSyncResponseForNewFolder = this.CMDAdapter.FolderSync(folderSyncRequestForNewFolder); // Gets the server ID for new folder after change DeviceID. string serverId = TestSuiteBase.GetCollectionId(folderSyncResponseForNewFolder, newFolderName); TestSuiteBase.RecordCaseRelativeFolders(this.User3Information, serverId); #endregion }
public void MSASCMD_S04_TC05_FolderSync_Status9() { // Call method FolderSync with an empty SyncKey to synchronize the collection hierarchy. FolderSyncRequest folderSyncRequest = new FolderSyncRequest { RequestData = { SyncKey = string.Empty } }; FolderSyncResponse folderSyncResponse = this.CMDAdapter.FolderSync(folderSyncRequest); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R4068"); // If the client sent a malformed or mismatched synchronization key, the server should return a status code 9 in the FolderSync command response. // Verify MS-ASCMD requirement: MS-ASCMD_R4068 Site.CaptureRequirementIfAreEqual <int>( 9, int.Parse(folderSyncResponse.ResponseData.Status), 4068, @"[In Status(FolderSync)] If the command fails, the Status element contains a code that indicates the type of failure."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R4070"); // If the client sent a malformed or mismatched synchronization key, the server should return a status code 9 in the FolderSync command response. // Verify MS-ASCMD requirement: MS-ASCMD_R4070 Site.CaptureRequirementIfAreEqual <int>( 9, int.Parse(folderSyncResponse.ResponseData.Status), 4070, @"[In Status(FolderSync)] If one collection fails, a failure status MUST be returned for all collections."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R4083"); // The server should return a status code 9 in the FolderSync command response to indicate the client sent a malformed or mismatched synchronization key. // If the SyncKey is an empty string, the status is equal to 9. Site.CaptureRequirementIfAreEqual <int>( 9, int.Parse(folderSyncResponse.ResponseData.Status), 4083, @"[In Status(FolderSync)] [When the scope is Global], [the cause of the status value 9 is] The client sent a malformed or mismatched synchronization key [, or the synchronization state is corrupted on the server]."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R4581"); // The server should return a status code 9 in the FolderSync command response to indicate the client sent a malformed or mismatched synchronization key. // Verify MS-ASCMD requirement: MS-ASCMD_R4581 Site.CaptureRequirementIfAreEqual <int>( 9, int.Parse(folderSyncResponse.ResponseData.Status), 4581, @"[In SyncKey(FolderSync)] The server MUST return a Status element (section 2.2.3.162.4) value of 9 if the value of the SyncKey element does not match the value of the synchronization key on the server."); }
/// <summary> /// Synchronizes the collection hierarchy /// </summary> /// <param name="request">A FolderSyncRequest object that contains the request information.</param> /// <returns>FolderSync command response</returns> public FolderSyncResponse FolderSync(FolderSyncRequest request) { FolderSyncResponse response = this.activeSyncClient.FolderSync(request); this.VerifyTransportRequirements(); if (response.StatusCode == HttpStatusCode.OK) { this.VerifyWBXMLCapture(CommandName.FolderSync, response); this.VerifyFolderSyncCommand(response); } return(response); }
public void MSASCMD_S04_TC09_FolderSync_DeleteFolder() { #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. string folderName = Common.GenerateResourceName(Site, "FolderSync"); FolderCreateResponse folderCreateResponse = this.GetFolderCreateResponse(this.LastFolderSyncKey, (byte)FolderType.UserCreatedMail, folderName, "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."); #endregion #region Changes DeviceID. this.CMDAdapter.ChangeDeviceID("NewDeviceID"); this.RecordDeviceInfoChanged(); #endregion #region Calls method FolderSync to synchronize the collection hierarchy. FolderSyncRequest folderSyncRequestForNewDeviceID = Common.CreateFolderSyncRequest("0"); FolderSyncResponse folderSyncResponseForNewDeviceID = this.CMDAdapter.FolderSync(folderSyncRequestForNewDeviceID); // Gets the server ID for new folder after change DeviceID. string serverId = TestSuiteBase.GetCollectionId(folderSyncResponseForNewDeviceID, folderName); Site.Assert.IsNotNull(serverId, "Call method GetServerId to get a non-null ServerId to indicate success."); #endregion #region The client calls FolderDelete command to delete the created folder in step 2 from the server. FolderDeleteRequest folderDeleteRequest = Common.CreateFolderDeleteRequest(folderSyncResponseForNewDeviceID.ResponseData.SyncKey, serverId); FolderDeleteResponse folderDeleteResponse = this.CMDAdapter.FolderDelete(folderDeleteRequest); Site.Assert.AreEqual <int>(1, int.Parse(folderDeleteResponse.ResponseData.Status), "The server should return a status code 1 in the FolderDelete command response to indicate success."); #endregion #region Restore DeviceID and call FolderSync command this.CMDAdapter.ChangeDeviceID(Common.GetConfigurationPropertyValue("DeviceID", this.Site)); // The client calls FolderSync command to synchronize the collection hierarchy with original device id. FolderSyncRequest folderSyncRequest = Common.CreateFolderSyncRequest(folderCreateResponse.ResponseData.SyncKey); FolderSyncResponse folderSyncResponse = this.CMDAdapter.FolderSync(folderSyncRequest); Site.Assert.AreEqual <int>(1, int.Parse(folderSyncResponse.ResponseData.Status), "Server should return status 1 in the FolderSync response to indicate success."); Site.Assert.IsNotNull(folderSyncResponse.ResponseData.Changes, "Server should return Changes element in the FolderSync response after the collection hierarchy changed by call FolderDelete command."); Site.Assert.IsNotNull(folderSyncResponse.ResponseData.Changes.Delete, "Server should return Changes element in the FolderSync response after the specified folder deleted."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R5863"); // The folderDeleteSuccess is true indicates the folder which deleted by FolderDelete command is deleted successfully. // Verify MS-ASCMD requirement: MS-ASCMD_R5863 Site.CaptureRequirementIfIsNotNull( folderSyncResponse.ResponseData.Changes.Delete[0].ServerId, 5863, @"[In Delete(FolderSync)] [The Delete element] specifies that a folder on the server was deleted since the last folder synchronization."); #endregion }
public void MSASCMD_S04_TC02_FolderSync_NoChanged() { // The client calls FolderSync command to synchronize the collection hierarchy if no changes occurred for folder. FolderSyncRequest folderSyncRequest = Common.CreateFolderSyncRequest(this.LastFolderSyncKey); FolderSyncResponse folderSyncResponse = this.CMDAdapter.FolderSync(folderSyncRequest); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R2120"); // Verify MS-ASCMD requirement: MS-ASCMD_R2120 Site.CaptureRequirementIfAreEqual <uint>( 0, folderSyncResponse.ResponseData.Changes.Count, 2120, @"[In Count] If there are no changes since the last folder synchronization, a Count element value of 0 (zero) is returned."); }
public void MSASPROV_S03_TC07_VerifyStatus141() { #region Call Provision command to download the policy settings. // Download the policy setting. ProvisionResponse provisionResponse = this.CallProvisionCommand(string.Empty, "MS-EAS-Provisioning-WBXML", "1"); string temporaryPolicyKey = provisionResponse.ResponseData.Policies.Policy.PolicyKey; #endregion #region Call Provision command to acknowledge the policy settings and get the valid PolicyKey // Acknowledge the policy setting. provisionResponse = this.CallProvisionCommand(temporaryPolicyKey, "MS-EAS-Provisioning-WBXML", "1"); string finalPolicyKey = provisionResponse.ResponseData.Policies.Policy.PolicyKey; #endregion #region Call FolderSync command with an emtry PolicyKey. if ("12.1" != Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site)) { // Apply an emtry policy key this.PROVAdapter.ApplyPolicyKey(string.Empty); // Call folder sync with "0" in initialization phase. FolderSyncRequest folderSyncRequest = Common.CreateFolderSyncRequest("0"); FolderSyncResponse folderSyncResponse = this.PROVAdapter.FolderSync(folderSyncRequest); this.Site.CaptureRequirementIfAreEqual <int>( 141, int.Parse(folderSyncResponse.ResponseData.Status), 682, @"[In Provision Command Errors] [The meaning of status value] 141 [is] The device is not provisionable."); this.Site.CaptureRequirementIfAreEqual <int>( 141, int.Parse(folderSyncResponse.ResponseData.Status), 458, @"[In Provision Command Errors] [The cause of status value 141 is] The client did not submit a policy key value in a request."); this.Site.CaptureRequirementIfAreEqual <int>( 141, int.Parse(folderSyncResponse.ResponseData.Status), 685, @"[In Provision Command Errors] [The cause of status value 141 is] The server is configured to not allow clients that do not submit a policy key value."); } #endregion }
public void MSASCMD_S04_TC03_FolderSync_Changed() { #region Change a new DeviceID and call FolderSync command. this.CMDAdapter.ChangeDeviceID(Common.GetConfigurationPropertyValue("DeviceID", this.Site)); FolderSyncResponse folderSyncResponseForDefaultDeviceID = this.FolderSync(); #endregion #region Change a new DeviceID and call FolderSync command. this.CMDAdapter.ChangeDeviceID("NewDeviceID"); this.RecordDeviceInfoChanged(); string folderName = Common.GenerateResourceName(Site, "FolderSync"); FolderSyncResponse folderSyncResponseForNewDeviceID = this.FolderSync(); #endregion #region Call method FolderCreate to create a new folder as a child folder of the specified parent folder. FolderCreateResponse folderCreateResponse = this.GetFolderCreateResponse(folderSyncResponseForNewDeviceID.ResponseData.SyncKey, (byte)FolderType.UserCreatedMail, folderName, "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 Change the DeviceId back and call method FolderSync to synchronize the collection hierarchy. this.CMDAdapter.ChangeDeviceID(Common.GetConfigurationPropertyValue("DeviceID", this.Site)); FolderSyncRequest folderSyncRequest = Common.CreateFolderSyncRequest(folderSyncResponseForNewDeviceID.ResponseData.SyncKey); FolderSyncResponse folderSyncResponse = this.CMDAdapter.FolderSync(folderSyncRequest); foreach (Response.FolderSyncChangesAdd add in folderSyncResponse.ResponseData.Changes.Add) { if (add.DisplayName == folderName) { this.User1Information.UserCreatedFolders.Clear(); TestSuiteBase.RecordCaseRelativeFolders(this.User1Information, add.ServerId); break; } } // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R5024"); // Verify MS-ASCMD requirement: MS-ASCMD_R5024 Site.CaptureRequirementIfAreEqual <uint>( (uint)1, folderSyncResponse.ResponseData.Changes.Count, 5024, @"[In Synchronizing a Folder Hierarchy] [FolderSync sequence for folder hierarchy synchronization, order 2:] If any changes have occurred on the server, the new, deleted, or changed folders are returned to the client."); #endregion }
public void MSASCMD_S04_TC06_FolderSync_Status10() { // Call method FolderSync to synchronize the collection hierarchy with a null SyncKey. FolderSyncRequest folderSyncRequest = new FolderSyncRequest { RequestData = { SyncKey = null } }; FolderSyncResponse folderSyncResponse = this.CMDAdapter.FolderSync(folderSyncRequest); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R4086"); // If the SyncKey is invalid, the status is equal to 10. Site.CaptureRequirementIfAreEqual <int>( 10, int.Parse(folderSyncResponse.ResponseData.Status), 4086, @"[In Status(FolderSync)] [When the scope is Global], [the cause of the status value 10 is] The client sent a FolderSync command request that contains a semantic or syntactic error."); }
public void MSASCMD_S21_TC07_CommonStatusCode_102() { Site.Assume.AreNotEqual <string>("12.1", Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site), "This test case is not supported when the MS-ASProtocolVersion header is set to 12.1.. MS-ASProtocolVersion header value is determined using Common PTFConfig property named ActiveSyncProtocolVersion."); #region call FolderSync command containing a FileReference element which is not defined in FolderSync request. FolderSyncRequest request = new FolderSyncRequest(); Request.FolderSync requestData = new Request.FolderSync { FileReference = "0", FileReferenceSpecified = true }; request.RequestData = requestData; FolderSyncResponse folderSyncResponse = this.CMDAdapter.FolderSync(request); this.Site.CaptureRequirementIfAreEqual <int>( 102, int.Parse(folderSyncResponse.ResponseData.Status), 4815, @"[In Common Status Codes] When the protocol version is 14.0, 14.1 or 16.0, [The meaning of the status value 102 is] The request contains WBXML but it could not be decoded into XML."); #endregion }
/// <summary> /// Change user to call active sync operations and resynchronize the collection hierarchy. /// </summary> /// <param name="userInformation">The information of the user.</param> /// <param name="isFolderSyncNeeded">A boolean value that indicates whether needs to synchronize the folder hierarchy.</param> protected void SwitchUser(UserInformation userInformation, bool isFolderSyncNeeded) { this.PROVAdapter.SwitchUser(userInformation.UserName, userInformation.UserPassword, userInformation.UserDomain); if (isFolderSyncNeeded) { this.AcknowledgeSecurityPolicySettings(); // Call FolderSync command to synchronize the collection hierarchy. FolderSyncRequest folderSyncRequest = Common.CreateFolderSyncRequest("0"); FolderSyncResponse folderSyncReponse = this.PROVAdapter.FolderSync(folderSyncRequest); // Verify FolderSync command response. Site.Assert.AreEqual <int>( 1, int.Parse(folderSyncReponse.ResponseData.Status), "If the FolderSync command executes successfully, the Status in response should be 1."); // Get the folder collectionId of User1 if (userInformation.UserName == this.User1Information.UserName) { if (string.IsNullOrEmpty(this.User1Information.InboxCollectionId)) { this.User1Information.InboxCollectionId = Common.GetDefaultFolderServerId(folderSyncReponse, FolderType.Inbox, this.Site); } if (string.IsNullOrEmpty(this.User1Information.SentItemsCollectionId)) { this.User1Information.SentItemsCollectionId = Common.GetDefaultFolderServerId(folderSyncReponse, FolderType.SentItems, this.Site); } } // Get the folder collectionId of User3 if (userInformation.UserName == this.User3Information.UserName) { if (string.IsNullOrEmpty(this.User3Information.InboxCollectionId)) { this.User3Information.InboxCollectionId = Common.GetDefaultFolderServerId(folderSyncReponse, FolderType.Inbox, this.Site); } } } }
public void MSASPROV_S01_TC01_AcknowledgeSecurityPolicySettings() { #region Switch current user to the user who has custom policy settings. // Switch to the user who has been configured with custom policy. this.SwitchUser(this.User2Information, false); #endregion #region Download the policy settings. // Download the policy settings. ProvisionResponse provisionResponse = this.CallProvisionCommand(string.Empty, "MS-EAS-Provisioning-WBXML", "1"); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R394"); // Verify MS-ASPROV requirement: MS-ASPROV_R394 // The value of Status is 1, so this requirement can be captured. Site.CaptureRequirementIfAreEqual <byte>( 1, provisionResponse.ResponseData.Status, 394, @"[In Status (Provision)] Value 1 means Success."); string temporaryPolicyKey = provisionResponse.ResponseData.Policies.Policy.PolicyKey; // Get the policy element from the Provision response. Response.ProvisionPoliciesPolicy policy = provisionResponse.ResponseData.Policies.Policy; // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R310"); // Verify MS-ASPROV requirement: MS-ASPROV_R310 // The PolicyType, PolicyKey, Status and Data elements are not null, so this requirement can be captured. Site.CaptureRequirementIfIsTrue( policy.Data != null && policy.PolicyKey != null && policy.PolicyType != null && policy.Status != 0, 310, @"[In Policy] In the initial Provision command response, the Policy element has only the following child elements: PolicyType (section 2.2.2.42) (required) PolicyKey (section 2.2.2.41) (required) Status (section 2.2.2.53) (required) Data (section 2.2.2.23) ( required)."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R417"); // Verify MS-ASPROV requirement: MS-ASPROV_R417 // The PolicyType, PolicyKey, Status and Data elements are not null, so this requirement can be captured. Site.CaptureRequirementIfIsTrue( policy.Data != null && policy.PolicyKey != null && policy.PolicyType != null && policy.Status != 0, 417, @"[In Abstract Data Model] In order 1, the server response contains the policy type, policy key, data, and status code."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R378"); // Verify MS-ASPROV requirement: MS-ASPROV_R378 // The value of Status is 1, so this requirement can be captured. Site.CaptureRequirementIfAreEqual <byte>( 1, policy.Status, 378, @"[In Status (Policy)] Value 1 means Success."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R209"); // Verify MS-ASPROV requirement: MS-ASPROV_R209 // The Data element is not null, so this requirement can be captured. Site.CaptureRequirementIfIsNotNull( policy.Data, 209, @"[In Data (container Data Type)] It [Data element] is a required child element of the Policy element (section 2.2.2.40) in responses to initial Provision command requests, as specified in section 3.2.5.1.1."); // Because the user is not allowe to download attachment. // So if AttachmentsEnabled element is false then R206 will be verified. this.Site.CaptureRequirementIfAreEqual <bool>( false, policy.Data.EASProvisionDoc.AttachmentsEnabled, 206, @"[In AttachmentsEnabled] Value 0 means Attachments are not allowed to be downloaded."); // Because if the Data element is a container Data type, then the Data element should contain the EASProvisionDoc element. // So if the Data element contain the EASProvisionDoc element and the PolicyType element is set to "MS-EAS-Provisioning-WBXML", then R888 will be verified. this.Site.CaptureRequirementIfIsTrue( policy.Data.EASProvisionDoc != null && policy.PolicyType == "MS-EAS-Provisioning-WBXML", 888, @"[In Data (container Data Type)] This element [Data (container Data Type)] requires that the PolicyType element (section 2.2.2.42) is set to ""MS-EAS-Provisioning-WBXML""."); this.Site.CaptureRequirementIfIsTrue( !string.IsNullOrEmpty(policy.PolicyKey), 486, @"[In Provision Command] The server generates, stores, and sends the policy key when it responds to a Provision command request for policy settings."); #endregion #region Acknowledge the policy settings. // Acknowledge the policy settings. provisionResponse = this.CallProvisionCommand(temporaryPolicyKey, "MS-EAS-Provisioning-WBXML", "1"); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R678"); // Verify MS-ASPROV requirement: MS-ASPROV_R678 // The value of Status is 1, so this requirement can be captured. Site.CaptureRequirementIfAreEqual <byte>( 1, provisionResponse.ResponseData.Status, 678, @"[In Provision Command Errors] [The meaning of status value] 1 [is] Success."); bool isR441Verified = provisionResponse.ResponseData.Policies != null && provisionResponse.ResponseData.Status == 1; // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R441"); // Verify MS-ASPROV requirement: MS-ASPROV_R441 // The Policies element is not null and the value of Status is 1, so this requirement can be captured. Site.CaptureRequirementIfIsTrue( isR441Verified, 441, @"[In Provision Command Errors] [The cause of status value 1 is] The Policies element contains information about security policies."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R650"); // Verify MS-ASPROV requirement: MS-ASPROV_R650 // The acknowledgement Provision succeeds and PolicyKey element is not null, so this requirement can be captured. Site.CaptureRequirementIfIsNotNull( temporaryPolicyKey, 650, @"[In Responding to an Initial Request] The value of the PolicyKey element (section 2.2.2.41) is a temporary policy key that will be valid only for an acknowledgment request to acknowledge the policy settings contained in the Data element."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R657"); // Verify MS-ASPROV requirement: MS-ASPROV_R657 // The command executed successfully using the temporary PolicyKey, so this requirement can be captured. Site.CaptureRequirement( 657, @"[In Responding to a Security Policy Settings Acknowledgment] The server MUST ensure that the current policy key sent by the client in a security policy settings acknowledgment matches the temporary policy key issued by the server in the response to the initial request from this client."); // Get the policy element from the Provision response. policy = provisionResponse.ResponseData.Policies.Policy; // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R605"); // Verify MS-ASPROV requirement: MS-ASPROV_R605 // The PolicyType, PolicyKey and Status elements are not null, so this requirement can be captured. Site.CaptureRequirementIfIsTrue( policy.PolicyKey != null && policy.PolicyType != null && policy.Status != 0, 605, @"[In Policy] In the acknowledgment Provision command response, the Policy element has the following child elements: PolicyType (section 2.2.2.42) (required) PolicyKey (section 2.2.2.41) (required) Status (section 2.2.2.53) (required)."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R419"); // Verify MS-ASPROV requirement: MS-ASPROV_R419 // The PolicyType, PolicyKey and Status elements are not null, so this requirement can be captured. Site.CaptureRequirementIfIsTrue( policy.PolicyKey != null && policy.PolicyType != null && policy.Status != 0, 419, @"[In Abstract Data Model] In order 2, the server response contains the policy type, policy key, and status code to indicate that the server recorded the client's acknowledgement."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R688"); // Verify MS-ASPROV requirement: MS-ASPROV_R688 // The value of Status is 1, so this requirement can be captured. Site.CaptureRequirementIfAreEqual <byte>( 1, policy.Status, 688, @"[In Provision Command Errors] [The meaning of status value] 1 [is] Success."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R466"); // Verify MS-ASPROV requirement: MS-ASPROV_R466 // The value of Status is 1, so this requirement can be captured. Site.CaptureRequirementIfAreEqual <byte>( 1, policy.Status, 466, @"[In Provision Command Errors] [The cause of status value 1 is] The requested policy data is included in the response."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R703"); // Verify MS-ASPROV requirement: MS-ASPROV_R703 // The value of Status is 1, so this requirement can be captured. Site.CaptureRequirementIfAreEqual <byte>( 1, policy.Status, 703, @"[In Provision Command Errors] [When the scope is] Policy, [the meaning of status value] 1 [is] Success."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R495"); // Verify MS-ASPROV requirement: MS-ASPROV_R495 // The value of Status is 1, so this requirement can be captured. Site.CaptureRequirementIfAreEqual <byte>( 1, policy.Status, 495, @"[In Provision Command Errors] [When the scope is Policy], [the cause of status value 1 is] The requested policy data is included in the response."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R601"); // Verify MS-ASPROV requirement: MS-ASPROV_R601 // The Data element is null, so this requirement can be captured. Site.CaptureRequirementIfIsNull( policy.Data, 601, @"[In Data (container Data Type)] It [Data element] is not present in responses to acknowledgment requests, as specified in section 3.2.5.1.2."); #endregion #region Apply the final policy key got from acknowledgement Provision response. // Get the final policy key from the Provision command response. string finalPolicyKey = provisionResponse.ResponseData.Policies.Policy.PolicyKey; // Apply the final policy key for the subsequence commands. this.PROVAdapter.ApplyPolicyKey(finalPolicyKey); #endregion #region Call FolderSync command with the final policy key. FolderSyncRequest folderSyncRequest = Common.CreateFolderSyncRequest("0"); FolderSyncResponse folderSynReponse = this.PROVAdapter.FolderSync(folderSyncRequest); Site.Assert.AreEqual(folderSynReponse.StatusCode, HttpStatusCode.OK, "Server should return a HTTP expected status code [{0}] after apply Policy Key, actual is [{1}]", HttpStatusCode.OK, folderSynReponse.StatusCode); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R662"); // Verify MS-ASPROV requirement: MS-ASPROV_R662 // The FolderSync command executed successfully after the final policy key is applied, so this requirement can be captured. Site.CaptureRequirementIfIsNotNull( finalPolicyKey, 662, @"[In Responding to a Security Policy Settings Acknowledgment] The value of the PolicyKey element (section 2.2.2.41) is a permanent policy key that is valid for subsequent command requests from the client."); #endregion }
/// <summary> /// Synchronizes the collection hierarchy /// </summary> /// <param name="folderSyncRequest">FolderSync command request.</param> /// <returns>The FolderSync response which is returned from the server</returns> public FolderSyncResponse FolderSync(FolderSyncRequest folderSyncRequest) { FolderSyncResponse response = this.activeSyncClient.FolderSync(folderSyncRequest); Site.Assert.IsNotNull(response, "If the operation is successful, the response should not be null."); return response; }
/// <summary> /// Synchronizes the collection hierarchy. /// </summary> /// <param name="request">A FolderSyncRequest object that contains the request information.</param> /// <returns>A FolderSyncResponse object.</returns> public FolderSyncResponse FolderSync(FolderSyncRequest request) { FolderSyncResponse response = this.activeSyncClient.FolderSync(request); Site.Assert.IsNotNull(response, "If the FolderSync command executes successfully, the response from server should not be null."); return response; }
private FolderSyncResponse FolderSync(FolderSyncRequest folderSyncRequest) { return(EasConnectionWrapper.WrapException <FolderSyncResponse>(() => this.wrappedObject.FolderSync(folderSyncRequest), (ConnectionsTransientException e) => new EasFolderSyncFailedTransientException(e.Message, e), (ConnectionsPermanentException e) => new EasFolderSyncFailedPermanentException(e.Message, e))); }
FolderSyncResponse IEasConnection.FolderSync(FolderSyncRequest folderSyncRequest) { FolderSyncCommand folderSyncCommand = new FolderSyncCommand(this.EasConnectionSettings); return(folderSyncCommand.Execute(folderSyncRequest)); }
public void MSASCMD_S04_TC06_FolderSync_Status10() { // Call method FolderSync to synchronize the collection hierarchy with a null SyncKey. FolderSyncRequest folderSyncRequest = new FolderSyncRequest { RequestData = { SyncKey = null } }; FolderSyncResponse folderSyncResponse = this.CMDAdapter.FolderSync(folderSyncRequest); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R4086"); // If the SyncKey is invalid, the status is equal to 10. Site.CaptureRequirementIfAreEqual<int>( 10, int.Parse(folderSyncResponse.ResponseData.Status), 4086, @"[In Status(FolderSync)] [When the scope is Global], [the cause of the status value 10 is] The client sent a FolderSync command request that contains a semantic or syntactic error."); }
FolderSyncResponse IEasConnection.FolderSync(FolderSyncRequest folderSyncRequest) { throw new NotImplementedException(); }
/// <summary> /// Creates a folder Sync request using specified syncKey /// </summary> /// <param name="syncKey">Specified sync key</param> /// <returns>A FolderSyncRequest instance</returns> public static FolderSyncRequest CreateFolderSyncRequest(string syncKey) { FolderSyncRequest request = new FolderSyncRequest(); Request.FolderSync requestData = new Request.FolderSync { SyncKey = syncKey }; request.RequestData = requestData; return request; }
/// <summary> /// Synchronizes the collection hierarchy from server. /// </summary> /// <param name="folderSyncRequest">The request of FolderSync command.</param> /// <returns>The response of FolderSync command.</returns> public FolderSyncResponse FolderSync(FolderSyncRequest folderSyncRequest) { FolderSyncResponse folderSyncResponse = this.activeSyncClient.FolderSync(folderSyncRequest); Site.Assert.IsNotNull(folderSyncResponse, "The FolderSync response returned from server should not be null."); return folderSyncResponse; }
public void MSASCMD_S04_TC05_FolderSync_Status9() { // Call method FolderSync with an empty SyncKey to synchronize the collection hierarchy. FolderSyncRequest folderSyncRequest = new FolderSyncRequest { RequestData = { SyncKey = string.Empty } }; FolderSyncResponse folderSyncResponse = this.CMDAdapter.FolderSync(folderSyncRequest); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R4068"); // If the client sent a malformed or mismatched synchronization key, the server should return a status code 9 in the FolderSync command response. // Verify MS-ASCMD requirement: MS-ASCMD_R4068 Site.CaptureRequirementIfAreEqual<int>( 9, int.Parse(folderSyncResponse.ResponseData.Status), 4068, @"[In Status(FolderSync)] If the command fails, the Status element contains a code that indicates the type of failure."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R4070"); // If the client sent a malformed or mismatched synchronization key, the server should return a status code 9 in the FolderSync command response. // Verify MS-ASCMD requirement: MS-ASCMD_R4070 Site.CaptureRequirementIfAreEqual<int>( 9, int.Parse(folderSyncResponse.ResponseData.Status), 4070, @"[In Status(FolderSync)] If one collection fails, a failure status MUST be returned for all collections."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R4083"); // The server should return a status code 9 in the FolderSync command response to indicate the client sent a malformed or mismatched synchronization key. // If the SyncKey is an empty string, the status is equal to 9. Site.CaptureRequirementIfAreEqual<int>( 9, int.Parse(folderSyncResponse.ResponseData.Status), 4083, @"[In Status(FolderSync)] [When the scope is Global], [the cause of the status value 9 is] The client sent a malformed or mismatched synchronization key [, or the synchronization state is corrupted on the server]."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R4581"); // The server should return a status code 9 in the FolderSync command response to indicate the client sent a malformed or mismatched synchronization key. // Verify MS-ASCMD requirement: MS-ASCMD_R4581 Site.CaptureRequirementIfAreEqual<int>( 9, int.Parse(folderSyncResponse.ResponseData.Status), 4581, @"[In SyncKey(FolderSync)] The server MUST return a Status element (section 2.2.3.162.4) value of 9 if the value of the SyncKey element does not match the value of the synchronization key on the server."); }
internal FolderSyncResponse FolderSync() { FolderSyncRequest initialSyncRequest = FolderSyncRequest.InitialSyncRequest; return(this.FolderSync(initialSyncRequest)); }