< Summary

Information
Class: Ice.IncomingRequest
Assembly: Ice
File(s): /home/runner/work/ice/ice/csharp/src/Ice/IncomingRequest.cs
Tag: 71_18251537082
Line coverage
96%
Covered lines: 26
Uncovered lines: 1
Coverable lines: 27
Total lines: 77
Line coverage: 96.2%
Branch coverage
83%
Covered branches: 5
Total branches: 6
Branch coverage: 83.3%
Method coverage
100%
Covered methods: 4
Total methods: 4
Method coverage: 100%

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_current()100%11100%
get_inputStream()100%11100%
get_size()100%11100%
.ctor(...)83.33%6695.83%

File(s)

/home/runner/work/ice/ice/csharp/src/Ice/IncomingRequest.cs

#LineLine coverage
 1// Copyright (c) ZeroC, Inc.
 2
 3#nullable enable
 4
 5namespace Ice;
 6
 7/// <summary>
 8/// Represents a request received by a connection. It's the argument to <see cref="Object.dispatchAsync" />.
 9/// </summary>
 10public sealed class IncomingRequest
 11{
 12    /// <summary>
 13    /// Gets the current object for the request.
 14    /// </summary>
 115    public Current current { get; }
 16
 17    /// <summary>
 18    /// Gets the incoming stream buffer of the request.
 19    /// </summary>
 120    public InputStream inputStream { get; }
 21
 22    /// <summary>
 23    /// Gets the number of bytes in the request.
 24    /// </summary>
 25    /// <value>The number of bytes in the request. These are all the bytes starting with the identity of the target.
 26    /// </value>
 127    public int size { get; }
 28
 29    /// <summary>
 30    /// Initializes a new instance of the <see cref="IncomingRequest" /> class.
 31    /// </summary>
 32    /// <param name="requestId">The request ID. It's 0 for oneway requests.</param>
 33    /// <param name="connection">The connection that received the request. It's null for collocated invocations.</param>
 34    /// <param name="adapter">The object adapter to set in current.</param>
 35    /// <param name="inputStream">The input stream buffer over the incoming Ice protocol request message. The stream is
 36    /// positioned at the beginning of the request header - the next data to read is the identity of the target object.
 37    /// </param>
 138    public IncomingRequest(int requestId, Connection? connection, ObjectAdapter adapter, InputStream inputStream)
 39    {
 140        this.inputStream = inputStream;
 41
 42        // Read everything else from the input stream
 143        int start = inputStream.pos();
 144        var identity = new Identity(inputStream);
 45
 146        string facet = "";
 147        string[] facetPath = inputStream.readStringSeq();
 148        if (facetPath.Length > 0)
 49        {
 150            if (facetPath.Length > 1)
 51            {
 052                throw new MarshalException($"Received invalid facet path with {facetPath.Length} elements.");
 53            }
 154            facet = facetPath[0];
 55        }
 156        string operation = inputStream.readString();
 157        var mode = (OperationMode)inputStream.readByte();
 158        var ctx = new Dictionary<string, string>();
 159        int sz = inputStream.readSize();
 160        while (sz-- > 0)
 61        {
 162            string first = inputStream.readString();
 163            string second = inputStream.readString();
 164            ctx[first] = second;
 65        }
 66
 167        int encapsulationSize = inputStream.readInt();
 168        var encoding = new EncodingVersion(inputStream);
 69
 170        current = new Current(adapter, connection, identity, facet, operation, mode, ctx, requestId, encoding);
 71
 72        // Rewind to the start of the encapsulation
 173        inputStream.pos(inputStream.pos() - 6);
 74
 175        size = inputStream.pos() - start + encapsulationSize;
 176    }
 77}