Class ConnectorOutputTest.TestSpecification

    • Method Detail

      • 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 the EmbeddedEngine and the JsonConverter, JsonSerializer and JsonDeserializer instances used to read and write the expected records, as well as the following:
        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
      • 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 the test data is read.
        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 a ConnectorOutputTest.TestData that 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 a ConnectorOutputTest.TestData that 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
      • 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