Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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 @@ -41,6 +41,15 @@ public class ConsumerGroupDescription {
private final Set<AclOperation> authorizedOperations;

public ConsumerGroupDescription(String groupId,
boolean isSimpleConsumerGroup,
Collection<MemberDescription> members,
String partitionAssignor,
ConsumerGroupState state,
Node coordinator) {
this(groupId, isSimpleConsumerGroup, members, partitionAssignor, state, coordinator, Collections.emptySet());
}

ConsumerGroupDescription(String groupId,
boolean isSimpleConsumerGroup,
Collection<MemberDescription> members,
String partitionAssignor,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.apache.kafka.common.acl.AclOperation;
import org.apache.kafka.common.utils.Utils;

import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Set;
Expand Down Expand Up @@ -50,6 +51,18 @@ public int hashCode() {
return Objects.hash(name, internal, partitions, authorizedOperations);
}

/**
* Create an instance with the specified parameters.
*
* @param name The topic name
* @param internal Whether the topic is internal to Kafka
* @param partitions A list of partitions where the index represents the partition id and the element contains
* leadership and replica information for that partition.
*/
public TopicDescription(String name, boolean internal, List<TopicPartitionInfo> partitions) {
this(name, internal, partitions, Collections.emptySet());
}

/**
* Create an instance with the specified parameters.
*
Expand All @@ -59,7 +72,7 @@ public int hashCode() {
* leadership and replica information for that partition.
* @param authorizedOperations authorized operations for this topic
*/
public TopicDescription(String name, boolean internal, List<TopicPartitionInfo> partitions,
TopicDescription(String name, boolean internal, List<TopicPartitionInfo> partitions,
Set<AclOperation> authorizedOperations) {
this.name = name;
this.internal = internal;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,17 +113,17 @@ public void shouldCreateRequiredTopics() throws Exception {
{
add(new TopicPartitionInfo(0, broker1, singleReplica, Collections.<Node>emptyList()));
}
}, Collections.emptySet()), mockAdminClient.describeTopics(Collections.singleton(topic)).values().get(topic).get());
}), mockAdminClient.describeTopics(Collections.singleton(topic)).values().get(topic).get());
assertEquals(new TopicDescription(topic2, false, new ArrayList<TopicPartitionInfo>() {
{
add(new TopicPartitionInfo(0, broker1, singleReplica, Collections.<Node>emptyList()));
}
}, Collections.emptySet()), mockAdminClient.describeTopics(Collections.singleton(topic2)).values().get(topic2).get());
}), mockAdminClient.describeTopics(Collections.singleton(topic2)).values().get(topic2).get());
assertEquals(new TopicDescription(topic3, false, new ArrayList<TopicPartitionInfo>() {
{
add(new TopicPartitionInfo(0, broker1, singleReplica, Collections.<Node>emptyList()));
}
}, Collections.emptySet()), mockAdminClient.describeTopics(Collections.singleton(topic3)).values().get(topic3).get());
}), mockAdminClient.describeTopics(Collections.singleton(topic3)).values().get(topic3).get());

final ConfigResource resource = new ConfigResource(ConfigResource.Type.TOPIC, topic);
final ConfigResource resource2 = new ConfigResource(ConfigResource.Type.TOPIC, topic2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ public void testCreateOneTopic() throws Throwable {
new TopicDescription(
TEST_TOPIC, false,
Collections.singletonList(
new TopicPartitionInfo(0, broker1, singleReplica, Collections.<Node>emptyList())),
Collections.emptySet()),
new TopicPartitionInfo(0, broker1, singleReplica, Collections.<Node>emptyList()))),
adminClient.describeTopics(
Collections.singleton(TEST_TOPIC)).values().get(TEST_TOPIC).get()
);
Expand All @@ -99,8 +98,7 @@ public void testCreateRetriesOnTimeout() throws Throwable {
new TopicDescription(
TEST_TOPIC, false,
Collections.singletonList(
new TopicPartitionInfo(0, broker1, singleReplica, Collections.<Node>emptyList())),
Collections.emptySet()),
new TopicPartitionInfo(0, broker1, singleReplica, Collections.<Node>emptyList()))),
adminClient.describeTopics(
Collections.singleton(TEST_TOPIC)).values().get(TEST_TOPIC).get()
);
Expand Down Expand Up @@ -180,8 +178,7 @@ public void testCreatesNotExistingTopics() throws Throwable {
new TopicDescription(
TEST_TOPIC, false,
Collections.singletonList(
new TopicPartitionInfo(0, broker1, singleReplica, Collections.<Node>emptyList())),
Collections.emptySet()),
new TopicPartitionInfo(0, broker1, singleReplica, Collections.<Node>emptyList()))),
adminClient.describeTopics(Collections.singleton(TEST_TOPIC)).values().get(TEST_TOPIC).get()
);
}
Expand Down