Beispiel #1
0
        internal static ApiDeleteNodesRequest ToApiDeleteNodesRequest(DeleteNodesRequest request)
        {
            ApiDeleteNodesRequest apiDeleteNodesRequest = new ApiDeleteNodesRequest {
                NodeIds = request.Ids
            };

            return(apiDeleteNodesRequest);
        }
Beispiel #2
0
        public static LogEntry For(DeleteNodesRequest request)
        {
            LogEntry entry = new LogEntry("DeleteNodesRequest");

            entry.Add("RequestHeader", For(request.RequestHeader));
            entry.Add("NodesToDelete", For(request.NodesToDelete));
            return(entry);
        }
Beispiel #3
0
        private static void DeleteNodes()
        {
            List <long> nodeIdsForDeletion = new List <long> {
                1,
                2
            };

            DeleteNodesRequest request = new DeleteNodesRequest(nodeIdsForDeletion);

            dc.Nodes.DeleteNodes(request);
        }
Beispiel #4
0
        public void ToApiDeleteNodesRequest()
        {
            // ARRANGE
            ApiDeleteNodesRequest expected = FactoryNode.ApiDeleteNodesRequest;

            DeleteNodesRequest param = new DeleteNodesRequest(expected.NodeIds);

            // ACT
            ApiDeleteNodesRequest actual = NodeMapper.ToApiDeleteNodesRequest(param);

            // ASSERT
            Assert.Equal(expected, actual, new ApiDeleteNodesRequestComparer());
        }
Beispiel #5
0
        public async Task DeleteNodesAsync()
        {
            var response = new DeleteNodesResponse();
            var request  = new DeleteNodesRequest();
            var channel  = new TestRequestChannel(response);

            var ret = await channel.DeleteNodesAsync(request);

            ret
            .Should().BeSameAs(response);

            channel.Request
            .Should().BeSameAs(request);
        }
Beispiel #6
0
        public void DeleteNodes(DeleteNodesRequest request)
        {
            _client.Executor.CheckApiServerVersion();

            #region Parameter Validation

            request.MustNotNull(nameof(request));
            request.Ids.EnumerableMustNotNullOrEmpty(nameof(request.Ids));
            request.Ids.ForEach(id => id.MustPositive(nameof(request.Ids) + " element"));

            #endregion

            ApiDeleteNodesRequest apiDeleteNodesRequest = NodeMapper.ToApiDeleteNodesRequest(request);
            IRestRequest          restRequest           = _client.Builder.DeleteNodes(apiDeleteNodesRequest);
            _client.Executor.DoSyncApiCall <VoidResponse>(restRequest, RequestType.DeleteNodes);
        }
Beispiel #7
0
        /// <summary>
        /// Deletes one or more Nodes from the AddressSpace.
        /// </summary>
        /// <param name="channel">A instance of <see cref="IRequestChannel"/>.</param>
        /// <param name="request">A <see cref="DeleteNodesRequest"/>.</param>
        /// <returns>A <see cref="Task"/> representing the asynchronous operation that returns a <see cref="DeleteNodesResponse"/>.</returns>
        public static async Task <DeleteNodesResponse> DeleteNodesAsync(this IRequestChannel channel, DeleteNodesRequest request)
        {
            if (request == null)
            {
                throw new ArgumentNullException(nameof(request));
            }

            return((DeleteNodesResponse)await channel.RequestAsync(request).ConfigureAwait(false));
        }
Beispiel #8
0
        /// <summary>
        /// Begins an asynchronous invocation of the DeleteNodes service.
        /// </summary>
        public IAsyncResult BeginDeleteNodes(
            RequestHeader             requestHeader,
            DeleteNodesItemCollection nodesToDelete,
            AsyncCallback             callback,
            object                    asyncState)
        {
            DeleteNodesRequest request = new DeleteNodesRequest();

            request.RequestHeader = requestHeader;
            request.NodesToDelete = nodesToDelete;

            UpdateRequestHeader(request, requestHeader == null, "DeleteNodes");

            if (UseTransportChannel)
            {
                return TransportChannel.BeginSendRequest(request, callback, asyncState);
            }

            return InnerChannel.BeginDeleteNodes(new DeleteNodesMessage(request), callback, asyncState);
        }
Beispiel #9
0
        /// <summary>
        /// Invokes the DeleteNodes service.
        /// </summary>
        public virtual ResponseHeader DeleteNodes(
            RequestHeader                requestHeader,
            DeleteNodesItemCollection    nodesToDelete,
            out StatusCodeCollection     results,
            out DiagnosticInfoCollection diagnosticInfos)
        {
            DeleteNodesRequest request = new DeleteNodesRequest();
            DeleteNodesResponse response = null;

            request.RequestHeader = requestHeader;
            request.NodesToDelete = nodesToDelete;

            UpdateRequestHeader(request, requestHeader == null, "DeleteNodes");

            try
            {
                if (UseTransportChannel)
                {
                    IServiceResponse genericResponse = TransportChannel.SendRequest(request);

                    if (genericResponse == null)
                    {
                        throw new ServiceResultException(StatusCodes.BadUnknownResponse);
                    }

                    ValidateResponse(genericResponse.ResponseHeader);
                    response = (DeleteNodesResponse)genericResponse;
                }
                else
                {
                    DeleteNodesResponseMessage responseMessage = InnerChannel.DeleteNodes(new DeleteNodesMessage(request));

                    if (responseMessage == null || responseMessage.DeleteNodesResponse == null)
                    {
                        throw new ServiceResultException(StatusCodes.BadUnknownResponse);
                    }

                    response = responseMessage.DeleteNodesResponse;
                    ValidateResponse(response.ResponseHeader);
                }

                results         = response.Results;
                diagnosticInfos = response.DiagnosticInfos;
            }
            finally
            {
                RequestCompleted(request, response, "DeleteNodes");
            }

            return response.ResponseHeader;
        }
Beispiel #10
0
 /// <summary>
 /// Initializes the message with the body.
 /// </summary>
 public DeleteNodesMessage(DeleteNodesRequest DeleteNodesRequest)
 {
     this.DeleteNodesRequest = DeleteNodesRequest;
 }