コード例 #1
0
        public void GetRequest_Query_Should_Use_Serial_Consistency_From_Statement()
        {
            const ConsistencyLevel expectedSerialConsistencyLevel = ConsistencyLevel.LocalSerial;
            var statement = new SimpleStatement("QUERY");

            statement.SetSerialConsistencyLevel(expectedSerialConsistencyLevel);

            var config = new Configuration();

            config.QueryOptions.SetSerialConsistencyLevel(ConsistencyLevel.Serial);

            var request    = RequestHandler.GetRequest(statement, Serializer, config);
            var bodyBuffer = GetBodyBuffer(request);

            // The query request is composed by:
            // <query><consistency><flags><result_page_size><paging_state><serial_consistency><timestamp>
            // Skip the query and consistency (2)
            var offset = 4 + statement.QueryString.Length + 2;
            var flags  = GetQueryFlags(bodyBuffer, ref offset);

            Assert.True(flags.HasFlag(QueryFlags.WithDefaultTimestamp));
            Assert.True(flags.HasFlag(QueryFlags.PageSize));
            // Skip result_page_size (4)
            offset += 4;
            Assert.That((ConsistencyLevel)BeConverter.ToInt16(bodyBuffer, offset), Is.EqualTo(expectedSerialConsistencyLevel));
        }
コード例 #2
0
 public void RequestHandler_GetRequest_SimpleStatement_Statement_Level_Settings_Are_Used()
 {
     var stmt = new SimpleStatement("DUMMY QUERY");
     stmt.SetConsistencyLevel(ConsistencyLevel.EachQuorum);
     stmt.SetPageSize(350);
     stmt.SetSerialConsistencyLevel(ConsistencyLevel.LocalSerial);
     Assert.AreEqual(350, stmt.PageSize);
     Assert.AreEqual(ConsistencyLevel.EachQuorum, stmt.ConsistencyLevel);
     Assert.AreEqual(ConsistencyLevel.LocalSerial, stmt.SerialConsistencyLevel);
     var request = (QueryRequest)RequestHandler<RowSet>.GetRequest(stmt, 2, GetConfig());
     Assert.AreEqual(350, request.PageSize);
     Assert.AreEqual(ConsistencyLevel.EachQuorum, request.Consistency);
     Assert.AreEqual(ConsistencyLevel.LocalSerial, request.SerialConsistency);
 }
コード例 #3
0
 public void SimpleStatement_Statement_Level_Settings_Are_Used()
 {
     var stmt = new SimpleStatement("DUMMY QUERY");
     stmt.SetConsistencyLevel(ConsistencyLevel.EachQuorum);
     stmt.SetPageSize(350);
     stmt.SetSerialConsistencyLevel(ConsistencyLevel.LocalSerial);
     Assert.AreEqual(350, stmt.PageSize);
     Assert.AreEqual(ConsistencyLevel.EachQuorum, stmt.ConsistencyLevel);
     Assert.AreEqual(ConsistencyLevel.LocalSerial, stmt.SerialConsistencyLevel);
     var session = GetInstance();
     var request = (QueryRequest)session.GetRequest(stmt);
     Assert.AreEqual(350, request.PageSize);
     Assert.AreEqual(ConsistencyLevel.EachQuorum, request.Consistency);
     Assert.AreEqual(ConsistencyLevel.LocalSerial, request.SerialConsistency);
 }
コード例 #4
0
        public void RequestHandler_GetRequest_SimpleStatement_Statement_Level_Settings_Are_Used()
        {
            var stmt = new SimpleStatement("DUMMY QUERY");

            stmt.SetConsistencyLevel(ConsistencyLevel.EachQuorum);
            stmt.SetPageSize(350);
            stmt.SetSerialConsistencyLevel(ConsistencyLevel.LocalSerial);
            Assert.AreEqual(350, stmt.PageSize);
            Assert.AreEqual(ConsistencyLevel.EachQuorum, stmt.ConsistencyLevel);
            Assert.AreEqual(ConsistencyLevel.LocalSerial, stmt.SerialConsistencyLevel);
            var request = (QueryRequest)RequestHandler.GetRequest(stmt, Serializer, GetConfig());

            Assert.AreEqual(350, request.PageSize);
            Assert.AreEqual(ConsistencyLevel.EachQuorum, request.Consistency);
            Assert.AreEqual(ConsistencyLevel.LocalSerial, request.SerialConsistency);
        }
コード例 #5
0
        public void SimpleStatement_Statement_Level_Settings_Are_Used()
        {
            var stmt = new SimpleStatement("DUMMY QUERY");

            stmt.SetConsistencyLevel(ConsistencyLevel.EachQuorum);
            stmt.SetPageSize(350);
            stmt.SetSerialConsistencyLevel(ConsistencyLevel.LocalSerial);
            Assert.AreEqual(350, stmt.PageSize);
            Assert.AreEqual(ConsistencyLevel.EachQuorum, stmt.ConsistencyLevel);
            Assert.AreEqual(ConsistencyLevel.LocalSerial, stmt.SerialConsistencyLevel);
            var session = GetInstance();
            var request = (QueryRequest)session.GetRequest(stmt);

            Assert.AreEqual(350, request.PageSize);
            Assert.AreEqual(ConsistencyLevel.EachQuorum, request.Consistency);
            Assert.AreEqual(ConsistencyLevel.LocalSerial, request.SerialConsistency);
        }