Package io.debezium.connector.simple
Class SimpleSourceConnectorOutputTest
- java.lang.Object
-
- io.debezium.embedded.ConnectorOutputTest
-
- io.debezium.connector.simple.SimpleSourceConnectorOutputTest
-
public class SimpleSourceConnectorOutputTest extends ConnectorOutputTest
A test case for theSimpleSourceConnectorthat is also able to test and verify the behavior ofConnectorOutputTest.- Author:
- Randall Hauch
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class io.debezium.embedded.ConnectorOutputTest
ConnectorOutputTest.InputStreamSupplier, ConnectorOutputTest.OutputStreamSupplier, ConnectorOutputTest.TestData, ConnectorOutputTest.TestSpecification, ConnectorOutputTest.VariableSupplier
-
-
Field Summary
Fields Modifier and Type Field Description protected static StringTOPIC_NAME-
Fields inherited from class io.debezium.embedded.ConnectorOutputTest
CONNECTOR_OUTPUT_PATH, CONTROL_END, CONTROL_KEY, CONTROL_RESTART, CONTROL_STOP, DEFAULT_CONNECTOR_PROPERTIES_FILENAME, DEFAULT_ENV_PROPERTIES_FILENAME, DEFAULT_EXPECTED_RECORDS_FILENAME, ENV_CONNECTOR_TIMEOUT_IN_SECONDS, ENV_IGNORE_FIELDS, OFFSET_STORE_PATH
-
-
Constructor Summary
Constructors Constructor Description SimpleSourceConnectorOutputTest()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidappendCommand(Path results, Document command)protected voidappendStop(Path results)protected voidassertExpectedRecords(Path path, int batchCount, int recordsPerBatch)protected voidassertFieldSchema(Document doc, String fieldName, org.apache.kafka.connect.data.Schema.Type type, boolean optional)protected voidassertOptionalFieldSchema(Document doc, String fieldName, org.apache.kafka.connect.data.Schema.Type type)protected voidassertRequiredFieldSchema(Document doc, String fieldName, org.apache.kafka.connect.data.Schema.Type type)protected PropertiesreadConfiguration(Path configFilePath)protected ArrayreadResults(File file)voidshouldGenerateExpected()Run the connector with no known expected results so that it generates the results.voidshouldRecoverFromRetriableException()Run the connector and verify thatRetriableExceptionis handled.voidshouldRunConnectorFromFilesAndFindMismatch()Run the connector with connector configuration and expected results files, but find a mismatch in the results.voidshouldRunConnectorFromFilesInOneStep()Run the connector with connector configuration and expected results files, which are read in one step.voidshouldRunConnectorFromFilesInOneStepWithTimestamps()Run the connector with connector configuration and expected results files, which are read in one step.voidshouldRunConnectorFromFilesInTwoSteps()Run the connector with connector configuration and expected results files, which are read in two steps.protected voidwriteConfigurationFile(Path configFilePath, Properties props)protected voidwriteConfigurationFileWithDefaultName(Path dir, Properties props)protected voidwriteEnvironmentFileWithDefaultName(Path dir, Properties props)-
Methods inherited from class io.debezium.embedded.ConnectorOutputTest
addValueComparatorsByFieldPath, addValueComparatorsBySchemaName, afterEachTestMethod, cleanOffsetStorage, globallyIgnorableFieldNames, replaceVariables, runConnector, runConnector, runConnector, runConnector, runConnector, runConnector, usingSpec, usingSpec, usingSpec, usingSpec, usingSpec
-
-
-
-
Field Detail
-
TOPIC_NAME
protected static final String TOPIC_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
shouldGenerateExpected
public void shouldGenerateExpected() throws ExceptionRun the connector with no known expected results so that it generates the results.- Throws:
Exception- if there is an error
-
shouldRunConnectorFromFilesInOneStep
public void shouldRunConnectorFromFilesInOneStep()
Run the connector with connector configuration and expected results files, which are read in one step.
-
shouldRunConnectorFromFilesInTwoSteps
public void shouldRunConnectorFromFilesInTwoSteps()
Run the connector with connector configuration and expected results files, which are read in two steps.
-
shouldRunConnectorFromFilesAndFindMismatch
public void shouldRunConnectorFromFilesAndFindMismatch()
Run the connector with connector configuration and expected results files, but find a mismatch in the results.
-
shouldRunConnectorFromFilesInOneStepWithTimestamps
public void shouldRunConnectorFromFilesInOneStepWithTimestamps()
Run the connector with connector configuration and expected results files, which are read in one step. The connector includes timestamps that vary with each run, and the expected results have no no timestamps. However, this test filters out the timestamps from the matching logic.
-
shouldRecoverFromRetriableException
public void shouldRecoverFromRetriableException()
Run the connector and verify thatRetriableExceptionis handled.
-
writeConfigurationFileWithDefaultName
protected void writeConfigurationFileWithDefaultName(Path dir, Properties props) throws IOException
- Throws:
IOException
-
writeEnvironmentFileWithDefaultName
protected void writeEnvironmentFileWithDefaultName(Path dir, Properties props) throws IOException
- Throws:
IOException
-
writeConfigurationFile
protected void writeConfigurationFile(Path configFilePath, Properties props) throws IOException
- Throws:
IOException
-
readConfiguration
protected Properties readConfiguration(Path configFilePath) throws IOException
- Throws:
IOException
-
appendStop
protected void appendStop(Path results) throws IOException
- Throws:
IOException
-
readResults
protected Array readResults(File file) throws IOException
- Throws:
IOException
-
appendCommand
protected void appendCommand(Path results, Document command) throws IOException
- Throws:
IOException
-
assertExpectedRecords
protected void assertExpectedRecords(Path path, int batchCount, int recordsPerBatch) throws IOException
- Throws:
IOException
-
assertFieldSchema
protected void assertFieldSchema(Document doc, String fieldName, org.apache.kafka.connect.data.Schema.Type type, boolean optional)
-
assertRequiredFieldSchema
protected void assertRequiredFieldSchema(Document doc, String fieldName, org.apache.kafka.connect.data.Schema.Type type)
-
-