Beispiel #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void latestLogFileContainingACheckPointAndAStartBefore()
        public virtual void LatestLogFileContainingACheckPointAndAStartBefore()
        {
            // given
            SetupLogFiles(LogFile(Start(), CheckPoint()));

            // when
            LogTailInformation logTailInformation = _tailScanner.TailInformation;

            // then
            AssertLatestCheckPoint(true, false, NO_TRANSACTION_ID, _endLogVersion, logTailInformation);
        }
Beispiel #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void bigFileLatestCheckpointFindsStartAfter() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void BigFileLatestCheckpointFindsStartAfter()
        {
            long firstTxAfterCheckpoint = int.MaxValue + 4L;

            LogTailScanner     tailScanner        = new FirstTxIdConfigurableTailScanner(firstTxAfterCheckpoint, _logFiles, _reader, _monitors);
            LogEntryStart      startEntry         = new LogEntryStart(1, 2, 3L, 4L, new sbyte[] { 5, 6 }, new LogPosition(_endLogVersion, int.MaxValue + 17L));
            CheckPoint         checkPoint         = new CheckPoint(new LogPosition(_endLogVersion, 16L));
            LogTailInformation logTailInformation = tailScanner.CheckpointTailInformation(_endLogVersion, startEntry, _endLogVersion, _latestLogEntryVersion, checkPoint, false);

            AssertLatestCheckPoint(true, true, firstTxAfterCheckpoint, _endLogVersion, logTailInformation);
        }
Beispiel #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void latestLogFileContainingMultipleCheckPointsOneStartInBetween()
        public virtual void LatestLogFileContainingMultipleCheckPointsOneStartInBetween()
        {
            // given
            SetupLogFiles(LogFile(CheckPoint(), Start(), CheckPoint()));

            // when
            LogTailInformation logTailInformation = _tailScanner.TailInformation;

            // then
            AssertLatestCheckPoint(true, false, NO_TRANSACTION_ID, _endLogVersion, logTailInformation);
        }
Beispiel #4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void twoLogFilesNoCheckPointsOneStartWithoutCommit()
        public virtual void TwoLogFilesNoCheckPointsOneStartWithoutCommit()
        {
            // given
            SetupLogFiles(LogFile(), LogFile(Start()));

            // when
            LogTailInformation logTailInformation = _tailScanner.TailInformation;

            // then
            AssertLatestCheckPoint(false, true, NO_TRANSACTION_ID, _startLogVersion, logTailInformation);
        }
Beispiel #5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void oneLogFileNoCheckPoints()
        public virtual void OneLogFileNoCheckPoints()
        {
            // given
            SetupLogFiles(LogFile());

            // when
            LogTailInformation logTailInformation = _tailScanner.TailInformation;

            // then
            AssertLatestCheckPoint(false, true, NO_TRANSACTION_ID, _endLogVersion, logTailInformation);
        }
Beispiel #6
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void noLogFilesFound()
        public virtual void NoLogFilesFound()
        {
            // given no files
            SetupLogFiles();

            // when
            LogTailInformation logTailInformation = _tailScanner.TailInformation;

            // then
            AssertLatestCheckPoint(false, false, NO_TRANSACTION_ID, -1, logTailInformation);
        }
Beispiel #7
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void latestLogEmptyStartEntryBeforeAndAfterCheckPointInTheLastButOneLog()
        public virtual void LatestLogEmptyStartEntryBeforeAndAfterCheckPointInTheLastButOneLog()
        {
            // given
            long txId = 432;

            SetupLogFiles(LogFile(Start(), CheckPoint(), Start(), Commit(txId)), LogFile());

            // when
            LogTailInformation logTailInformation = _tailScanner.TailInformation;

            // then
            AssertLatestCheckPoint(true, true, txId, _startLogVersion, logTailInformation);
        }
