Class LogFileCollectorTest

java.lang.Object
io.debezium.connector.oracle.logminer.LogFileCollectorTest

public class LogFileCollectorTest extends Object
Unit tests for the LogFileCollector class.
Author:
Chris Cranford
  • Field Details

    • skipRule

      public org.junit.rules.TestRule skipRule
    • currentQueryRow

      private int currentQueryRow
  • Constructor Details

    • LogFileCollectorTest

      public LogFileCollectorTest()
  • Method Details

    • testStandaloneLogStateWithOneThreadArchiveLogGap

      public void testStandaloneLogStateWithOneThreadArchiveLogGap() throws Exception
      Throws:
      Exception
    • testStandaloneLogStateWithNoGaps

      public void testStandaloneLogStateWithNoGaps() throws Exception
      Throws:
      Exception
    • testStandaloneLogStateWithJustOnlineLogs

      public void testStandaloneLogStateWithJustOnlineLogs() throws Exception
      Throws:
      Exception
    • testStandaloneLogStateWithMixOfArchiveAndRedoNoGaps

      public void testStandaloneLogStateWithMixOfArchiveAndRedoNoGaps() throws Exception
      Throws:
      Exception
    • testRacLogStateWithOneThreadArchiveLogGap

      public void testRacLogStateWithOneThreadArchiveLogGap() throws Exception
      Throws:
      Exception
    • testRacLogStateWithNoGaps

      public void testRacLogStateWithNoGaps() throws Exception
      Throws:
      Exception
    • testRacLogStateWithJustOnlineLogs

      public void testRacLogStateWithJustOnlineLogs() throws Exception
      Throws:
      Exception
    • testRacLogStateWithMixOfArchiveAndRedoNoGaps

      public void testRacLogStateWithMixOfArchiveAndRedoNoGaps() throws Exception
      Throws:
      Exception
    • testRacLogStateWithMixOfArchiveAndRedoForBothThreadsNoGap

      public void testRacLogStateWithMixOfArchiveAndRedoForBothThreadsNoGap() throws Exception
      Throws:
      Exception
    • testOracleRacWithRealDataRedoThreadsWithIndependentSequenceRanges

      @FixFor("DBZ-7158") public void testOracleRacWithRealDataRedoThreadsWithIndependentSequenceRanges() throws Exception
      Throws:
      Exception
    • testOracleLogDeduplicationDoesNotCreateLogSequenceGaps

      @FixFor("DBZ-7345") public void testOracleLogDeduplicationDoesNotCreateLogSequenceGaps() throws Exception
      Throws:
      Exception
    • testLogsWithRegularScns

      @FixFor("DBZ-2855") public void testLogsWithRegularScns() throws Exception
      Throws:
      Exception
    • testExcludeLogsBeforeOffsetScn

      @FixFor("DBZ-2855") public void testExcludeLogsBeforeOffsetScn() throws Exception
      Throws:
      Exception
    • testNullsHandledAsMaxScn

      @FixFor("DBZ-2855") public void testNullsHandledAsMaxScn() throws Exception
      Throws:
      Exception
    • testCanHandleMaxScn

      @FixFor("DBZ-2855") public void testCanHandleMaxScn() throws Exception
      Throws:
      Exception
    • testCanHandleVeryLargeScnValuesInNonCurrentRedoLog

      @FixFor("DBZ-2855") public void testCanHandleVeryLargeScnValuesInNonCurrentRedoLog() throws Exception
      Throws:
      Exception
    • testRacMultipleNodesNoThreadStateChanges

      @FixFor("DBZ-7389") public void testRacMultipleNodesNoThreadStateChanges() throws Exception
      Throws:
      Exception
    • testRacMultipleNodesOneThreadChangesToClosed

      @FixFor("DBZ-7389") public void testRacMultipleNodesOneThreadChangesToClosed() throws Exception
      Throws:
      Exception
    • testRacMultipleNodesOneThreadChangesToOpen

      @FixFor("DBZ-7389") public void testRacMultipleNodesOneThreadChangesToOpen() throws Exception
      Throws:
      Exception
    • testRacMultipleNodesOpenedAndAddNewNodeInClosedStateEnabled

      @FixFor("DBZ-7389") public void testRacMultipleNodesOpenedAndAddNewNodeInClosedStateEnabled() throws Exception
      Throws:
      Exception
    • testRacMultipleNodesOpenedAndAddNewNodeInOpened

      @FixFor("DBZ-7389") public void testRacMultipleNodesOpenedAndAddNewNodeInOpened() throws Exception
      Throws:
      Exception
    • createRedoLog

      private static io.debezium.connector.oracle.logminer.LogFile createRedoLog(String name, long startScn, int sequence, int threadId)
    • createRedoLog

      private static io.debezium.connector.oracle.logminer.LogFile createRedoLog(String name, long startScn, long endScn, int sequence, int threadId)
    • createRedoLog

      private static io.debezium.connector.oracle.logminer.LogFile createRedoLog(String name, String startScn, String endScn, int sequence, int threadId)
    • createRedoLog

      private static io.debezium.connector.oracle.logminer.LogFile createRedoLog(String name, String startScn, String endScn, int sequence, boolean current, int threadId)
    • createRedoLog

      private static io.debezium.connector.oracle.logminer.LogFile createRedoLog(String name, long startScn, long endScn, int sequence, int threadId, boolean current)
    • createRedoLogWithNullEndScn

      private static io.debezium.connector.oracle.logminer.LogFile createRedoLogWithNullEndScn(String name, long startScn, int sequence, int threadId)
    • createArchiveLog

      private static io.debezium.connector.oracle.logminer.LogFile createArchiveLog(String name, long startScn, long endScn, int sequence, int threadId)
    • getLogFileWithName

      private io.debezium.connector.oracle.logminer.LogFile getLogFileWithName(List<io.debezium.connector.oracle.logminer.LogFile> logs, String fileName)
    • getDefaultConfig

      private static Configuration.Builder getDefaultConfig()
    • getOracleConnectionMock

      private io.debezium.connector.oracle.OracleConnection getOracleConnectionMock(io.debezium.connector.oracle.RedoThreadState state) throws SQLException
      Throws:
      SQLException
    • getOracleConnectionMock

      private io.debezium.connector.oracle.OracleConnection getOracleConnectionMock(io.debezium.connector.oracle.RedoThreadState state, List<io.debezium.connector.oracle.logminer.LogFile> logFileQueryResult) throws SQLException
      Throws:
      SQLException
    • getLogFileCollector

      private io.debezium.connector.oracle.logminer.LogFileCollector getLogFileCollector(io.debezium.connector.oracle.RedoThreadState state) throws SQLException
      Throws:
      SQLException
    • getLogFileCollector

      private io.debezium.connector.oracle.logminer.LogFileCollector getLogFileCollector(Configuration configuration, io.debezium.connector.oracle.OracleConnection connection)
    • setCollectorLogFiles

      private io.debezium.connector.oracle.logminer.LogFileCollector setCollectorLogFiles(io.debezium.connector.oracle.logminer.LogFileCollector collector, List<io.debezium.connector.oracle.logminer.LogFile> logFiles) throws SQLException
      Throws:
      SQLException
    • setConnectionRedoThreadState

      private void setConnectionRedoThreadState(io.debezium.connector.oracle.OracleConnection connection, io.debezium.connector.oracle.RedoThreadState redoThreadState) throws SQLException
      Throws:
      SQLException
    • getSingleThreadOpenState

      private io.debezium.connector.oracle.RedoThreadState getSingleThreadOpenState(io.debezium.connector.oracle.Scn enabledScn, io.debezium.connector.oracle.Scn lastFlushedScn)
    • getTwoThreadOpenState

      private io.debezium.connector.oracle.RedoThreadState getTwoThreadOpenState(io.debezium.connector.oracle.Scn enabledScnOne, io.debezium.connector.oracle.Scn lastFlushedScnOne, io.debezium.connector.oracle.Scn enabledScnTwo, io.debezium.connector.oracle.Scn lastFlushedScnTwo)
    • getFourThreadOpenState

      private io.debezium.connector.oracle.RedoThreadState getFourThreadOpenState(io.debezium.connector.oracle.Scn enabledScn, io.debezium.connector.oracle.Scn lastFlushScn)
    • makeOpenRedoThreadState

      private io.debezium.connector.oracle.RedoThreadState.RedoThread.Builder makeOpenRedoThreadState(io.debezium.connector.oracle.RedoThreadState.RedoThread.Builder builder, int threadId, io.debezium.connector.oracle.Scn enabledScn, io.debezium.connector.oracle.Scn lastFlushedScn)
    • initialMultiNodeRedoThreadState

      private io.debezium.connector.oracle.RedoThreadState initialMultiNodeRedoThreadState()
    • checkpointRedoThreadState

      private static io.debezium.connector.oracle.RedoThreadState checkpointRedoThreadState(io.debezium.connector.oracle.RedoThreadState currentState, int threadId, int checkpointScn)
      Performs a checkpoint operation on a redo thread, this is when a redo log rolls to an archive.
      Parameters:
      currentState - the current state to be mutated, should not be null
      threadId - the thread id
      checkpointScn - the scn to store in the checkpoint
      Returns:
      a new redo thread state with the thread modifications
    • transitionRedoThreadToOnline

      private static io.debezium.connector.oracle.RedoThreadState transitionRedoThreadToOnline(io.debezium.connector.oracle.RedoThreadState currentState, int threadId)
      Transitions a redo thread to online mode.
      Parameters:
      currentState - the current state to be mutated, should not be null
      threadId - the thread id
      Returns:
      a new redo thread state with the thread modifications
    • transitionRedoThreadToOffline

      private static io.debezium.connector.oracle.RedoThreadState transitionRedoThreadToOffline(io.debezium.connector.oracle.RedoThreadState currentState, int threadId, int changes)
      Transitions a redo thread to offline mode.
      Parameters:
      currentState - the current state to be mutated, should not be null
      threadId - the thread id
      changes - the number of changes to advance by before going offline, can be 0.
      Returns:
      a new redo thread state with the thread modifications
    • advanceRedoThreadState

      private static io.debezium.connector.oracle.RedoThreadState advanceRedoThreadState(io.debezium.connector.oracle.RedoThreadState currentState, int threadId, int changes, boolean increaseSequence)
      This method advances the provided redo thread state for a given thread by the specified number of changes.
      Parameters:
      currentState - the current state to be mutated, should not be null
      threadId - the thread id
      changes - the number of changes to advance by
      increaseSequence - whether to increase the sequence number
      Returns:
      a new redo thread state with the thread modifications
    • duplicateThreadState

      private static io.debezium.connector.oracle.RedoThreadState.RedoThread.Builder duplicateThreadState(io.debezium.connector.oracle.RedoThreadState.RedoThread.Builder builder, io.debezium.connector.oracle.RedoThreadState.RedoThread thread)
      Helper method to duplicate the existing immutable thread state for mutation operations.
      Parameters:
      builder - the new redo thread builder to create a thread within
      thread - the existing thread to be duplicated
      Returns:
      the mutated redo thread builder
    • duplicateState

      private static io.debezium.connector.oracle.RedoThreadState.Builder duplicateState(io.debezium.connector.oracle.RedoThreadState threadState)