Exemple #1
0
        /// <summary>
        ///		After top reader returned last data item in a file
        /// </summary>
        private void OnTopReaderFileFinished()
        {
            if (!this.TopReader.EndReached)
            {
                if (_onlineQueue.First.Next == null ||
                    TimestampComparer.Compare(
                        _onlineQueue.First.Next.Value.CurrentItem.DateTime
                        , TopReader.NextFileFirstTimestampToRead.Value) >= 0)
                {
                    // there's no next reader or it contains older or equal item as the first item in
                    // the top reader's next file
                    // second in the queue must remain second; load next data file in the top reader
                    TopReader.LoadNextFile();

                    // update may be required because if data item timestamps are equal the DataItemComparer may change the order
                    UpdateTopReaderPosition();
                }
                else
                {
                    // second reader is present and it has to move to the top
                    MoveTopReaderToOfflineQueue();
                }
            }
            else
            {
                MoveTopReaderToExhaustedList();
            }
        }
 public void Compare_Right()
 {
     TimestampComparer target = new TimestampComparer();
     string leftFilename = "db_tbl_20111111111111.sql";
     string rightFilename = "db_tbl_20111212121212.sql";
     int expected = -1;
     int actual;
     actual = target.Compare(leftFilename, rightFilename);
     Assert.AreEqual(expected, actual);
 }
 public void Compare_Empty()
 {
     TimestampComparer target = new TimestampComparer();
     string leftFilename = string.Empty;
     string rightFilename = string.Empty;
     int expected = 0;
     int actual;
     actual = target.Compare(leftFilename, rightFilename);
     Assert.AreEqual(expected, actual);
 }