Class LogFileCollectorTest
java.lang.Object
io.debezium.connector.oracle.logminer.LogFileCollectorTest
Unit tests for the
LogFileCollector class.- Author:
- Chris Cranford
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static io.debezium.connector.oracle.RedoThreadStateadvanceRedoThreadState(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.private static io.debezium.connector.oracle.RedoThreadStatecheckpointRedoThreadState(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.private static io.debezium.connector.oracle.logminer.LogFilecreateArchiveLog(String name, long startScn, long endScn, int sequence, int threadId) private static io.debezium.connector.oracle.logminer.LogFilecreateRedoLog(String name, long startScn, int sequence, int threadId) private static io.debezium.connector.oracle.logminer.LogFilecreateRedoLog(String name, long startScn, long endScn, int sequence, int threadId) private static io.debezium.connector.oracle.logminer.LogFilecreateRedoLog(String name, long startScn, long endScn, int sequence, int threadId, boolean current) private static io.debezium.connector.oracle.logminer.LogFilecreateRedoLog(String name, String startScn, String endScn, int sequence, boolean current, int threadId) private static io.debezium.connector.oracle.logminer.LogFilecreateRedoLog(String name, String startScn, String endScn, int sequence, int threadId) private static io.debezium.connector.oracle.logminer.LogFilecreateRedoLogWithNullEndScn(String name, long startScn, int sequence, int threadId) private static io.debezium.connector.oracle.RedoThreadState.BuilderduplicateState(io.debezium.connector.oracle.RedoThreadState threadState) private static io.debezium.connector.oracle.RedoThreadState.RedoThread.BuilderduplicateThreadState(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.private static Configuration.Builderprivate io.debezium.connector.oracle.RedoThreadStategetFourThreadOpenState(io.debezium.connector.oracle.Scn enabledScn, io.debezium.connector.oracle.Scn lastFlushScn) private io.debezium.connector.oracle.logminer.LogFileCollectorgetLogFileCollector(Configuration configuration, io.debezium.connector.oracle.OracleConnection connection) private io.debezium.connector.oracle.logminer.LogFileCollectorgetLogFileCollector(io.debezium.connector.oracle.RedoThreadState state) private io.debezium.connector.oracle.logminer.LogFilegetLogFileWithName(List<io.debezium.connector.oracle.logminer.LogFile> logs, String fileName) private io.debezium.connector.oracle.OracleConnectiongetOracleConnectionMock(io.debezium.connector.oracle.RedoThreadState state) private io.debezium.connector.oracle.OracleConnectiongetOracleConnectionMock(io.debezium.connector.oracle.RedoThreadState state, List<io.debezium.connector.oracle.logminer.LogFile> logFileQueryResult) private io.debezium.connector.oracle.RedoThreadStategetSingleThreadOpenState(io.debezium.connector.oracle.Scn enabledScn, io.debezium.connector.oracle.Scn lastFlushedScn) private io.debezium.connector.oracle.RedoThreadStategetTwoThreadOpenState(io.debezium.connector.oracle.Scn enabledScnOne, io.debezium.connector.oracle.Scn lastFlushedScnOne, io.debezium.connector.oracle.Scn enabledScnTwo, io.debezium.connector.oracle.Scn lastFlushedScnTwo) private io.debezium.connector.oracle.RedoThreadStateprivate io.debezium.connector.oracle.RedoThreadState.RedoThread.BuildermakeOpenRedoThreadState(io.debezium.connector.oracle.RedoThreadState.RedoThread.Builder builder, int threadId, io.debezium.connector.oracle.Scn enabledScn, io.debezium.connector.oracle.Scn lastFlushedScn) private io.debezium.connector.oracle.logminer.LogFileCollectorsetCollectorLogFiles(io.debezium.connector.oracle.logminer.LogFileCollector collector, List<io.debezium.connector.oracle.logminer.LogFile> logFiles) private voidsetConnectionRedoThreadState(io.debezium.connector.oracle.OracleConnection connection, io.debezium.connector.oracle.RedoThreadState redoThreadState) voidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidprivate static io.debezium.connector.oracle.RedoThreadStatetransitionRedoThreadToOffline(io.debezium.connector.oracle.RedoThreadState currentState, int threadId, int changes) Transitions a redo thread to offline mode.private static io.debezium.connector.oracle.RedoThreadStatetransitionRedoThreadToOnline(io.debezium.connector.oracle.RedoThreadState currentState, int threadId) Transitions a redo thread to online mode.
-
Field Details
-
skipRule
public org.junit.rules.TestRule skipRule -
currentQueryRow
private int currentQueryRow
-
-
Constructor Details
-
LogFileCollectorTest
public LogFileCollectorTest()
-
-
Method Details
-
testStandaloneLogStateWithOneThreadArchiveLogGap
- Throws:
Exception
-
testStandaloneLogStateWithNoGaps
- Throws:
Exception
-
testStandaloneLogStateWithJustOnlineLogs
- Throws:
Exception
-
testStandaloneLogStateWithMixOfArchiveAndRedoNoGaps
- Throws:
Exception
-
testRacLogStateWithOneThreadArchiveLogGap
- Throws:
Exception
-
testRacLogStateWithNoGaps
- Throws:
Exception
-
testRacLogStateWithJustOnlineLogs
- Throws:
Exception
-
testRacLogStateWithMixOfArchiveAndRedoNoGaps
- Throws:
Exception
-
testRacLogStateWithMixOfArchiveAndRedoForBothThreadsNoGap
- 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
- Throws:
Exception
-
testExcludeLogsBeforeOffsetScn
- Throws:
Exception
-
testNullsHandledAsMaxScn
- Throws:
Exception
-
testCanHandleMaxScn
- Throws:
Exception
-
testCanHandleVeryLargeScnValuesInNonCurrentRedoLog
@FixFor("DBZ-2855") public void testCanHandleVeryLargeScnValuesInNonCurrentRedoLog() throws Exception- Throws:
Exception
-
testRacMultipleNodesNoThreadStateChanges
- Throws:
Exception
-
testRacMultipleNodesOneThreadChangesToClosed
- Throws:
Exception
-
testRacMultipleNodesOneThreadChangesToOpen
- Throws:
Exception
-
testRacMultipleNodesOpenedAndAddNewNodeInClosedStateEnabled
@FixFor("DBZ-7389") public void testRacMultipleNodesOpenedAndAddNewNodeInClosedStateEnabled() throws Exception- Throws:
Exception
-
testRacMultipleNodesOpenedAndAddNewNodeInOpened
- 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
-
createRedoLog
-
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
-
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 benullthreadId- the thread idcheckpointScn- 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 benullthreadId- 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 benullthreadId- the thread idchanges- the number of changes to advance by before going offline, can be0.- 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 benullthreadId- the thread idchanges- the number of changes to advance byincreaseSequence- 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 withinthread- 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)
-