GithubHelp home page GithubHelp logo

isabella232 / cp-testcontainers Goto Github PK

View Code? Open in Web Editor NEW

This project forked from confluentinc/cp-testcontainers

0.0 0.0 0.0 319 KB

Testcontainers for the Confluent Platform Components

Java 100.00%

cp-testcontainers's Introduction

CP testcontainers

Testcontainer modules for Confluent Platform components.

Example

The following snippet will start an Apache Kafka and a Schema Registry container on the same network

final var factory = new CPTestContainerFactory();

final KafkaContainer kafka = factory.createKafka();
final SchemaRegistryContainer schemaRegistry = factory.createSchemaRegistry(kafka);
schemaRegistry.start(); //will implicitly start kafka container

The following snippet can then be used to configure a producer to use these:

properties.put("bootstrap.servers",   kafka.getBootstrapServers());
//...
properties.put("schema.registry.url", schemaRegistry.getBaseUrl());

The following snippet starts a single node Kafka Connect cluster with two connectors from Confluent Hub installed:

final var connect = factory.createCustomConnector(
        Set.of(
            "confluentinc/kafka-connect-s3:latest", 
            "confluentinc/kafka-connect-datagen:0.4.0"
        ), kafka);
connect.start();

The following snippet configures a CP-server container and a schema registry container with RBAC enabled:

final var factory = new CPTestContainerFactory(network);
final var ldap = factory.createLdap();

final var confluentServer = factory.createConfluentServer().enableRbac();

final var sr = factory.createSchemaRegistry(confluentServer).enableRbac();
sr.start()

See the intTest source set for examples on how to set up containers.

Supported components

So far the following components are supported:

  • Confluent Server
  • Confluent Schema Registry
  • ksqlDB
  • Kafka Connect
  • Confluent Replicator running on Connect
  • Confluent REST Proxy.

Moreover, we can create KafkaContainer instances which have RBAC and MDS enabled. So far, the following components can be configured to use RBAC:

  • Confluent Server
  • Confluent Schema Registry
  • Kafka Connect (without secret registry)

Packages

Project package are hosted on jitpack for the time being. Add the following to your gradle file:

allprojects {
    repositories {
        maven { url 'https://jitpack.io' }
    }
}

dependencies {
    implementation 'com.github.christophschubert:cp-testcontainers:Tag'
}

See the jitpack page of the project for information on how to use the package with mvn or sbt.

Noteworthy demos

  • LocalStackIntTest shows how to setup S3 sink connector with S3 installation based on localstack.

cp-testcontainers's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.