Beispiel #8
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void twoLogFilesStartAndCommitInDifferentFiles()
        public virtual void TwoLogFilesStartAndCommitInDifferentFiles()
        {
            // given
            long txId = 6;

            SetupLogFiles(LogFile(Start()), LogFile(Commit(txId)));

            // when
            LogTailInformation logTailInformation = _tailScanner.TailInformation;

            // then
            AssertLatestCheckPoint(false, true, 6, _startLogVersion, logTailInformation);
        }
Beispiel #9
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void twoLogFilesNoCheckPointsTwoCommits()
        public virtual void TwoLogFilesNoCheckPointsTwoCommits()
        {
            // given
            long txId = 21;

            SetupLogFiles(LogFile(), LogFile(Start(), Commit(txId), Start(), Commit(txId + 1)));

            // when
            LogTailInformation logTailInformation = _tailScanner.TailInformation;

            // then
            AssertLatestCheckPoint(false, true, txId, _startLogVersion, logTailInformation);
        }
Beispiel #10
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void oneLogFileNoCheckPointsOneStart()
        public virtual void OneLogFileNoCheckPointsOneStart()
        {
            // given
            long txId = 10;

            SetupLogFiles(LogFile(Start(), Commit(txId)));

            // when
            LogTailInformation logTailInformation = _tailScanner.TailInformation;

            // then
            AssertLatestCheckPoint(false, true, txId, _endLogVersion, logTailInformation);
        }
Beispiel #11
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void olderLogFileContainingAStartAndNewerFileContainingACheckPointPointingToALaterPositionThanStart()
        public virtual void OlderLogFileContainingAStartAndNewerFileContainingACheckPointPointingToALaterPositionThanStart()
        {
            // given
            PositionEntry position = position();

            SetupLogFiles(LogFile(Start(), Commit(3), position), LogFile(CheckPoint(position)));

            // when
            LogTailInformation logTailInformation = _tailScanner.TailInformation;

            // then
            AssertLatestCheckPoint(true, false, NO_TRANSACTION_ID, _endLogVersion, logTailInformation);
        }
Beispiel #12
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void olderLogFileContainingACheckPointAndNewerFileIsEmpty()
        public virtual void OlderLogFileContainingACheckPointAndNewerFileIsEmpty()
        {
            // given
            StartEntry start = start();

            SetupLogFiles(LogFile(start, CheckPoint()), LogFile());

            // when
            LogTailInformation logTailInformation = _tailScanner.TailInformation;

            // then
            AssertLatestCheckPoint(true, true, NO_TRANSACTION_ID, _startLogVersion, logTailInformation);
        }
Beispiel #13
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void olderLogFileContainingAStartAndNewerFileContainingACheckPointPointingToAPreviousPositionThanStartWithoutCommit()
        public virtual void OlderLogFileContainingAStartAndNewerFileContainingACheckPointPointingToAPreviousPositionThanStartWithoutCommit()
        {
            // given
            StartEntry start = start();

            SetupLogFiles(LogFile(start), LogFile(CheckPoint(start)));

            // when
            LogTailInformation logTailInformation = _tailScanner.TailInformation;

            // then
            AssertLatestCheckPoint(true, false, NO_TRANSACTION_ID, _endLogVersion, logTailInformation);
        }
Beispiel #14
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void latestLogFileContainingMultipleCheckPointsOneStartAfterBoth()
        public virtual void LatestLogFileContainingMultipleCheckPointsOneStartAfterBoth()
        {
            // given
            long txId = 11;

            SetupLogFiles(LogFile(CheckPoint(), CheckPoint(), Start(), Commit(txId)));

            // when
            LogTailInformation logTailInformation = _tailScanner.TailInformation;

            // then
            AssertLatestCheckPoint(true, true, txId, _endLogVersion, logTailInformation);
        }
Beispiel #15
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void latestLogFileContainingACheckPointAndAStartWithoutCommitAfter()
        public virtual void LatestLogFileContainingACheckPointAndAStartWithoutCommitAfter()
        {
            // given
            StartEntry start = start();

            SetupLogFiles(LogFile(start, CheckPoint(start)));

            // when
            LogTailInformation logTailInformation = _tailScanner.TailInformation;

            // then
            AssertLatestCheckPoint(true, true, NO_TRANSACTION_ID, _endLogVersion, logTailInformation);
        }
