/*
 * Copyright Strimzi authors.
 * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html).
 */
package io.strimzi.systemtest.specific;

import io.strimzi.api.kafka.model.KafkaResources;
import io.strimzi.systemtest.resources.operator.HelmResource;
import io.strimzi.systemtest.AbstractST;
import io.strimzi.systemtest.utils.kubeUtils.controllers.StatefulSetUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import io.strimzi.systemtest.resources.crd.KafkaResource;
import io.strimzi.systemtest.resources.crd.KafkaTopicResource;

import static io.strimzi.systemtest.Constants.HELM;

@Tag(HELM)
class HelmChartST extends AbstractST {

    private static final Logger LOGGER = LogManager.getLogger(HelmChartST.class);

    static final String NAMESPACE = "helm-chart-cluster-test";

    @Test
    void testDeployKafkaClusterViaHelmChart() {
        KafkaResource.createAndWaitForReadiness(KafkaResource.kafkaEphemeral(clusterName, 3).build());
        KafkaTopicResource.createAndWaitForReadiness(KafkaTopicResource.topic(clusterName, TOPIC_NAME).build());
        StatefulSetUtils.waitForAllStatefulSetPodsReady(KafkaResources.zookeeperStatefulSetName(clusterName), 3);
        StatefulSetUtils.waitForAllStatefulSetPodsReady(KafkaResources.kafkaStatefulSetName(clusterName), 3);
    }

    @BeforeAll
    void setup() {
        LOGGER.info("Creating resources before the test class");
        cluster.createNamespace(NAMESPACE);
        HelmResource.clusterOperator();
    }

    @Override
    protected void tearDownEnvironmentAfterAll() {
        cluster.deleteNamespaces();
    }
}

@@ -256,155 +256,381 @@
 est.
-resources.operator.HelmResource;%0Aimport io.strimzi.systemtest.AbstractST;%0Aimport io.strimzi.systemtest.utils.kubeUtils.controllers.StatefulSetUtils
+Constants;%0Aimport io.strimzi.systemtest.resources.crd.KafkaBridgeResource;%0Aimport io.strimzi.systemtest.resources.crd.KafkaClientsResource;%0Aimport io.strimzi.systemtest.resources.crd.KafkaConnectResource;%0Aimport io.strimzi.systemtest.resources.crd.KafkaConnectorResource;%0Aimport io.strimzi.systemtest.resources.operator.HelmResource;%0Aimport io.strimzi.systemtest.AbstractST
 ;%0Aim
@@ -998,18 +998,93 @@
 LM;%0A
-%0A@Tag(HELM
+import static io.strimzi.systemtest.Constants.REGRESSION;%0A%0A@Tag(HELM)%0A@Tag(REGRESSION
 )%0Acl
@@ -1295,42 +1295,88 @@
 test
-DeployKafkaClusterViaHelmChart() %7B
+StrimziComponentsViaHelmChart() %7B%0A        // Deploy Kafka and wait for readiness
 %0A   
@@ -1600,95 +1600,554 @@
     
-StatefulSetUtils.waitForAllStatefulSetPodsReady(KafkaResources.zookeeperStatefulSetName
+// Deploy KafkaConnect and wait for readiness%0A        KafkaClientsResource.createAndWaitForReadiness(KafkaClientsResource.deployKafkaClients(true, clusterName + %22-%22 + Constants.KAFKA_CLIENTS).build());%0A        KafkaConnectResource.createAndWaitForReadiness(KafkaConnectResource.kafkaConnect(clusterName, 1)%0A            .editMetadata()%0A                .addToAnnotations(%22strimzi.io/use-connector-resources%22, %22true%22)%0A            .endMetadata().build());%0A        KafkaConnectorResource.createAndWaitForReadiness(KafkaConnectorResource.kafkaConnector
 (clu
@@ -2151,27 +2151,32 @@
 clusterName)
-, 3
+.build()
 );%0A        S
@@ -2178,69 +2178,155 @@
     
-StatefulSetUtils.waitForAllStatefulSetPodsReady(Kafka
+// Deploy KafkaBridge (different image than Kafka) and wait for readiness%0A        KafkaBridgeResource.createAndWaitForReadiness(KafkaBridge
 Resource
 s.ka
@@ -2325,30 +2325,70 @@
 urce
-s
 .kafka
-StatefulSetName
+Bridge(clusterName, KafkaResources.plainBootstrapAddress
 (clu
@@ -2398,17 +2398,26 @@
 rName), 
-3
+1).build()
 );%0A    %7D

Enhance HelmChartST and add regression tag (#4504)