test_class.declarator: infos = Arrays.asList(
              new PartitionInfo("topic1", 0, Node.noNode(), new Node[0], new Node[0]),
              new PartitionInfo("topic1", 1, Node.noNode(), new Node[0], new Node[0]),
              new PartitionInfo("topic1", 2, Node.noNode(), new Node[0], new Node[0]),
              new PartitionInfo("topic2", 0, Node.noNode(), new Node[0], new Node[0]),
              new PartitionInfo("topic2", 1, Node.noNode(), new Node[0], new Node[0])
      )
test_class.modifier: private
test_class.original_string: private List<PartitionInfo> infos = Arrays.asList(
              new PartitionInfo("topic1", 0, Node.noNode(), new Node[0], new Node[0]),
              new PartitionInfo("topic1", 1, Node.noNode(), new Node[0], new Node[0]),
              new PartitionInfo("topic1", 2, Node.noNode(), new Node[0], new Node[0]),
              new PartitionInfo("topic2", 0, Node.noNode(), new Node[0], new Node[0]),
              new PartitionInfo("topic2", 1, Node.noNode(), new Node[0], new Node[0])
      );
test_class.type: List<PartitionInfo>
test_class.var_name: infos
test_class.declarator: metadata = new Cluster(Collections.singletonList(Node.noNode()), infos, Collections.<String>emptySet())
test_class.modifier: private
test_class.original_string: private Cluster metadata = new Cluster(Collections.singletonList(Node.noNode()), infos, Collections.<String>emptySet());
test_class.type: Cluster
test_class.var_name: metadata
test_class.file: streams/src/test/java/org/apache/kafka/streams/processor/DefaultPartitionGrouperTest.java
test_class.identifier: DefaultPartitionGrouperTest
test_case.body: @Test
      public void testGrouping() {
          PartitionGrouper grouper = new DefaultPartitionGrouper();
          int topicGroupId;
          Map<TaskId, Set<TopicPartition>> expectedPartitionsForTask;
          Map<Integer, Set<String>> topicGroups;
  
          topicGroups = new HashMap<>();
          topicGroups.put(0, mkSet("topic1"));
          topicGroups.put(1, mkSet("topic2"));
  
          expectedPartitionsForTask = new HashMap<>();
          topicGroupId = 0;
          expectedPartitionsForTask.put(new TaskId(topicGroupId, 0), mkSet(new TopicPartition("topic1", 0)));
          expectedPartitionsForTask.put(new TaskId(topicGroupId, 1), mkSet(new TopicPartition("topic1", 1)));
          expectedPartitionsForTask.put(new TaskId(topicGroupId, 2), mkSet(new TopicPartition("topic1", 2)));
          topicGroupId++;
          expectedPartitionsForTask.put(new TaskId(topicGroupId, 0), mkSet(new TopicPartition("topic2", 0)));
          expectedPartitionsForTask.put(new TaskId(topicGroupId, 1), mkSet(new TopicPartition("topic2", 1)));
  
          assertEquals(expectedPartitionsForTask, grouper.partitionGroups(topicGroups, metadata));
  
          topicGroups = new HashMap<>();
          topicGroups.put(0, mkSet("topic1", "topic2"));
  
          expectedPartitionsForTask = new HashMap<>();
          topicGroupId = 0;
          expectedPartitionsForTask.put(new TaskId(topicGroupId, 0), mkSet(new TopicPartition("topic1", 0), new TopicPartition("topic2", 0)));
          expectedPartitionsForTask.put(new TaskId(topicGroupId, 1), mkSet(new TopicPartition("topic1", 1), new TopicPartition("topic2", 1)));
          expectedPartitionsForTask.put(new TaskId(topicGroupId, 2), mkSet(new TopicPartition("topic1", 2)));
  
          assertEquals(expectedPartitionsForTask, grouper.partitionGroups(topicGroups, metadata));
      }
test_case.class_method_signature: DefaultPartitionGrouperTest.testGrouping()
test_case.full_signature: @Test public void testGrouping()
test_case.identifier: testGrouping
test_case.invocations: put mkSet put mkSet put mkSet put mkSet put mkSet put mkSet put mkSet assertEquals partitionGroups put mkSet put mkSet put mkSet put mkSet assertEquals partitionGroups
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testGrouping()
focal_class.file: streams/src/main/java/org/apache/kafka/streams/processor/DefaultPartitionGrouper.java
focal_class.identifier: DefaultPartitionGrouper
focal_class.interfaces: implements PartitionGrouper
focal_class.class_method_signature: DefaultPartitionGrouper.partitionGroups(Map<Integer, Set<String>> topicGroups, Cluster metadata)
focal_class.full_signature: public Map<TaskId, Set<TopicPartition>> partitionGroups(Map<Integer, Set<String>> topicGroups, Cluster metadata)
focal_class.identifier: partitionGroups
focal_class.modifiers: public
focal_class.parameters: (Map<Integer, Set<String>> topicGroups, Cluster metadata)
focal_class.return: Map<TaskId, Set<TopicPartition>>
focal_class.signature: Map<TaskId, Set<TopicPartition>> partitionGroups(Map<Integer, Set<String>> topicGroups, Cluster metadata)
focal_class.class_method_signature: DefaultPartitionGrouper.maxNumPartitions(Cluster metadata, Set<String> topics)
focal_class.full_signature: protected int maxNumPartitions(Cluster metadata, Set<String> topics)
focal_class.identifier: maxNumPartitions
focal_class.modifiers: protected
focal_class.parameters: (Cluster metadata, Set<String> topics)
focal_class.return: int
focal_class.signature: int maxNumPartitions(Cluster metadata, Set<String> topics)
focal_method.body: public Map<TaskId, Set<TopicPartition>> partitionGroups(Map<Integer, Set<String>> topicGroups, Cluster metadata) {
          Map<TaskId, Set<TopicPartition>> groups = new HashMap<>();
  
          for (Map.Entry<Integer, Set<String>> entry : topicGroups.entrySet()) {
              Integer topicGroupId = entry.getKey();
              Set<String> topicGroup = entry.getValue();
  
              int maxNumPartitions = maxNumPartitions(metadata, topicGroup);
  
              for (int partitionId = 0; partitionId < maxNumPartitions; partitionId++) {
                  Set<TopicPartition> group = new HashSet<>(topicGroup.size());
  
                  for (String topic : topicGroup) {
                      if (partitionId < metadata.partitionsForTopic(topic).size()) {
                          group.add(new TopicPartition(topic, partitionId));
                      }
                  }
                  groups.put(new TaskId(topicGroupId, partitionId), Collections.unmodifiableSet(group));
              }
          }
  
          return Collections.unmodifiableMap(groups);
      }
focal_method.class_method_signature: DefaultPartitionGrouper.partitionGroups(Map<Integer, Set<String>> topicGroups, Cluster metadata)
focal_method.full_signature: public Map<TaskId, Set<TopicPartition>> partitionGroups(Map<Integer, Set<String>> topicGroups, Cluster metadata)
focal_method.identifier: partitionGroups
focal_method.invocations: entrySet getKey getValue maxNumPartitions size size partitionsForTopic add put unmodifiableSet unmodifiableMap
focal_method.modifiers: public
focal_method.parameters: (Map<Integer, Set<String>> topicGroups, Cluster metadata)
focal_method.return: Map<TaskId, Set<TopicPartition>>
focal_method.signature: Map<TaskId, Set<TopicPartition>> partitionGroups(Map<Integer, Set<String>> topicGroups, Cluster metadata)