Beispiel #16
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void twoLogFilesSecondIsCorruptedBeforeCommit() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void TwoLogFilesSecondIsCorruptedBeforeCommit()
        {
            SetupLogFiles(LogFile(CheckPoint()), LogFile(Start(), Commit(2)));

            File highestLogFile = _logFiles.HighestLogFile;

            _fsRule.truncate(highestLogFile, _fsRule.getFileSize(highestLogFile) - 3);

            // when
            LogTailInformation logTailInformation = _tailScanner.TailInformation;

            // then
            AssertLatestCheckPoint(true, true, NO_TRANSACTION_ID, _startLogVersion, logTailInformation);
        }
Beispiel #17
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void olderLogFileContainingAStartAndNewerFileContainingACheckPointPointingToAPreviousPositionThanStart()
        public virtual void OlderLogFileContainingAStartAndNewerFileContainingACheckPointPointingToAPreviousPositionThanStart()
        {
            // given
            long       txId  = 123;
            StartEntry start = start();

            SetupLogFiles(LogFile(start, Commit(txId)), LogFile(CheckPoint(start)));

            // when
            LogTailInformation logTailInformation = _tailScanner.TailInformation;

            // then
            AssertLatestCheckPoint(true, true, txId, _endLogVersion, logTailInformation);
        }
Beispiel #18
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void twoLogFilesCheckPointTargetsPrevious()
        public virtual void TwoLogFilesCheckPointTargetsPrevious()
        {
            // given
            long          txId     = 6;
            PositionEntry position = position();

            SetupLogFiles(LogFile(Start(), Commit(txId - 1), position), LogFile(Start(), Commit(txId)), LogFile(CheckPoint(position)));

            // when
            LogTailInformation logTailInformation = _tailScanner.TailInformation;

            // then
            AssertLatestCheckPoint(true, true, txId, _endLogVersion, logTailInformation);
        }
Beispiel #19
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void latestLogFileContainingACheckPointAndAStartAfter()
        public virtual void LatestLogFileContainingACheckPointAndAStartAfter()
        {
            // given
            long       txId  = 35;
            StartEntry start = start();

            SetupLogFiles(LogFile(start, Commit(txId), CheckPoint(start)));

            // when
            LogTailInformation logTailInformation = _tailScanner.TailInformation;

            // then
            AssertLatestCheckPoint(true, true, txId, _endLogVersion, logTailInformation);
        }
Beispiel #20
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void twoLogFilesSecondIsCorruptedBeforeAfterCommit() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void TwoLogFilesSecondIsCorruptedBeforeAfterCommit()
        {
            int firstTxId = 2;

            SetupLogFiles(LogFile(CheckPoint()), LogFile(Start(), Commit(firstTxId), Start(), Commit(3)));

            File highestLogFile = _logFiles.HighestLogFile;

            _fsRule.truncate(highestLogFile, _fsRule.getFileSize(highestLogFile) - 3);

            // when
            LogTailInformation logTailInformation = _tailScanner.TailInformation;

            // then
            AssertLatestCheckPoint(true, true, firstTxId, _startLogVersion, logTailInformation);
        }
Beispiel #21
0
 private void AssertLatestCheckPoint(bool hasCheckPointEntry, bool commitsAfterLastCheckPoint, long firstTxIdAfterLastCheckPoint, long logVersion, LogTailInformation logTailInformation)
 {
     assertEquals(hasCheckPointEntry, logTailInformation.LastCheckPoint != null);
     assertEquals(commitsAfterLastCheckPoint, logTailInformation.CommitsAfterLastCheckpoint());
     if (commitsAfterLastCheckPoint)
     {
         assertEquals(firstTxIdAfterLastCheckPoint, logTailInformation.FirstTxIdAfterLastCheckPoint);
     }
     assertEquals(logVersion, logTailInformation.OldestLogVersionFound);
 }