{"id":20230978,"url":"https://github.com/bewaremypower/testcontainers-ksn","last_synced_at":"2025-07-24T00:03:29.554Z","repository":{"id":203289426,"uuid":"709258204","full_name":"BewareMyPower/testcontainers-ksn","owner":"BewareMyPower","description":"The testcontainers module for Kafka-on-StreamNative (KSN)","archived":false,"fork":false,"pushed_at":"2023-10-24T12:13:09.000Z","size":19,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-16T22:06:05.914Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BewareMyPower.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-10-24T11:00:15.000Z","updated_at":"2023-10-24T11:01:29.000Z","dependencies_parsed_at":null,"dependency_job_id":"e1eb6170-3410-4341-ab47-57790ca46f2f","html_url":"https://github.com/BewareMyPower/testcontainers-ksn","commit_stats":null,"previous_names":["bewaremypower/testcontainers-ksn"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/BewareMyPower/testcontainers-ksn","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BewareMyPower%2Ftestcontainers-ksn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BewareMyPower%2Ftestcontainers-ksn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BewareMyPower%2Ftestcontainers-ksn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BewareMyPower%2Ftestcontainers-ksn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BewareMyPower","download_url":"https://codeload.github.com/BewareMyPower/testcontainers-ksn/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BewareMyPower%2Ftestcontainers-ksn/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266769630,"owners_count":23981410,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-23T02:00:09.312Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-14T07:44:44.121Z","updated_at":"2025-07-24T00:03:29.516Z","avatar_url":"https://github.com/BewareMyPower.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# testcontainers-ksn\n\nThe testcontainers module for Kafka-on-StreamNative (KSN), which is a private version of [KoP](https://github.com/streamnative/kop).\n\n## Get Started\n\n### Install and import this dependency\n\nThis project requires JDK 8 or higher.\n\nCurrently, this project is not published to Maven Central repository, so you have to install this dependency to your local repository manually:\n\n```bash\nmvn clean install -DskipTests\n```\n\nThen, you can import this dependency as well as the `testcontainers` dependency:\n\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003eorg.testcontainers\u003c/groupId\u003e\n  \u003cartifactId\u003etestcontainers\u003c/artifactId\u003e\n  \u003cversion\u003e1.19.1\u003c/version\u003e\n\u003c/dependency\u003e\n\u003cdependency\u003e\n  \u003cgroupId\u003eio.github.bewaremypower\u003c/groupId\u003e\n  \u003cartifactId\u003etestcontainers-ksn\u003c/artifactId\u003e\n  \u003cversion\u003e0.1.0-SNAPSHOT\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n\u003e **NOTE**:\n\u003e\n\u003e For simplicity, you can just fork this repository and add tests under [the tests directory](./src/test/java/io/github/bewaremypower).\n\n### Start and stop the KoP cluster\n\nAfter importing the dependency, you can set up your test like:\n\n```java\n// Start the KSN cluster. By default, 1 ZK node, 2 bookie nodes and 2 broker nodes will be deployed.\nfinal KsnCluster cluster = new KsnCluster();\n/* TODO: add your tests... */\n// Stop the KSN cluster.\ncluster.close();\n```\n\nYou can customize the configs by passing a customized `KsnClusterConfig` object to the `KsnCluster`'s constructor.\n\n```java\nfinal KsnCluster cluster = new KsnCluster(new KsnClusterConfig()\n        .setNumBrokers(1)\n        .addConfig(\"kafkaTenant\", \"my-tenant\"));\n```\n\nSee [`KsnClusterConfig`](./src/main/java/io/github/bewaremypower/testcontainers/KsnClusterConfig.java) for more details.\n\n### Create a Kafka client to connect a `KsnCluster`\n\n`KsnCluster#getBootstrapServers()` returns the bootstrap servers config to create a Kafka client.\n\nExample:\n\n```java\n// Create a Kafka admin\nfinal Properties adminProps = new Properties();\nadminProps.put(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG, cluster.getBootstrapServers());\nfinal AdminClient client = AdminClient.create(adminProps);\n\n// Create a Kafka producer\nfinal Properties producerProps = new Properties();\nproducerProps.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, cluster.getBootstrapServers());\nproducerProps.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class);\nproducerProps.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, StringSerializer.class);\nfinal KafkaProducer\u003cString, String\u003e producer = new KafkaProducer\u003c\u003e(producerProps);\n\n// Create a Kafka consumer\nfinal Properties consumerProps = new Properties();\nconsumerProps.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, cluster.getBootstrapServers());\nconsumerProps.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class);\nconsumerProps.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class);\nconsumerProps.put(ConsumerConfig.GROUP_ID_CONFIG, \"group\");\nconsumerProps.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, \"earliest\");\nfinal KafkaConsumer\u003cString, String\u003e consumer = new KafkaConsumer\u003c\u003e(consumerProps);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbewaremypower%2Ftestcontainers-ksn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbewaremypower%2Ftestcontainers-ksn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbewaremypower%2Ftestcontainers-ksn/lists"}