Skip to content

Common interface for testing with an Exasol database in local and AWS environments using Java.

License

Notifications You must be signed in to change notification settings

exasol/exasol-test-setup-abstraction-java

Repository files navigation

Exasol Test Setup Abstraction

Build Status Maven Central – exasol-test-setup-abstraction-java

Quality Gate Status

Security Rating Reliability Rating Maintainability Rating Technical Debt

Code Smells Coverage Duplicated Lines (%) Lines of Code

This repository defines a standardized interface for accessing an Exasol database for testing.

That allows you to write tests where you can switch the test-backend. For example you can switch between an Exasol cluster in the cloud or a local docker-db.

In addition, it contains implementations for this interface for the following test-backends:

  • Local - Docker (via Testcontainers)
  • With an Exasol cluster on AWS

Usage

class MyTest {
    private static final ExasolTestSetup EXASOL = new ExasolTestSetupFactory("cloudSetup/generated/testConfig.json").getTestSetup();

    @Test
    void test() {
        var sqlConnection = EXASOL.createConnection();
        //...
    }

    @AfterAll
    static void afterAll() {
        EXASOL.close();
    }
}

The ExasolTestSetupFactory in the example returns a test setup for an AWS cluster if the specified config file (cloudSetup/generated/testConfig.json) exists. Otherwise, it returns a test setup based on a local running Exasol-Testcontainer.

Usually you generate the testConfig.json using the Terraform module terraform-aws-exasol-test-setup >= 1.0.0. For details see the guide for setting up a project with cloud resources.

You can also select a specific test-setup in code. For that simply replace new ExasolTestSetupFactory().getTestSetup() by new ExasolTestcontainerTestSetup().

To change the Exasol Docker DB version being used you can define the com.exasol.dockerdb.image system property, e.g: mvn verify -Dcom.exasol.dockerdb.image=${{ matrix.docker_db_version }}.

Information for Users of This Library

Information for Developers of This Library