Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,11 @@ public boolean equals(Object o) {
public int hashCode() {
return Objects.hash(currentReplicas, targetReplicas, done);
}

@Override
public String toString() {
return "currentReplicas=" + currentReplicas + ", "
+ "targetReplicas=" + targetReplicas + ", "
+ "done=" + done;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,12 @@ public boolean equals(Object o) {
public int hashCode() {
return Objects.hash(partStates, partsOngoing, moveStates, movesOngoing);
}

@Override
public String toString() {
return "partStates=" + partStates + ", "
+ "partsOngoing=" + partsOngoing + ", "
+ "moveStates=" + moveStates + ", "
+ "movesOngoing=" + movesOngoing;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,18 @@ public void testGenerateAssignmentWithBootstrapServer() throws Exception {
produceMessages(foo0.topic(), foo0.partition(), 100);

try (Admin admin = Admin.create(Map.of(CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG, clusterInstance.bootstrapServers()))) {
String assignment = "{\"version\":1,\"partitions\":" +
"[{\"topic\":\"foo\",\"partition\":0,\"replicas\":[3,1,2],\"log_dirs\":[\"any\",\"any\",\"any\"]}" +
"]}";
generateAssignment(admin, assignment, "1,2,3", false);
String topicsToMoveJson = "{\"topics\":\n\t[{\"topic\": \"foo\"}],\n\"version\":1\n}";
var assignment = generateAssignment(admin, topicsToMoveJson, "1,2,3", false);
Map<TopicPartition, List<Integer>> proposedAssignments = assignment.getKey();
String assignmentJson = String.format("{\"version\":1,\"partitions\":" +
"[{\"topic\":\"foo\",\"partition\":0,\"replicas\":%s,\"log_dirs\":[\"any\",\"any\",\"any\"]}" +
"]}", proposedAssignments.get(foo0));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not easy to read. Can we use the text block feature from Java 17?

For example:

            String assignmentJson = String.format("""
                {"version":1,"partitions":\
                [{"topic":"foo","partition":0,"replicas":%s,"log_dirs":["any","any","any"]}\
                ]}""", proposedAssignments.get(foo0));


runExecuteAssignment(false, assignmentJson, -1L, -1L);

Map<TopicPartition, PartitionReassignmentState> finalAssignment = Map.of(foo0,
new PartitionReassignmentState(List.of(0, 1, 2), List.of(3, 1, 2), true));
waitForVerifyAssignment(admin, assignment, false,
new PartitionReassignmentState(proposedAssignments.get(foo0), proposedAssignments.get(foo0), true));
waitForVerifyAssignment(admin, assignmentJson, false,
new VerifyAssignmentResult(finalAssignment));
}
}
Expand Down
Loading