< Summary

Information
Class: Ice.SSL.EndpointI
Assembly: Ice
File(s): /home/runner/work/ice/ice/csharp/src/Ice/SSL/EndpointI.cs
Tag: 71_18251537082
Line coverage
92%
Covered lines: 61
Uncovered lines: 5
Coverable lines: 66
Total lines: 195
Line coverage: 92.4%
Branch coverage
77%
Covered branches: 17
Total branches: 22
Branch coverage: 77.2%
Method coverage
89%
Covered methods: 25
Total methods: 28
Method coverage: 89.2%

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
streamWriteImpl(...)100%11100%
getInfo()100%11100%
type()100%11100%
protocol()100%11100%
timeout()100%11100%
timeout(...)50%2.15266.67%
connectionId()100%11100%
connectionId(...)100%22100%
compress()100%11100%
compress(...)100%22100%
datagram()100%11100%
secure()100%210%
transceiver()100%11100%
.ctor(...)100%11100%
connectors(...)100%22100%
exception(...)100%210%
connectors_async(...)75%44100%
acceptor(...)100%11100%
endpoint(...)100%22100%
expandHost()100%11100%
isLoopbackOrMulticast()100%11100%
toPublishedEndpoint(...)100%11100%
equivalent(...)100%22100%
options()100%11100%
CompareTo(...)50%6.17683.33%
GetHashCode()100%11100%
checkOption(...)100%210%

File(s)

/home/runner/work/ice/ice/csharp/src/Ice/SSL/EndpointI.cs

