Package io.debezium.embedded
Class ConnectorOutputTest.TestSpecification
java.lang.Object
io.debezium.embedded.ConnectorOutputTest.TestSpecification
- Enclosing class:
- ConnectorOutputTest
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final AtomicReference<ConnectorOutputTest.TestData>private final Configurationprivate final Configurationprivate final Stringprivate final AvailableVariables -
Constructor Summary
ConstructorsConstructorDescriptionTestSpecification(String name, Configuration config, Configuration env, Function<ConnectorOutputTest.TestSpecification, ConnectorOutputTest.TestData> dataSupplier, AvailableVariables variables) -
Method Summary
Modifier and TypeMethodDescriptionprivate AvailableVariablesconfig()Get the connector's configuration as would normally be passed to Kafka Connect when deploying the connector.Get the configuration of the test environment.name()Get the name of this test.Create a new test specification that is a copy of this specification except with the test data read from the specified input stream.readJsonTestData(File file) Create a new test specification that is a copy of this specification except with the test data read from the specified file.readJsonTestData(Path path) Create a new test specification that is a copy of this specification except with the test data read from the specified file.testData()Get the data for this test.Get the system, environmental, and other variables.withConfiguration(Configuration config) Create a new test specification that is a copy of this specification except with the given configuration.withConfiguration(File file) Create a new test specification that is a copy of this specification except with the given configuration.withConfiguration(InputStream stream) Create a new test specification that is a copy of this specification except with the given configuration.Create a new test specification that is a copy of this specification except with the given environment.withEnvironment(File file) Create a new test specification that is a copy of this specification except with the given environment.withEnvironment(InputStream stream) Create a new test specification that is a copy of this specification except with the given environment.Create a new test specification that is a copy of this specification except with the given name.withReadOrWriteTestData(File file) Create a new test specification that is a copy of this specification except with the test data read from or able to be written to the given file.withReadOrWriteTestData(Path path) Create a new test specification that is a copy of this specification except with the test data read from or able to be written to the given file.withTestData(Function<ConnectorOutputTest.TestSpecification, ConnectorOutputTest.TestData> dataSupplier) Create a new test specification that is a copy of this specification except with the given data.withVariables(AvailableVariables variables) Create a new test specification that is a copy of this specification except with the given variables.withVariables(ConnectorOutputTest.VariableSupplier variableSupplier) Create a new test specification that is a copy of this specification except with the given variables.Create a new test specification that is a copy of this specification except with aConnectorOutputTest.TestDatathat can capture the connector output as expected records.writeJsonTestData(File file) Create a new test specification that is a copy of this specification except with aConnectorOutputTest.TestDatathat can capture the connector output as expected records.writeJsonTestData(Path path) Create a new test specification that is a copy of this specification except with aConnectorOutputTest.TestDatathat can capture the connector output as expected records.
-
Field Details
-
name
-
config
-
env
-
dataSupplier
private final Function<ConnectorOutputTest.TestSpecification,ConnectorOutputTest.TestData> dataSupplier -
variables
-
cachedData
-
-
Constructor Details
-
TestSpecification
public TestSpecification(String name, Configuration config, Configuration env, Function<ConnectorOutputTest.TestSpecification, ConnectorOutputTest.TestData> dataSupplier, AvailableVariables variables)
-
-
Method Details
-
builtInVariables
-
name
Get the name of this test.- Returns:
- the name of the test; never null
-
config
Get the connector's configuration as would normally be passed to Kafka Connect when deploying the connector.- Returns:
- the configuration; never null
-
environment
Get the configuration of the test environment. Often no custom environment configuration properties are required, but they can be used to supply configuration properties to theEmbeddedEngineand theJsonConverter,JsonSerializerandJsonDeserializerinstances used to read and write the expected records, as well as the following:- "-connector.timeout.in.seconds" for the maximum time the connector should wait for records before stopping
- Returns:
- the test environment configuration; never null
-
testData
Get the data for this test. This method will be called once per execution.- Returns:
- the test data; never null
-
variables
Get the system, environmental, and other variables.- Returns:
- the variables; never null
-
withName
Create a new test specification that is a copy of this specification except with the given name.- Parameters:
name- the new name- Returns:
- the new test specification; never null
-
withConfiguration
Create a new test specification that is a copy of this specification except with the given configuration.- Parameters:
config- the new configuration- Returns:
- the new test specification; never null
-
withConfiguration
Create a new test specification that is a copy of this specification except with the given configuration.- Parameters:
file- the configuration file; may not be null- Returns:
- the new test specification; never null
-
withConfiguration
Create a new test specification that is a copy of this specification except with the given configuration.- Parameters:
stream- the input stream to the configuration file; may not be null- Returns:
- the new test specification; never null
-
withEnvironment
Create a new test specification that is a copy of this specification except with the given environment.- Parameters:
env- the new environment- Returns:
- the new test specification; never null
-
withEnvironment
Create a new test specification that is a copy of this specification except with the given environment.- Parameters:
file- the file containing the test environment; may not be null- Returns:
- the new test specification; never null
-
withEnvironment
Create a new test specification that is a copy of this specification except with the given environment.- Parameters:
stream- the input stream to the file containing the test environment; may not be null- Returns:
- the new test specification; never null
-
withTestData
public ConnectorOutputTest.TestSpecification withTestData(Function<ConnectorOutputTest.TestSpecification, ConnectorOutputTest.TestData> dataSupplier) Create a new test specification that is a copy of this specification except with the given data.- Parameters:
dataSupplier- the function that returns the new data when needed, given the TestSpecification that will own it; may be null if there is no test data- Returns:
- the new test specification; never null
-
withReadOrWriteTestData
Create a new test specification that is a copy of this specification except with the test data read from or able to be written to the given file.- Parameters:
path- the path to the file where the test data can be read or to which it is to be written; may not be null- Returns:
- the new test specification; never null
-
withReadOrWriteTestData
Create a new test specification that is a copy of this specification except with the test data read from or able to be written to the given file.- Parameters:
file- the file where the test data can be read or to which it is to be written; may not be null- Returns:
- the new test specification; never null
-
readJsonTestData
Create a new test specification that is a copy of this specification except with the test data read from the specified file.- Parameters:
path- the path to the test data; may not be null- Returns:
- the new test specification; never null
-
readJsonTestData
Create a new test specification that is a copy of this specification except with the test data read from the specified file.- Parameters:
file- the test data; may not be null- Returns:
- the new test specification; never null
-
readJsonTestData
public ConnectorOutputTest.TestSpecification readJsonTestData(ConnectorOutputTest.InputStreamSupplier stream) Create a new test specification that is a copy of this specification except with the test data read from the specified input stream. The supplied stream is read and variables substituted when thetest dataisread.- Parameters:
stream- the supplier to the stream of test data; may not be null- Returns:
- the new test specification; never null
-
writeJsonTestData
Create a new test specification that is a copy of this specification except with aConnectorOutputTest.TestDatathat can capture the connector output as expected records.- Parameters:
path- the path to the file to which the test data is to be written; may not be null- Returns:
- the new test specification; never null
-
writeJsonTestData
Create a new test specification that is a copy of this specification except with aConnectorOutputTest.TestDatathat can capture the connector output as expected records.- Parameters:
file- the file to which the test data is to be written; may not be null- Returns:
- the new test specification; never null
-
writeJsonTestData
public ConnectorOutputTest.TestSpecification writeJsonTestData(ConnectorOutputTest.OutputStreamSupplier stream) Create a new test specification that is a copy of this specification except with aConnectorOutputTest.TestDatathat can capture the connector output as expected records.- Parameters:
stream- the stream to which the test data is to be written; may not be null- Returns:
- the new test specification; never null
-
withVariables
Create a new test specification that is a copy of this specification except with the given variables.- Parameters:
variables- the new variables that should replace this specification's variables- Returns:
- the new test specification; never null
-
withVariables
public ConnectorOutputTest.TestSpecification withVariables(ConnectorOutputTest.VariableSupplier variableSupplier) Create a new test specification that is a copy of this specification except with the given variables.- Parameters:
variableSupplier- the function used to obtain the variables using the configuration- Returns:
- the new test specification; never null
-