// methods public ICluster BuildCluster() { IStreamFactory streamFactory = new TcpStreamFactory(_tcpStreamSettings); // TODO: SSL gets handled here specifically... streamFactory = _streamFactoryWrapper(streamFactory); var connectionFactory = new BinaryConnectionFactory( _connectionSettings, streamFactory, _connectionListener); var connectionPoolFactory = new ExclusiveConnectionPoolFactory( _connectionPoolSettings, connectionFactory, _connectionPoolListener); var serverFactory = new ServerFactory( _serverSettings, connectionPoolFactory, connectionFactory, _serverListener); var clusterFactory = new ClusterFactory( _clusterSettings, serverFactory, _clusterListener); return clusterFactory.CreateCluster(); }
public void CreateServer_should_throw_if_clusterId_is_null() { var subject = new ServerFactory(_clusterConnectionMode, _settings, _connectionPoolFactory, _serverMonitorFactory, _eventSubscriber); Action act = () => subject.CreateServer(null, _endPoint); act.ShouldThrow<ArgumentNullException>(); }
// methods private ICluster CreateCluster(ClusterKey clusterKey) { var clusterSettings = CreateClusterSettings(clusterKey); var serverSettings = CreateServerSettings(clusterKey); var connectionSettings = CreateConnectionSettings(clusterKey); var connectionPoolSettings = CreateConnectionPoolSettings(clusterKey); var listener = EmptyListener.Instance; var streamFactory = CreateStreamFactory(clusterKey); var connectionFactory = new BinaryConnectionFactory(connectionSettings, streamFactory, listener); var connectionPoolFactory = new ExclusiveConnectionPoolFactory(connectionPoolSettings, connectionFactory, listener); var serverFactory = new ServerFactory(serverSettings, connectionPoolFactory, connectionFactory, listener); var clusterFactory = new ClusterFactory(clusterSettings, serverFactory, listener); var cluster = clusterFactory.CreateCluster(); cluster.Initialize(); return cluster; }
public void CreateServer_should_throw_if_clusterId_is_null() { var subject = new ServerFactory(_settings, _connectionPoolFactory, _heartbeatConnectionFactory, _listener); Action act = () => subject.CreateServer(null, _endPoint); act.ShouldThrow<ArgumentNullException>(); }
public void CreateServer_should_return_Server() { var subject = new ServerFactory(_settings, _connectionPoolFactory, _heartbeatConnectionFactory, _listener); var result = subject.CreateServer(_clusterId, _endPoint); result.Should().NotBeNull(); result.Should().BeOfType<ClusterableServer>(); }
public void CreateServer_should_return_Server() { var subject = new ServerFactory(_clusterConnectionMode, _settings, _connectionPoolFactory, _serverMonitorFactory, _eventSubscriber); var result = subject.CreateServer(_clusterId, _endPoint); result.Should().NotBeNull(); result.Should().BeOfType<Server>(); }