Package io.strimzi.systemtest.utils.kafkaUtils

## Class KafkaUtils

- java.lang.Object
- - io.strimzi.systemtest.utils.kafkaUtils.KafkaUtils

-     public class KafkaUtils
      extends Object

- - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static String` | `changeOrRemoveKafkaVersion​(File file, String version)` |
    `static String` | `generateRandomNameOfKafka​(String clusterName)` | Generated random name for the Kafka resource based on prefix
    `static Map<String,​io.strimzi.kafka.config.model.ConfigModel>` | `getDynamicConfigurationProperties​(String kafkaVersion)` | Return dynamic Kafka configs supported by the the given version of Kafka.
    `static String` | `getKafkaSecretCertificates​(String secretName, String certType)` |
    `static String` | `getKafkaStatusCertificates​(String listenerType, String namespace, String clusterName)` |
    `static String` | `getVersionFromKafkaPodLibs​(String kafkaPodName)` |
    `static Map<String,​io.strimzi.kafka.config.model.ConfigModel>` | `readConfigModel​(String kafkaVersion)` | Loads all kafka config parameters supported by the given `kafkaVersion`, as generated by #KafkaConfigModelGenerator in config-model-generator.
    `static void` | `updateConfigurationWithStabilityWait​(String clusterName, String brokerConfigName, Object value)` | Method which, extends the @link updateConfiguration(String clusterName, KafkaConfiguration kafkaConfiguration, Object value) method with stability and ensures after update of Kafka resource there will be not rolling update
    `static void` | `updateSpecificConfiguration​(String clusterName, String brokerConfigName, Object value)` | Method which, update/replace Kafka configuration
    `static boolean` | `verifyCrDynamicConfiguration​(String clusterName, String brokerConfigName, Object value)` | Verifies that updated configuration was successfully changed inside Kafka CR
    `static boolean` | `verifyPodDynamicConfiguration​(String kafkaPodNamePrefix, String brokerConfigName, Object value)` | Verifies that updated configuration was successfully changed inside Kafka pods
    `static void` | `waitForClusterStability​(String clusterName)` |
    `static void` | `waitForKafkaDeletion​(String kafkaClusterName)` |
    `static void` | `waitForKafkaNotReady​(String clusterName)` |
    `static void` | `waitForKafkaReady​(String clusterName)` |
    `static void` | `waitForKafkaStatus​(String clusterName, Enum<?> state)` |
    `static void` | `waitForKafkaStatusUpdate​(String clusterName)` | Waits for the Kafka Status to be updated after changed.
    `static void` | `waitForZkMntr​(String clusterName, Pattern pattern, int... podIndexes)` |
    `static void` | `waitUntilKafkaStatusConditionContainsMessage​(String clusterName, String namespace, String message)` |
    `static void` | `waitUntilKafkaStatusConditionContainsMessage​(String clusterName, String namespace, String message, long timeout)` |

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### waitForKafkaReady

          public static void waitForKafkaReady​(String clusterName)

    - #### waitForKafkaNotReady

          public static void waitForKafkaNotReady​(String clusterName)

    - #### waitForKafkaStatus

          public static void waitForKafkaStatus​(String clusterName,
                                                Enum<?> state)

    - #### waitForKafkaStatusUpdate

          public static void waitForKafkaStatusUpdate​(String clusterName)

      Waits for the Kafka Status to be updated after changed. It checks the generation and observed generation to ensure the status is up to date.
      Parameters:
        `clusterName` - Name of the Kafka cluster which should be checked

    - #### waitUntilKafkaStatusConditionContainsMessage

          public static void waitUntilKafkaStatusConditionContainsMessage​(String clusterName,
                                                                          String namespace,
                                                                          String message,
                                                                          long timeout)

    - #### waitUntilKafkaStatusConditionContainsMessage

          public static void waitUntilKafkaStatusConditionContainsMessage​(String clusterName,
                                                                          String namespace,
                                                                          String message)

    - #### waitForZkMntr

          public static void waitForZkMntr​(String clusterName,
                                           Pattern pattern,
                                           int... podIndexes)

    - #### getKafkaStatusCertificates

          public static String getKafkaStatusCertificates​(String listenerType,
                                                          String namespace,
                                                          String clusterName)

    - #### getKafkaSecretCertificates

          public static String getKafkaSecretCertificates​(String secretName,
                                                          String certType)

    - #### waitForClusterStability

          public static void waitForClusterStability​(String clusterName)

    - #### updateSpecificConfiguration

          public static void updateSpecificConfiguration​(String clusterName,
                                                         String brokerConfigName,
                                                         Object value)

      Method which, update/replace Kafka configuration
      Parameters:
        `clusterName` - name of the cluster where Kafka resource can be found
        `brokerConfigName` - key of specific property
        `value` - value of specific property

    - #### updateConfigurationWithStabilityWait

          public static void updateConfigurationWithStabilityWait​(String clusterName,
                                                                  String brokerConfigName,
                                                                  Object value)

      Method which, extends the @link updateConfiguration(String clusterName, KafkaConfiguration kafkaConfiguration, Object value) method with stability and ensures after update of Kafka resource there will be not rolling update
      Parameters:
        `clusterName` - name of the cluster where Kafka resource can be found
        `brokerConfigName` - key of specific property
        `value` - value of specific property

    - #### verifyCrDynamicConfiguration

          public static boolean verifyCrDynamicConfiguration​(String clusterName,
                                                             String brokerConfigName,
                                                             Object value)

      Verifies that updated configuration was successfully changed inside Kafka CR
      Parameters:
        `brokerConfigName` - key of specific property
        `value` - value of specific property

    - #### verifyPodDynamicConfiguration

          public static boolean verifyPodDynamicConfiguration​(String kafkaPodNamePrefix,
                                                              String brokerConfigName,
                                                              Object value)

      Verifies that updated configuration was successfully changed inside Kafka pods
      Parameters:
        `kafkaPodNamePrefix` - prefix of Kafka pods
        `brokerConfigName` - key of specific property
        `value` - value of specific property
      Returns:
        true = if specific property match the excepted property false = if specific property doesn't match the excepted property

    - #### readConfigModel

          public static Map<String,​io.strimzi.kafka.config.model.ConfigModel> readConfigModel​(String kafkaVersion)

      Loads all kafka config parameters supported by the given `kafkaVersion`, as generated by #KafkaConfigModelGenerator in config-model-generator.
      Parameters:
        `kafkaVersion` - specific kafka version
      Returns:
        all supported kafka properties

    - #### getDynamicConfigurationProperties

          public static Map<String,​io.strimzi.kafka.config.model.ConfigModel> getDynamicConfigurationProperties​(String kafkaVersion)

      Return dynamic Kafka configs supported by the the given version of Kafka.
      Parameters:
        `kafkaVersion` - specific kafka version
      Returns:
        all dynamic properties for specific kafka version

    - #### generateRandomNameOfKafka

          public static String generateRandomNameOfKafka​(String clusterName)

      Generated random name for the Kafka resource based on prefix
      Parameters:
        `clusterName` - name prefix
      Returns:
        name with prefix and random salt

    - #### getVersionFromKafkaPodLibs

          public static String getVersionFromKafkaPodLibs​(String kafkaPodName)

    - #### waitForKafkaDeletion

          public static void waitForKafkaDeletion​(String kafkaClusterName)

    - #### changeOrRemoveKafkaVersion

          public static String changeOrRemoveKafkaVersion​(File file,
                                                          String version)