Beispiel #1
0
        private void DoSimpleStatementInsertTest(ConsistencyLevel expectedConsistencyLevel)
        {
            string          simpleStatementStr = GetSimpleStatementInsertString(ManyDataTypesEntity.GetRandomInstance());
            SimpleStatement simpleStatement    = new SimpleStatement(simpleStatementStr);

            simpleStatement = (SimpleStatement)simpleStatement.SetConsistencyLevel(expectedConsistencyLevel);
            var result = _session.Execute(simpleStatement);

            Assert.AreEqual(expectedConsistencyLevel, result.Info.AchievedConsistency);

            var selectResult = _session.Execute(_defaultSelectStatement);

            Assert.AreEqual(_defaultPocoList.Count + 1, selectResult.GetRows().ToList().Count);
        }
Beispiel #2
0
        public void Consistency_SimpleStatement_Serial_Insert_Success()
        {
            SetupSessionAndCluster(_defaultNodeCountOne);
            string          simpleStatementStr = GetSimpleStatementInsertString(ManyDataTypesEntity.GetRandomInstance());
            SimpleStatement simpleStatement    = new SimpleStatement(simpleStatementStr);

            simpleStatement = (SimpleStatement)simpleStatement.SetConsistencyLevel(ConsistencyLevel.Quorum).SetSerialConsistencyLevel(ConsistencyLevel.Serial);
            var result = _session.Execute(simpleStatement);

            Assert.AreEqual(ConsistencyLevel.Quorum, result.Info.AchievedConsistency);

            var selectResult = _session.Execute(_defaultSelectStatement);

            Assert.AreEqual(_defaultPocoList.Count + 1, selectResult.GetRows().ToList().Count);
        }
Beispiel #3
0
        private void DoPreparedInsertTest(ConsistencyLevel expectedConsistencyLevel)
        {
            ManyDataTypesEntity mdtp = ManyDataTypesEntity.GetRandomInstance();

            object[] vals = ConvertEntityToObjectArray(mdtp);

            // NOTE: We have to re-prepare every time since there is a unique Keyspace used for every test
            PreparedStatement preparedInsertStatement = _session.Prepare(_preparedInsertStatementAsString).SetConsistencyLevel(expectedConsistencyLevel);
            BoundStatement    boundStatement          = preparedInsertStatement.Bind(vals);
            var result = _session.Execute(boundStatement);

            Assert.AreEqual(expectedConsistencyLevel, result.Info.AchievedConsistency);

            var selectResult = _session.Execute(_defaultSelectStatement);

            Assert.AreEqual(_defaultPocoList.Count + 1, selectResult.GetRows().ToList().Count);
        }
Beispiel #4
0
        public void Consistency_PreparedStatement_Serial_Insert_Success()
        {
            ManyDataTypesEntity mdtp = ManyDataTypesEntity.GetRandomInstance();

            object[] vals = ConvertEntityToObjectArray(mdtp);
            SetupSessionAndCluster(_defaultNodeCountOne);

            PreparedStatement preparedInsertStatement = _session.Prepare(_preparedInsertStatementAsString);
            BoundStatement    boundStatement          = preparedInsertStatement.SetConsistencyLevel(ConsistencyLevel.Quorum).Bind(vals);

            boundStatement.SetSerialConsistencyLevel(ConsistencyLevel.Serial);
            var result = _session.Execute(boundStatement);

            Assert.AreEqual(ConsistencyLevel.Quorum, result.Info.AchievedConsistency);

            var selectResult = _session.Execute(_defaultSelectStatement);

            Assert.AreEqual(_defaultPocoList.Count + 1, selectResult.GetRows().ToList().Count);
        }