test_class.declarator: NUM_BROKERS = 3
test_class.modifier: private static final
test_class.original_string: private static final int NUM_BROKERS = 3;
test_class.type: int
test_class.var_name: NUM_BROKERS
test_class.declarator: NUM_ZK = 3
test_class.modifier: private static final
test_class.original_string: private static final int NUM_ZK = 3;
test_class.type: int
test_class.var_name: NUM_ZK
test_class.declarator: DEFAULT_PARTITIONS = 2
test_class.modifier: private static final
test_class.original_string: private static final int DEFAULT_PARTITIONS = 2;
test_class.type: int
test_class.var_name: DEFAULT_PARTITIONS
test_class.declarator: DEFAULT_REPLICATION_FACTOR = 3
test_class.modifier: private static final
test_class.original_string: private static final int DEFAULT_REPLICATION_FACTOR = 3;
test_class.type: int
test_class.var_name: DEFAULT_REPLICATION_FACTOR
test_class.declarator: TIMEOUT_MS = 20000
test_class.modifier: private static final
test_class.original_string: private static final Integer TIMEOUT_MS = 20000;
test_class.type: Integer
test_class.var_name: TIMEOUT_MS
test_class.declarator: kafka
test_class.modifier: private static
test_class.original_string: private static EmbeddedKafkaCluster kafka;
test_class.type: EmbeddedKafkaCluster
test_class.var_name: kafka
test_class.declarator: topicEnsure
test_class.modifier: private static
test_class.original_string: private static TopicEnsure topicEnsure;
test_class.type: TopicEnsure
test_class.var_name: topicEnsure
test_class.file: utility-belt/src/test/java/io/confluent/admin/utils/TopicEnsureTest.java
test_class.identifier: TopicEnsureTest
test_case.body: @Test(expected = Exception.class)
    public void testValidateNonexistentTopic() throws Exception {
      assertFalse(topicEnsure.validateTopic(simpleTopicSpec("unknown-topic"), TIMEOUT_MS));
    }
test_case.class_method_signature: TopicEnsureTest.testValidateNonexistentTopic()
test_case.full_signature: @Test(expected = Exception.class) public void testValidateNonexistentTopic()
test_case.identifier: testValidateNonexistentTopic
test_case.invocations: assertFalse validateTopic simpleTopicSpec
test_case.modifiers: @Test(expected = Exception.class) public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testValidateNonexistentTopic()
focal_class.declarator: adminClient
focal_class.modifier: private final
focal_class.original_string: private final AdminClient adminClient;
focal_class.type: AdminClient
focal_class.var_name: adminClient
focal_class.file: utility-belt/src/main/java/io/confluent/admin/utils/TopicEnsure.java
focal_class.identifier: TopicEnsure
focal_class.class_method_signature: TopicEnsure.TopicEnsure(Properties props)
focal_class.full_signature: public  TopicEnsure(Properties props)
focal_class.identifier: TopicEnsure
focal_class.modifiers: public
focal_class.parameters: (Properties props)
focal_class.signature:  TopicEnsure(Properties props)
focal_class.class_method_signature: TopicEnsure.createTopic(TopicSpec spec, int timeOut)
focal_class.full_signature: public boolean createTopic(TopicSpec spec, int timeOut)
focal_class.identifier: createTopic
focal_class.modifiers: public
focal_class.parameters: (TopicSpec spec, int timeOut)
focal_class.return: boolean
focal_class.signature: boolean createTopic(TopicSpec spec, int timeOut)
focal_class.class_method_signature: TopicEnsure.validateTopic(TopicSpec spec, int timeOut)
focal_class.full_signature: public boolean validateTopic(TopicSpec spec, int timeOut)
focal_class.identifier: validateTopic
focal_class.modifiers: public
focal_class.parameters: (TopicSpec spec, int timeOut)
focal_class.return: boolean
focal_class.signature: boolean validateTopic(TopicSpec spec, int timeOut)
focal_class.class_method_signature: TopicEnsure.topicExists(TopicSpec spec, Integer timeOut)
focal_class.full_signature: public boolean topicExists(TopicSpec spec, Integer timeOut)
focal_class.identifier: topicExists
focal_class.modifiers: public
focal_class.parameters: (TopicSpec spec, Integer timeOut)
focal_class.return: boolean
focal_class.signature: boolean topicExists(TopicSpec spec, Integer timeOut)
focal_method.body: public boolean validateTopic(TopicSpec spec, int timeOut) throws Exception {
      // Describe topic.
      DescribeTopicsResult topicDescribeResult = adminClient.describeTopics(
          Collections.singletonList(spec.name()), new DescribeTopicsOptions().timeoutMs(timeOut)
      );
      TopicDescription topic = topicDescribeResult.all().get().get(spec.name());
  
      // Get topic config.
      ConfigResource configResource = new ConfigResource(ConfigResource.Type.TOPIC, spec.name());
      DescribeConfigsResult configResult = adminClient.describeConfigs(
          Collections.singletonList(configResource)
      );
      Map<ConfigResource, Config> resultMap = configResult.all().get();
      Config config = resultMap.get(configResource);
  
      // Create actual TopicSpec.
      Map<String, String> actualConfig = new HashMap<>();
      for (Map.Entry<String, String> entry : spec.config().entrySet()) {
        ConfigEntry actualConfigEntry = config.get(entry.getKey());
        if (actualConfigEntry != null) {
          actualConfig.put(entry.getKey(), actualConfigEntry.value());
        }
      }
  
      TopicSpec actualSpec = new TopicSpec(
          topic.name(), topic.partitions().size(),
          topic.partitions().get(0).replicas().size(), actualConfig
      );
  
      boolean isTopicValid = actualSpec.equals(spec);
      if (!isTopicValid) {
        System.err.printf(
            "Invalid topic [ %s ] ! Expected %s but got %s\n", spec.name(), spec, actualSpec
        );
      }
  
      return isTopicValid;
    }
focal_method.class_method_signature: TopicEnsure.validateTopic(TopicSpec spec, int timeOut)
focal_method.full_signature: public boolean validateTopic(TopicSpec spec, int timeOut)
focal_method.identifier: validateTopic
focal_method.invocations: describeTopics singletonList name timeoutMs get get all name name describeConfigs singletonList get all get entrySet config get getKey put getKey value name size partitions size replicas get partitions equals printf name
focal_method.modifiers: public
focal_method.parameters: (TopicSpec spec, int timeOut)
focal_method.return: boolean
focal_method.signature: boolean validateTopic(TopicSpec spec, int timeOut)