Package io.debezium.embedded
Class ConnectorOutputTest.TestSpecification
- java.lang.Object
-
- io.debezium.embedded.ConnectorOutputTest.TestSpecification
-
- Enclosing class:
- ConnectorOutputTest
public static class ConnectorOutputTest.TestSpecification extends Object
-
-
Field Summary
Fields Modifier and Type Field Description private AtomicReference<ConnectorOutputTest.TestData>cachedDataprivate Configurationconfigprivate Function<ConnectorOutputTest.TestSpecification,ConnectorOutputTest.TestData>dataSupplierprivate Configurationenvprivate Stringnameprivate AvailableVariablesvariables
-
Constructor Summary
Constructors Constructor Description TestSpecification(String name, Configuration config, Configuration env, Function<ConnectorOutputTest.TestSpecification,ConnectorOutputTest.TestData> dataSupplier, AvailableVariables variables)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private AvailableVariablesbuiltInVariables()Configurationconfig()Get the connector's configuration as would normally be passed to Kafka Connect when deploying the connector.Configurationenvironment()Get the configuration of the test environment.Stringname()Get the name of this test.ConnectorOutputTest.TestSpecificationreadJsonTestData(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.ConnectorOutputTest.TestSpecificationreadJsonTestData(File file)Create a new test specification that is a copy of this specification except with the test data read from the specified file.ConnectorOutputTest.TestSpecificationreadJsonTestData(Path path)Create a new test specification that is a copy of this specification except with the test data read from the specified file.ConnectorOutputTest.TestDatatestData()Get the data for this test.AvailableVariablesvariables()Get the system, environmental, and other variables.ConnectorOutputTest.TestSpecificationwithConfiguration(Configuration config)Create a new test specification that is a copy of this specification except with the given configuration.ConnectorOutputTest.TestSpecificationwithConfiguration(File file)Create a new test specification that is a copy of this specification except with the given configuration.ConnectorOutputTest.TestSpecificationwithConfiguration(InputStream stream)Create a new test specification that is a copy of this specification except with the given configuration.ConnectorOutputTest.TestSpecificationwithEnvironment(Configuration env)Create a new test specification that is a copy of this specification except with the given environment.ConnectorOutputTest.TestSpecificationwithEnvironment(File file)Create a new test specification that is a copy of this specification except with the given environment.ConnectorOutputTest.TestSpecificationwithEnvironment(InputStream stream)Create a new test specification that is a copy of this specification except with the given environment.ConnectorOutputTest.TestSpecificationwithName(String name)Create a new test specification that is a copy of this specification except with the given name.ConnectorOutputTest.TestSpecificationwithReadOrWriteTestData(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.ConnectorOutputTest.TestSpecificationwithReadOrWriteTestData(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.ConnectorOutputTest.TestSpecificationwithTestData(Function<ConnectorOutputTest.TestSpecification,ConnectorOutputTest.TestData> dataSupplier)Create a new test specification that is a copy of this specification except with the given data.ConnectorOutputTest.TestSpecificationwithVariables(AvailableVariables variables)Create a new test specification that is a copy of this specification except with the given variables.ConnectorOutputTest.TestSpecificationwithVariables(ConnectorOutputTest.VariableSupplier variableSupplier)Create a new test specification that is a copy of this specification except with the given variables.ConnectorOutputTest.TestSpecificationwriteJsonTestData(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.ConnectorOutputTest.TestSpecificationwriteJsonTestData(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.ConnectorOutputTest.TestSpecificationwriteJsonTestData(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 Detail
-
name
private final String name
-
config
private final Configuration config
-
env
private final Configuration env
-
dataSupplier
private final Function<ConnectorOutputTest.TestSpecification,ConnectorOutputTest.TestData> dataSupplier
-
variables
private final AvailableVariables variables
-
cachedData
private final AtomicReference<ConnectorOutputTest.TestData> cachedData
-
-
Constructor Detail
-
TestSpecification
public TestSpecification(String name, Configuration config, Configuration env, Function<ConnectorOutputTest.TestSpecification,ConnectorOutputTest.TestData> dataSupplier, AvailableVariables variables)
-
-
Method Detail
-
builtInVariables
private AvailableVariables builtInVariables()
-
name
public String name()
Get the name of this test.- Returns:
- the name of the test; never null
-
config
public Configuration config()
Get the connector's configuration as would normally be passed to Kafka Connect when deploying the connector.- Returns:
- the configuration; never null
-
environment
public Configuration 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
public ConnectorOutputTest.TestData testData()
Get the data for this test. This method will be called once per execution.- Returns:
- the test data; never null
-
variables
public AvailableVariables variables()
Get the system, environmental, and other variables.- Returns:
- the variables; never null
-
withName
public ConnectorOutputTest.TestSpecification withName(String name)
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
public ConnectorOutputTest.TestSpecification withConfiguration(Configuration config)
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
public ConnectorOutputTest.TestSpecification withConfiguration(File file)
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
public ConnectorOutputTest.TestSpecification withConfiguration(InputStream stream)
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
public ConnectorOutputTest.TestSpecification withEnvironment(Configuration env)
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
public ConnectorOutputTest.TestSpecification withEnvironment(File file)
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
public ConnectorOutputTest.TestSpecification withEnvironment(InputStream stream)
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
public ConnectorOutputTest.TestSpecification 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.- 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
public ConnectorOutputTest.TestSpecification 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.- 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
public ConnectorOutputTest.TestSpecification 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.- Parameters:
path- the path to the test data; may not be null- Returns:
- the new test specification; never null
-
readJsonTestData
public ConnectorOutputTest.TestSpecification 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.- 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
public ConnectorOutputTest.TestSpecification 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.- 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
public ConnectorOutputTest.TestSpecification 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.- 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
public ConnectorOutputTest.TestSpecification withVariables(AvailableVariables variables)
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
-
-