diff --git a/airbyte-integrations/connector-templates/source-java-jdbc/acceptance-test-config.yml.hbs b/airbyte-integrations/connector-templates/source-java-jdbc/acceptance-test-config.yml.hbs new file mode 100644 index 0000000000000..bfb8b4b80ec13 --- /dev/null +++ b/airbyte-integrations/connector-templates/source-java-jdbc/acceptance-test-config.yml.hbs @@ -0,0 +1,7 @@ +# See [Source Acceptance Tests](https://docs.airbyte.com/connector-development/testing-connectors/source-acceptance-tests-reference) +# for more information about how to configure these tests +connector_image: airbyte/source-{{dashCase name}}:dev +tests: + spec: + - spec_path: "src/test-integration/resources/expected_spec.json" + config_path: "src/test-integration/resources/dummy_config.json" diff --git a/airbyte-integrations/connector-templates/source-java-jdbc/acceptance-test-docker.sh b/airbyte-integrations/connector-templates/source-java-jdbc/acceptance-test-docker.sh new file mode 100644 index 0000000000000..c416fd1440557 --- /dev/null +++ b/airbyte-integrations/connector-templates/source-java-jdbc/acceptance-test-docker.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env sh + +# Build latest connector image +docker build . -t $(cat acceptance-test-config.yml | grep "connector_image" | head -n 1 | cut -d: -f2-) + +# Pull latest acctest image +docker pull airbyte/source-acceptance-test:latest + +# Run +docker run --rm -it \ + -v /var/run/docker.sock:/var/run/docker.sock \ + -v /tmp:/tmp \ + -v $(pwd):/test_input \ + airbyte/source-acceptance-test \ + --acceptance-test-config /test_input diff --git a/airbyte-integrations/connector-templates/source-java-jdbc/build.gradle b/airbyte-integrations/connector-templates/source-java-jdbc/build.gradle index baa7b92ce1e5c..6da2492a031c6 100644 --- a/airbyte-integrations/connector-templates/source-java-jdbc/build.gradle +++ b/airbyte-integrations/connector-templates/source-java-jdbc/build.gradle @@ -2,6 +2,7 @@ plugins { id 'application' id 'airbyte-docker' id 'airbyte-integration-test-java' + id 'airbyte-source-acceptance-test' } application { diff --git a/airbyte-integrations/connector-templates/source-java-jdbc/integration_tests/acceptance.py b/airbyte-integrations/connector-templates/source-java-jdbc/integration_tests/acceptance.py new file mode 100644 index 0000000000000..1302b2f57e10e --- /dev/null +++ b/airbyte-integrations/connector-templates/source-java-jdbc/integration_tests/acceptance.py @@ -0,0 +1,16 @@ +# +# Copyright (c) 2022 Airbyte, Inc., all rights reserved. +# + + +import pytest + +pytest_plugins = ("source_acceptance_test.plugin",) + + +@pytest.fixture(scope="session", autouse=True) +def connector_setup(): + """This fixture is a placeholder for external resources that acceptance test might require.""" + # TODO: setup test dependencies if needed. otherwise remove the TODO comments + yield + # TODO: clean up test dependencies diff --git a/airbyte-integrations/connector-templates/source-java-jdbc/src/test-integration/resources/dummy_config.json b/airbyte-integrations/connector-templates/source-java-jdbc/src/test-integration/resources/dummy_config.json new file mode 100644 index 0000000000000..483d12bc3cd11 --- /dev/null +++ b/airbyte-integrations/connector-templates/source-java-jdbc/src/test-integration/resources/dummy_config.json @@ -0,0 +1,7 @@ +{ + "host": "default", + "port": 5555, + "database": "default", + "username": "default", + "replication_method": "STANDARD" +} diff --git a/airbyte-integrations/connector-templates/source-java-jdbc/src/test-integration/resources/expected_spec.json.hbs b/airbyte-integrations/connector-templates/source-java-jdbc/src/test-integration/resources/expected_spec.json.hbs new file mode 100644 index 0000000000000..5d3ba7fc2413e --- /dev/null +++ b/airbyte-integrations/connector-templates/source-java-jdbc/src/test-integration/resources/expected_spec.json.hbs @@ -0,0 +1,61 @@ +{ + "documentationUrl": "https://docs.airbyte.com/integrations/sources/{{snakeCase name}}", + "connectionSpecification": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "{{pascalCase name}} Source Spec", + "type": "object", + "required": ["host", "port", "database", "username", "replication_method"], + "properties": { + "host": { + "title": "Host", + "description": "Hostname of the database.", + "type": "string", + "order": 0 + }, + "port": { + "title": "Port", + "description": "Port of the database.", + "type": "integer", + "minimum": 0, + "maximum": 65536, + "default": 3306, + "examples": ["3306"], + "order": 1 + }, + "database": { + "title": "Database", + "description": "Name of the database.", + "type": "string", + "order": 2 + }, + "username": { + "title": "Username", + "description": "Username to use to access the database.", + "type": "string", + "order": 3 + }, + "password": { + "title": "Password", + "description": "Password associated with the username.", + "type": "string", + "airbyte_secret": true, + "order": 4 + }, + "jdbc_url_params": { + "title": "JDBC URL params", + "description": "Additional properties to pass to the JDBC URL string when connecting to the database formatted as 'key=value' pairs separated by the symbol '&'. (example: key1=value1&key2=value2&key3=value3)", + "type": "string", + "order": 5 + }, + "replication_method": { + "title": "Replication method", + "description": "Replication method to use for extracting data from the database. STANDARD replication requires no setup on the DB side but will not be able to represent deletions incrementally. CDC uses the Binlog to detect inserts, updates, and deletes. This needs to be configured on the source database itself.", + "type": "string", + "order": 6, + "default": "STANDARD", + "enum": ["STANDARD", "CDC"] + } + } + }, + "supported_destination_sync_modes": [] +} diff --git a/airbyte-integrations/connectors/source-scaffold-java-jdbc/acceptance-test-config.yml b/airbyte-integrations/connectors/source-scaffold-java-jdbc/acceptance-test-config.yml new file mode 100644 index 0000000000000..de264ed632333 --- /dev/null +++ b/airbyte-integrations/connectors/source-scaffold-java-jdbc/acceptance-test-config.yml @@ -0,0 +1,7 @@ +# See [Source Acceptance Tests](https://docs.airbyte.com/connector-development/testing-connectors/source-acceptance-tests-reference) +# for more information about how to configure these tests +connector_image: airbyte/source-scaffold-java-jdbc:dev +tests: + spec: + - spec_path: "src/test-integration/resources/expected_spec.json" + config_path: "src/test-integration/resources/dummy_config.json" diff --git a/airbyte-integrations/connectors/source-scaffold-java-jdbc/acceptance-test-docker.sh b/airbyte-integrations/connectors/source-scaffold-java-jdbc/acceptance-test-docker.sh new file mode 100644 index 0000000000000..c416fd1440557 --- /dev/null +++ b/airbyte-integrations/connectors/source-scaffold-java-jdbc/acceptance-test-docker.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env sh + +# Build latest connector image +docker build . -t $(cat acceptance-test-config.yml | grep "connector_image" | head -n 1 | cut -d: -f2-) + +# Pull latest acctest image +docker pull airbyte/source-acceptance-test:latest + +# Run +docker run --rm -it \ + -v /var/run/docker.sock:/var/run/docker.sock \ + -v /tmp:/tmp \ + -v $(pwd):/test_input \ + airbyte/source-acceptance-test \ + --acceptance-test-config /test_input diff --git a/airbyte-integrations/connectors/source-scaffold-java-jdbc/build.gradle b/airbyte-integrations/connectors/source-scaffold-java-jdbc/build.gradle index 5e3d7e61e46f2..5c9872a1fe694 100644 --- a/airbyte-integrations/connectors/source-scaffold-java-jdbc/build.gradle +++ b/airbyte-integrations/connectors/source-scaffold-java-jdbc/build.gradle @@ -2,6 +2,7 @@ plugins { id 'application' id 'airbyte-docker' id 'airbyte-integration-test-java' + id 'airbyte-source-acceptance-test' } application { diff --git a/airbyte-integrations/connectors/source-scaffold-java-jdbc/integration_tests/acceptance.py b/airbyte-integrations/connectors/source-scaffold-java-jdbc/integration_tests/acceptance.py new file mode 100644 index 0000000000000..1302b2f57e10e --- /dev/null +++ b/airbyte-integrations/connectors/source-scaffold-java-jdbc/integration_tests/acceptance.py @@ -0,0 +1,16 @@ +# +# Copyright (c) 2022 Airbyte, Inc., all rights reserved. +# + + +import pytest + +pytest_plugins = ("source_acceptance_test.plugin",) + + +@pytest.fixture(scope="session", autouse=True) +def connector_setup(): + """This fixture is a placeholder for external resources that acceptance test might require.""" + # TODO: setup test dependencies if needed. otherwise remove the TODO comments + yield + # TODO: clean up test dependencies diff --git a/airbyte-integrations/connectors/source-scaffold-java-jdbc/src/test-integration/resources/dummy_config.json b/airbyte-integrations/connectors/source-scaffold-java-jdbc/src/test-integration/resources/dummy_config.json new file mode 100644 index 0000000000000..483d12bc3cd11 --- /dev/null +++ b/airbyte-integrations/connectors/source-scaffold-java-jdbc/src/test-integration/resources/dummy_config.json @@ -0,0 +1,7 @@ +{ + "host": "default", + "port": 5555, + "database": "default", + "username": "default", + "replication_method": "STANDARD" +} diff --git a/airbyte-integrations/connectors/source-scaffold-java-jdbc/src/test-integration/resources/expected_spec.json b/airbyte-integrations/connectors/source-scaffold-java-jdbc/src/test-integration/resources/expected_spec.json new file mode 100644 index 0000000000000..7bbd3bb22e22e --- /dev/null +++ b/airbyte-integrations/connectors/source-scaffold-java-jdbc/src/test-integration/resources/expected_spec.json @@ -0,0 +1,61 @@ +{ + "documentationUrl": "https://docs.airbyte.com/integrations/sources/scaffold_java_jdbc", + "connectionSpecification": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ScaffoldJavaJdbc Source Spec", + "type": "object", + "required": ["host", "port", "database", "username", "replication_method"], + "properties": { + "host": { + "title": "Host", + "description": "Hostname of the database.", + "type": "string", + "order": 0 + }, + "port": { + "title": "Port", + "description": "Port of the database.", + "type": "integer", + "minimum": 0, + "maximum": 65536, + "default": 3306, + "examples": ["3306"], + "order": 1 + }, + "database": { + "title": "Database", + "description": "Name of the database.", + "type": "string", + "order": 2 + }, + "username": { + "title": "Username", + "description": "Username to use to access the database.", + "type": "string", + "order": 3 + }, + "password": { + "title": "Password", + "description": "Password associated with the username.", + "type": "string", + "airbyte_secret": true, + "order": 4 + }, + "jdbc_url_params": { + "title": "JDBC URL params", + "description": "Additional properties to pass to the JDBC URL string when connecting to the database formatted as 'key=value' pairs separated by the symbol '&'. (example: key1=value1&key2=value2&key3=value3)", + "type": "string", + "order": 5 + }, + "replication_method": { + "title": "Replication method", + "description": "Replication method to use for extracting data from the database. STANDARD replication requires no setup on the DB side but will not be able to represent deletions incrementally. CDC uses the Binlog to detect inserts, updates, and deletes. This needs to be configured on the source database itself.", + "type": "string", + "order": 6, + "default": "STANDARD", + "enum": ["STANDARD", "CDC"] + } + } + }, + "supported_destination_sync_modes": [] +}