< Summary

Information
Class: Ice.SSL.EndpointFactoryI
Assembly: Ice
File(s): /home/runner/work/ice/ice/csharp/src/Ice/SSL/EndpointI.cs
Tag: 71_18251537082
Line coverage
100%
Covered lines: 4
Uncovered lines: 0
Coverable lines: 4
Total lines: 195
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage
100%
Covered methods: 4
Total methods: 4
Method coverage: 100%

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
cloneWithUnderlying(...)100%11100%
createWithUnderlying(...)100%11100%
readWithUnderlying(...)100%11100%

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{
 9    internal EndpointI(Instance instance, Ice.Internal.EndpointI del)
 10    {
 11        _instance = instance;
 12        _delegate = del;
 13    }
 14
 15    public override void streamWriteImpl(Ice.OutputStream os) => _delegate.streamWriteImpl(os);
 16
 17    public override Ice.EndpointInfo getInfo() => new EndpointInfo(_delegate.getInfo());
 18
 19    public override short type() => _delegate.type();
 20
 21    public override string protocol() => _delegate.protocol();
 22
 23    public override int timeout() => _delegate.timeout();
 24
 25    public override Ice.Internal.EndpointI timeout(int timeout)
 26    {
 27        if (timeout == _delegate.timeout())
 28        {
 29            return this;
 30        }
 31        else
 32        {
 33            return new EndpointI(_instance, _delegate.timeout(timeout));
 34        }
 35    }
 36
 37    public override string connectionId() => _delegate.connectionId();
 38
 39    public override Ice.Internal.EndpointI connectionId(string connectionId)
 40    {
 41        if (connectionId.Equals(_delegate.connectionId(), StringComparison.Ordinal))
 42        {
 43            return this;
 44        }
 45        else
 46        {
 47            return new EndpointI(_instance, _delegate.connectionId(connectionId));
 48        }
 49    }
 50
 51    public override bool compress() => _delegate.compress();
 52
 53    public override Ice.Internal.EndpointI compress(bool compress)
 54    {
 55        if (compress == _delegate.compress())
 56        {
 57            return this;
 58        }
 59        else
 60        {
 61            return new EndpointI(_instance, _delegate.compress(compress));
 62        }
 63    }
 64
 65    public override bool datagram() => _delegate.datagram();
 66
 67    public override bool secure() => _delegate.secure();
 68
 69    public override Ice.Internal.Transceiver transceiver() => null;
 70
 71    private sealed class EndpointI_connectorsI : Ice.Internal.EndpointI_connectors
 72    {
 73        public EndpointI_connectorsI(Instance instance, string host, Ice.Internal.EndpointI_connectors cb)
 74        {
 75            _instance = instance;
 76            _host = host;
 77            _callback = cb;
 78        }
 79
 80        public void connectors(List<Ice.Internal.Connector> connectors)
 81        {
 82            var l = new List<Ice.Internal.Connector>();
 83            foreach (Ice.Internal.Connector c in connectors)
 84            {
 85                l.Add(new ConnectorI(_instance, c, _host));
 86            }
 87            _callback.connectors(l);
 88        }
 89
 90        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    {
 99        string host = "";
 100        for (Ice.EndpointInfo p = _delegate.getInfo(); p != null; p = p.underlying)
 101        {
 102            if (p is Ice.IPEndpointInfo info)
 103            {
 104                host = info.host;
 105                break;
 106            }
 107        }
 108        _delegate.connectors_async(new EndpointI_connectorsI(_instance, host, callback));
 109    }
 110
 111    public override Ice.Internal.Acceptor acceptor(
 112        string adapterName,
 113        SslServerAuthenticationOptions authenticationOptions) =>
 114        new AcceptorI(
 115            this,
 116            _instance,
 117            _delegate.acceptor(adapterName, null),
 118            adapterName,
 119            authenticationOptions);
 120
 121    public EndpointI endpoint(Ice.Internal.EndpointI del)
 122    {
 123        if (del == _delegate)
 124        {
 125            return this;
 126        }
 127        else
 128        {
 129            return new EndpointI(_instance, del);
 130        }
 131    }
 132
 133    public override List<Internal.EndpointI> expandHost() =>
 134        _delegate.expandHost().Select(e => endpoint(e) as Internal.EndpointI).ToList();
 135
 136    public override bool isLoopbackOrMulticast() => _delegate.isLoopbackOrMulticast();
 137
 138    public override EndpointI toPublishedEndpoint(string publishedHost) =>
 139        endpoint(_delegate.toPublishedEndpoint(publishedHost));
 140
 141    public override bool equivalent(Ice.Internal.EndpointI endpoint)
 142    {
 143        if (endpoint is not EndpointI)
 144        {
 145            return false;
 146        }
 147        var endpointI = (EndpointI)endpoint;
 148        return _delegate.equivalent(endpointI._delegate);
 149    }
 150
 151    public override string options() => _delegate.options();
 152
 153    // Compare endpoints for sorting purposes
 154    public override int CompareTo(Ice.Internal.EndpointI obj)
 155    {
 156        if (obj is not EndpointI)
 157        {
 158            return type() < obj.type() ? -1 : 1;
 159        }
 160
 161        var p = (EndpointI)obj;
 162        if (this == p)
 163        {
 164            return 0;
 165        }
 166
 167        return _delegate.CompareTo(p._delegate);
 168    }
 169
 170    public override int GetHashCode() => _delegate.GetHashCode();
 171
 172    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)
 1181        : base(instance, type) => _instance = instance;
 182
 183    public override Ice.Internal.EndpointFactory
 184    cloneWithUnderlying(Ice.Internal.ProtocolInstance instance, short underlying) =>
 1185        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) =>
 1189        new EndpointI(_instance, underlying);
 190
 191    protected override Ice.Internal.EndpointI
 1192    readWithUnderlying(Ice.Internal.EndpointI underlying, Ice.InputStream s) => new EndpointI(_instance, underlying);
 193
 194    private readonly Instance _instance;
 195}