Beispiel #1
0
        /// <summary>
        /// This method is used to record the coauth lock status with specified client ID and schema lock ID for the file URL.
        /// </summary>
        /// <param name="fileUrl">Specify the file URL which get the coauth lock.</param>
        /// <param name="clientId">Specify the client ID of the coauth lock.</param>
        /// <param name="schemaLockId">Specify the schema ID of the coauth lock.</param>
        /// <param name="userName">Specify the user name of the user who calls cell storage service.</param>
        /// <param name="password">Specify the password of the user who calls cell storage service.</param>
        /// <param name="domain">Specify the domain of the user who calls cell storage service.</param>
        public void RecordCoauthSession(string fileUrl, string clientId, string schemaLockId, string userName, string password, string domain)
        {
            Action function = () =>
            {
                CoauthSubRequestType coauthLockRequest = new CoauthSubRequestType();
                coauthLockRequest.SubRequestToken = SequenceNumberGenerator.GetCurrentToken().ToString();
                coauthLockRequest.SubRequestData  = new CoauthSubRequestDataType();
                coauthLockRequest.SubRequestData.CoauthRequestType          = CoauthRequestTypes.ExitCoauthoring;
                coauthLockRequest.SubRequestData.CoauthRequestTypeSpecified = true;
                coauthLockRequest.SubRequestData.SchemaLockID = schemaLockId;
                coauthLockRequest.SubRequestData.ClientID     = clientId;

                IMS_FSSHTTP_FSSHTTPBAdapter adapter = site.GetAdapter <IMS_FSSHTTP_FSSHTTPBAdapter>();
                this.intializeContext(fileUrl, userName, password, domain);

                CoauthSubResponseType subResponse = SharedTestSuiteHelper.ExtractSubResponse <CoauthSubResponseType>(adapter.CellStorageRequest(fileUrl, new SubRequestType[] { coauthLockRequest }), 0, 0, site);

                if (!string.Equals("Success", subResponse.ErrorCode, StringComparison.OrdinalIgnoreCase))
                {
                    this.errorMessage.Add(string.Format("Failed to leave the coauth session for the client id {1} and schema lock id {5} on the file {0} using the following user: {2}/{3}and password:{4}", fileUrl, clientId, userName, domain, password, schemaLockId));
                    this.isEnvironmentRollbackSuccess = false;
                }
            };

            this.AddOrUpdate(new SharedLockKey(fileUrl, clientId, schemaLockId), function);
        }
Beispiel #2
0
        /// <summary>
        /// This method is used to record the exclusive lock status with specified exclusive lock ID for the file URL.
        /// </summary>
        /// <param name="fileUrl">Specify the file URL which get the exclusive lock.</param>
        /// <param name="exclusiveId">Specify the exclusive lock ID of the exclusive lock.</param>
        /// <param name="userName">Specify the user name of the user who calls cell storage service.</param>
        /// <param name="password">Specify the password of the user who calls cell storage service.</param>
        /// <param name="domain">Specify the domain of the user who calls cell storage service.</param>
        public void RecordExclusiveLock(string fileUrl, string exclusiveId, string userName, string password, string domain)
        {
            Action function = () =>
            {
                ExclusiveLockSubRequestType coauthLockRequest = new ExclusiveLockSubRequestType();
                coauthLockRequest.SubRequestToken = SequenceNumberGenerator.GetCurrentToken().ToString();
                coauthLockRequest.SubRequestData  = new ExclusiveLockSubRequestDataType();
                coauthLockRequest.SubRequestData.ExclusiveLockRequestType          = ExclusiveLockRequestTypes.ReleaseLock;
                coauthLockRequest.SubRequestData.ExclusiveLockRequestTypeSpecified = true;
                coauthLockRequest.SubRequestData.ExclusiveLockID = exclusiveId;

                IMS_FSSHTTP_FSSHTTPBAdapter adapter = site.GetAdapter <IMS_FSSHTTP_FSSHTTPBAdapter>();
                this.intializeContext(fileUrl, userName, password, domain);

                CoauthSubResponseType subResponse = SharedTestSuiteHelper.ExtractSubResponse <CoauthSubResponseType>(adapter.CellStorageRequest(fileUrl, new SubRequestType[] { coauthLockRequest }), 0, 0, site);

                if (!string.Equals("Success", subResponse.ErrorCode, StringComparison.OrdinalIgnoreCase))
                {
                    this.errorMessage.Add(string.Format("Failed to release the exclusive lock for the exclusive lock id {1} on the file {0} using the following user: {2}/{3}and password:{4}", fileUrl, exclusiveId, userName, domain, password));
                    this.isEnvironmentRollbackSuccess = false;
                }
            };

            this.AddOrUpdate(fileUrl, function, KeyStatus.ExclusiveLock);
        }
Beispiel #3
0
        /// <summary>
        /// This method is used to record the Editors Table status with specified client ID and editorsTableType for the file URL.
        /// </summary>
        /// <param name="fileUrl">Specify the file URL which get the file we use.</param>
        /// <param name="clientId">Specify the client ID of the editors table.</param>
        /// <param name="userName">Specify the user name of the user who calls cell storage service.</param>
        /// <param name="password">Specify the password of the user who calls cell storage service.</param>
        /// <param name="domain">Specify the domain of the user who calls cell storage service.</param>
        public void RecordEditorTable(string fileUrl, string clientId, string userName, string password, string domain)
        {
            Action function = () =>
            {
                EditorsTableSubRequestType ets = new EditorsTableSubRequestType();
                ets.Type                    = SubRequestAttributeType.EditorsTable;
                ets.SubRequestData          = new EditorsTableSubRequestDataType();
                ets.SubRequestData.ClientID = clientId;
                ets.SubRequestData.EditorsTableRequestTypeSpecified = true;
                ets.SubRequestData.EditorsTableRequestType          = EditorsTableRequestTypes.LeaveEditingSession;
                ets.SubRequestToken = SequenceNumberGenerator.GetCurrentToken().ToString();

                IMS_FSSHTTP_FSSHTTPBAdapter adapter = site.GetAdapter <IMS_FSSHTTP_FSSHTTPBAdapter>();
                this.intializeContext(fileUrl, userName, password, domain);
                EditorsTableSubResponseType subResponse = SharedTestSuiteHelper.ExtractSubResponse <EditorsTableSubResponseType>(adapter.CellStorageRequest(fileUrl, new SubRequestType[] { ets }), 0, 0, site);

                if (!string.Equals("Success", subResponse.ErrorCode, StringComparison.OrdinalIgnoreCase))
                {
                    this.errorMessage.Add(string.Format("Failed to release the editor tables join status for the client id {1} on the file {0} using the following user: {2}/{3}and password:{4}", fileUrl, clientId, userName, domain, password));
                    this.isEnvironmentRollbackSuccess = false;
                }
            };

            this.AddOrUpdate(new SharedLockKey(fileUrl, clientId, string.Empty), function);
        }