示例#1
0
        public void PooledConnectionProvider()
        {
            // arrange
            var expected         = typeof(PooledConnectionProvider);
            var connectionString = "Keyspace=Testing;Pooled=True";

            // act
            var result = new ConnectionBuilder(connectionString);
            var actual = ConnectionProviderFactory.Get(result).GetType();

            // assert
            Assert.AreEqual(expected, actual);
        }
示例#2
0
        public void NormalConnectionProvider()
        {
            // arrange
            var expected         = typeof(NormalConnectionProvider);
            var connectionString = "Keyspace=" + ConfigurationManager.AppSettings["TestKeySpace"];

            // act
            var result = new ConnectionBuilder(connectionString);
            var actual = ConnectionProviderFactory.Get(result).GetType();

            // assert
            Assert.Equal(expected, actual);
        }
        public void Fails_Over()
        {
            // arrange
            var expectedHost = "127.0.0.1";
            var expectedPort = Server.DefaultPort;

            // act
            var result     = new ConnectionBuilder(FailoverConnectionString);
            var provider   = ConnectionProviderFactory.Get(result);
            var conn       = provider.Open();
            var actualHost = conn.Server.Host;
            var actualPort = conn.Server.Port;

            // assert
            Assert.AreEqual(expectedHost, actualHost);
            Assert.AreEqual(expectedPort, actualPort);
        }
        public void Fails_Over()
        {
            // arrange
            var expectedHost = ConfigurationManager.AppSettings["TestServer"];
            var expectedPort = Convert.ToInt16(ConfigurationManager.AppSettings["TestPort"]);

            // act
            var result     = new ConnectionBuilder(_failoverConnectionString);
            var provider   = ConnectionProviderFactory.Get(result);
            var conn       = provider.Open();
            var actualHost = conn.Server.Host;
            var actualPort = conn.Server.Port;

            // assert
            Assert.Equal(expectedHost, actualHost);
            Assert.Equal(expectedPort, actualPort);
        }
示例#5
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="connectionBuilder"></param>
 public CassandraSession(IConnectionBuilder connectionBuilder)
     : this(ConnectionProviderFactory.Get(connectionBuilder), connectionBuilder.ReadConsistency, connectionBuilder.WriteConsistency)
 {
 }
 public CassandraSession(ConsistencyLevel read, ConsistencyLevel write)
     : this(ConnectionProviderFactory.Get(CassandraContext.CurrentConnectionBuilder), read, write)
 {
 }
示例#7
0
 protected AbstractService()
 {
     Factory = new ConnectionProviderFactory(ApplicationConfigurationHelper.GetOracleConnectionString());
     Ninject = new StandardKernel();
     Ninject.Bind <ConnectionProvider>().ToMethod(context => Factory.Get());
 }