Skip to content

Commit

Permalink
tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
chia7712 committed Mar 8, 2024
1 parent 35aff76 commit 9bc33b8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
3 changes: 2 additions & 1 deletion gradle/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def versions = [
"jmh-core" : project.properties['jmh-core.version'] ?: "1.36",
"jmh-generator-annprocess": project.properties['jmh-generator.version'] ?: "1.36",
junit : project.properties['junit.version'] ?: "5.9.3",
kafka : project.properties['kafka.version'] ?: "3.5.1",
kafka : project.properties['kafka.version'] ?: "3.7.0",
mockito : project.properties['mockito.version'] ?: "5.4.0",
"mockito-inline" : project.properties['mockito.version'] ?: "5.2.0",
scala : project.properties['scala.version'] ?: "2.13.11",
Expand All @@ -57,6 +57,7 @@ libs += [
"kafka-connect-runtime" : "org.apache.kafka:connect-runtime:${versions["kafka"]}",
"kafka-core" : "org.apache.kafka:kafka_2.13:${versions["kafka"]}",
"kafka-server-common" : "org.apache.kafka:kafka-server-common:${versions["kafka"]}",
"kafka-metadata" : "org.apache.kafka:kafka-metadata:${versions["kafka"]}",
"mockito-core" : "org.mockito:mockito-core:${versions["mockito"]}",
"mockito-inline" : "org.mockito:mockito-inline:${versions["mockito-inline"]}",
scala : "org.scala-lang:scala-library:${versions["scala"]}",
Expand Down
1 change: 1 addition & 0 deletions it/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ dependencies {
implementation libs["junit"]
implementation libs["kafka-core"]
implementation libs["kafka-server-common"]
implementation libs["kafka-metadata"]
implementation libs["kafka-connect-runtime"]
implementation libs["kafka-connect-json"]
implementation libs["hadoop-minicluster"]
Expand Down
14 changes: 11 additions & 3 deletions it/src/main/java/org/astraea/it/BrokerCluster.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,32 @@
import java.util.stream.IntStream;
import kafka.server.KafkaConfig;
import kafka.server.KafkaRaftServer;
import kafka.server.MetaProperties;
import kafka.server.Server;
import kafka.tools.StorageTool;
import org.apache.kafka.common.DirectoryId;
import org.apache.kafka.common.Uuid;
import org.apache.kafka.common.utils.SystemTime;
import org.apache.kafka.metadata.properties.MetaProperties;
import org.apache.kafka.metadata.properties.MetaPropertiesVersion;
import org.apache.kafka.server.common.MetadataVersion;

public interface BrokerCluster extends AutoCloseable {

private static CompletableFuture<Map.Entry<Integer, Server>> server(
Map<String, String> configs, Set<String> folders, String clusterId, int nodeId) {

StorageTool.formatCommand(
new PrintStream(new ByteArrayOutputStream()),
scala.collection.JavaConverters.collectionAsScalaIterableConverter(folders)
.asScala()
.toSeq(),
new MetaProperties(clusterId, nodeId),
MetadataVersion.latest(),
new MetaProperties.Builder()
.setVersion(MetaPropertiesVersion.V1)
.setClusterId(clusterId)
.setNodeId(nodeId)
.setDirectoryId(DirectoryId.random())
.build(),
MetadataVersion.latestProduction(),
true);

return CompletableFuture.supplyAsync(
Expand Down

0 comments on commit 9bc33b8

Please sign in to comment.