#LineLine coverage
 1// Copyright (c) ZeroC, Inc.
 2
 3using System.Net.Security;
 4
 5namespace Ice.SSL;
 6
 7internal sealed class EndpointI : Ice.Internal.EndpointI
 8{
 19    internal EndpointI(Instance instance, Ice.Internal.EndpointI del)
 10    {
 111        _instance = instance;
 112        _delegate = del;
 113    }
 14
 115    public override void streamWriteImpl(Ice.OutputStream os) => _delegate.streamWriteImpl(os);
 16
 117    public override Ice.EndpointInfo getInfo() => new EndpointInfo(_delegate.getInfo());
 18
 119    public override short type() => _delegate.type();
 20
 121    public override string protocol() => _delegate.protocol();
 22
 123    public override int timeout() => _delegate.timeout();
 24
 25    public override Ice.Internal.EndpointI timeout(int timeout)
 26    {
 127        if (timeout == _delegate.timeout())
 28        {
 029            return this;
 30        }
 31        else
 32        {
 133            return new EndpointI(_instance, _delegate.timeout(timeout));
 34        }
 35    }
 36
 137    public override string connectionId() => _delegate.connectionId();
 38
 39    public override Ice.Internal.EndpointI connectionId(string connectionId)
 40    {
 141        if (connectionId.Equals(_delegate.connectionId(), StringComparison.Ordinal))
 42        {
 143            return this;
 44        }
 45        else
 46        {
 147            return new EndpointI(_instance, _delegate.connectionId(connectionId));
 48        }
 49    }
 50
 151    public override bool compress() => _delegate.compress();
 52
 53    public override Ice.Internal.EndpointI compress(bool compress)
 54    {
 155        if (compress == _delegate.compress())
 56        {
 157            return this;
 58        }
 59        else
 60        {
 161            return new EndpointI(_instance, _delegate.compress(compress));
 62        }
 63    }
 64
 165    public override bool datagram() => _delegate.datagram();
 66
 067    public override bool secure() => _delegate.secure();
 68
 169    public override Ice.Internal.Transceiver transceiver() => null;
 70
 71    private sealed class EndpointI_connectorsI : Ice.Internal.EndpointI_connectors
 72    {
 173        public EndpointI_connectorsI(Instance instance, string host, Ice.Internal.EndpointI_connectors cb)
 74        {
 175            _instance = instance;
 176            _host = host;
 177            _callback = cb;
 178        }
 79
 80        public void connectors(List<Ice.Internal.Connector> connectors)
 81        {
 182            var l = new List<Ice.Internal.Connector>();
 183            foreach (Ice.Internal.Connector c in connectors)
 84            {
 185                l.Add(new ConnectorI(_instance, c, _host));
 86            }
 187            _callback.connectors(l);
 188        }
 89
 090        public void exception(Ice.LocalException ex) => _callback.exception(ex);
 91
 92        private readonly Instance _instance;
 93        private readonly string _host;
 94        private readonly Ice.Internal.EndpointI_connectors _callback;
 95    }
 96
 97    public override void connectors_async(Ice.Internal.EndpointI_connectors callback)
 98    {
 199        string host = "";
 1100        for (Ice.EndpointInfo p = _delegate.getInfo(); p != null; p = p.underlying)
 101        {
 1102            if (p is Ice.IPEndpointInfo info)
 103            {
 1104                host = info.host;
 1105                break;
 106            }
 107        }
 1108        _delegate.connectors_async(new EndpointI_connectorsI(_instance, host, callback));
 1109    }
 110
 111    public override Ice.Internal.Acceptor acceptor(
 112        string adapterName,
 113        SslServerAuthenticationOptions authenticationOptions) =>
 1114        new AcceptorI(
 1115            this,
 1116            _instance,
 1117            _delegate.acceptor(adapterName, null),
 1118            adapterName,
 1119            authenticationOptions);
 120
 121    public EndpointI endpoint(Ice.Internal.EndpointI del)
 122    {
 1123        if (del == _delegate)
 124        {
 1125            return this;
 126        }
 127        else
 128        {
 1129            return new EndpointI(_instance, del);
 130        }
 131    }
 132
 133    public override List<Internal.EndpointI> expandHost() =>
 1134        _delegate.expandHost().Select(e => endpoint(e) as Internal.EndpointI).ToList();
 135
 1136    public override bool isLoopbackOrMulticast() => _delegate.isLoopbackOrMulticast();
 137
 138    public override EndpointI toPublishedEndpoint(string publishedHost) =>
 1139        endpoint(_delegate.toPublishedEndpoint(publishedHost));
 140
 141    public override bool equivalent(Ice.Internal.EndpointI endpoint)
 142    {
 1143        if (endpoint is not EndpointI)
 144        {
 1145            return false;
 146        }
 1147        var endpointI = (EndpointI)endpoint;
 1148        return _delegate.equivalent(endpointI._delegate);
 149    }
 150
 1151    public override string options() => _delegate.options();
 152
 153    // Compare endpoints for sorting purposes
 154    public override int CompareTo(Ice.Internal.EndpointI obj)
 155    {
 1156        if (obj is not EndpointI)
 157        {
 0158            return type() < obj.type() ? -1 : 1;
 159        }
 160
 1161        var p = (EndpointI)obj;
 1162        if (this == p)
 163        {
 1164            return 0;
 165        }
 166
 1167        return _delegate.CompareTo(p._delegate);
 168    }
 169
 1170    public override int GetHashCode() => _delegate.GetHashCode();
 171
 0172    protected override bool checkOption(string option, string argument, string endpoint) => false;
 173
 174    private readonly Instance _instance;
 175    private readonly Ice.Internal.EndpointI _delegate;
 176}
 177
 178internal sealed class EndpointFactoryI : Ice.Internal.EndpointFactoryWithUnderlying
 179{
 180    public EndpointFactoryI(Instance instance, short type)
 181        : base(instance, type) => _instance = instance;
 182
 183    public override Ice.Internal.EndpointFactory
 184    cloneWithUnderlying(Ice.Internal.ProtocolInstance instance, short underlying) =>
 185        new EndpointFactoryI(new Instance(_instance.engine(), instance.type(), instance.protocol()), underlying);
 186
 187    protected override Ice.Internal.EndpointI
 188    createWithUnderlying(Ice.Internal.EndpointI underlying, List<string> args, bool oaEndpoint) =>
 189        new EndpointI(_instance, underlying);
 190
 191    protected override Ice.Internal.EndpointI
 192    readWithUnderlying(Ice.Internal.EndpointI underlying, Ice.InputStream s) => new EndpointI(_instance, underlying);
 193
 194    private readonly Instance _instance;
 195}