@Test public void testDefaultValues() { KafkaMirrorMaker2Cluster kmm2 = KafkaMirrorMaker2Cluster.fromCrd(ResourceUtils.createEmptyKafkaMirrorMaker2(namespace, cluster), VERSIONS); assertThat(kmm2.image, is(KafkaVersionTestUtils.DEFAULT_KAFKA_CONNECT_IMAGE)); assertThat(kmm2.replicas, is(KafkaMirrorMaker2Cluster.DEFAULT_REPLICAS)); assertThat(kmm2.readinessProbeOptions.getInitialDelaySeconds(), is(KafkaMirrorMaker2Cluster.DEFAULT_HEALTHCHECK_DELAY)); assertThat(kmm2.readinessProbeOptions.getTimeoutSeconds(), is(KafkaMirrorMaker2Cluster.DEFAULT_HEALTHCHECK_TIMEOUT)); assertThat(kmm2.livenessProbeOptions.getInitialDelaySeconds(), is(KafkaMirrorMaker2Cluster.DEFAULT_HEALTHCHECK_DELAY)); assertThat(kmm2.livenessProbeOptions.getTimeoutSeconds(), is(KafkaMirrorMaker2Cluster.DEFAULT_HEALTHCHECK_TIMEOUT)); assertThat(kmm2.getConfiguration().asOrderedProperties(), is(defaultConfiguration)); }
public static KafkaMirrorMaker2Cluster fromCrd(KafkaMirrorMaker2 kafkaMirrorMaker2, KafkaVersion.Lookup versions) { KafkaMirrorMaker2Cluster cluster = new KafkaMirrorMaker2Cluster(kafkaMirrorMaker2); KafkaMirrorMaker2Spec spec = kafkaMirrorMaker2.getSpec(); cluster.setOwnerReference(kafkaMirrorMaker2); String specVersion = spec.getVersion(); if (versions.version(specVersion).compareVersion("2.4.0") < 0) { throw new InvalidResourceException("Kafka MirrorMaker 2.0 is not available in the version at spec.version (" + specVersion + "). Kafka MirrorMaker 2.0 is available in Kafka version 2.4.0 and later."); } cluster.setImage(versions.kafkaMirrorMaker2Version(spec.getImage(), specVersion)); List<KafkaMirrorMaker2ClusterSpec> clustersList = ModelUtils.asListOrEmptyList(spec.getClusters()); cluster.setClusters(clustersList); KafkaMirrorMaker2ClusterSpec connectCluster = new KafkaMirrorMaker2ClusterSpecBuilder().build(); String connectClusterAlias = spec.getConnectCluster(); if (connectClusterAlias != null) { connectCluster = clustersList.stream() .filter(clustersListItem -> spec.getConnectCluster().equals(clustersListItem.getAlias())) .findFirst() .orElseThrow(() -> new InvalidResourceException("connectCluster with alias " + connectClusterAlias + " cannot be found in the list of clusters at spec.clusters")); } cluster.setConfiguration(new KafkaMirrorMaker2Configuration(connectCluster.getConfig().entrySet())); return fromSpec(buildKafkaConnectSpec(spec, connectCluster), versions, cluster); }
KafkaMirrorMaker2Cluster extends KafkaConnectCluster { public static KafkaMirrorMaker2Cluster fromCrd(KafkaMirrorMaker2 kafkaMirrorMaker2, KafkaVersion.Lookup versions) { KafkaMirrorMaker2Cluster cluster = new KafkaMirrorMaker2Cluster(kafkaMirrorMaker2); KafkaMirrorMaker2Spec spec = kafkaMirrorMaker2.getSpec(); cluster.setOwnerReference(kafkaMirrorMaker2); String specVersion = spec.getVersion(); if (versions.version(specVersion).compareVersion("2.4.0") < 0) { throw new InvalidResourceException("Kafka MirrorMaker 2.0 is not available in the version at spec.version (" + specVersion + "). Kafka MirrorMaker 2.0 is available in Kafka version 2.4.0 and later."); } cluster.setImage(versions.kafkaMirrorMaker2Version(spec.getImage(), specVersion)); List<KafkaMirrorMaker2ClusterSpec> clustersList = ModelUtils.asListOrEmptyList(spec.getClusters()); cluster.setClusters(clustersList); KafkaMirrorMaker2ClusterSpec connectCluster = new KafkaMirrorMaker2ClusterSpecBuilder().build(); String connectClusterAlias = spec.getConnectCluster(); if (connectClusterAlias != null) { connectCluster = clustersList.stream() .filter(clustersListItem -> spec.getConnectCluster().equals(clustersListItem.getAlias())) .findFirst() .orElseThrow(() -> new InvalidResourceException("connectCluster with alias " + connectClusterAlias + " cannot be found in the list of clusters at spec.clusters")); } cluster.setConfiguration(new KafkaMirrorMaker2Configuration(connectCluster.getConfig().entrySet())); return fromSpec(buildKafkaConnectSpec(spec, connectCluster), versions, cluster); } }
KafkaMirrorMaker2Cluster extends KafkaConnectCluster { public static KafkaMirrorMaker2Cluster fromCrd(KafkaMirrorMaker2 kafkaMirrorMaker2, KafkaVersion.Lookup versions) { KafkaMirrorMaker2Cluster cluster = new KafkaMirrorMaker2Cluster(kafkaMirrorMaker2); KafkaMirrorMaker2Spec spec = kafkaMirrorMaker2.getSpec(); cluster.setOwnerReference(kafkaMirrorMaker2); String specVersion = spec.getVersion(); if (versions.version(specVersion).compareVersion("2.4.0") < 0) { throw new InvalidResourceException("Kafka MirrorMaker 2.0 is not available in the version at spec.version (" + specVersion + "). Kafka MirrorMaker 2.0 is available in Kafka version 2.4.0 and later."); } cluster.setImage(versions.kafkaMirrorMaker2Version(spec.getImage(), specVersion)); List<KafkaMirrorMaker2ClusterSpec> clustersList = ModelUtils.asListOrEmptyList(spec.getClusters()); cluster.setClusters(clustersList); KafkaMirrorMaker2ClusterSpec connectCluster = new KafkaMirrorMaker2ClusterSpecBuilder().build(); String connectClusterAlias = spec.getConnectCluster(); if (connectClusterAlias != null) { connectCluster = clustersList.stream() .filter(clustersListItem -> spec.getConnectCluster().equals(clustersListItem.getAlias())) .findFirst() .orElseThrow(() -> new InvalidResourceException("connectCluster with alias " + connectClusterAlias + " cannot be found in the list of clusters at spec.clusters")); } cluster.setConfiguration(new KafkaMirrorMaker2Configuration(connectCluster.getConfig().entrySet())); return fromSpec(buildKafkaConnectSpec(spec, connectCluster), versions, cluster); } private  KafkaMirrorMaker2Cluster(HasMetadata resource); }
KafkaMirrorMaker2Cluster extends KafkaConnectCluster { public static KafkaMirrorMaker2Cluster fromCrd(KafkaMirrorMaker2 kafkaMirrorMaker2, KafkaVersion.Lookup versions) { KafkaMirrorMaker2Cluster cluster = new KafkaMirrorMaker2Cluster(kafkaMirrorMaker2); KafkaMirrorMaker2Spec spec = kafkaMirrorMaker2.getSpec(); cluster.setOwnerReference(kafkaMirrorMaker2); String specVersion = spec.getVersion(); if (versions.version(specVersion).compareVersion("2.4.0") < 0) { throw new InvalidResourceException("Kafka MirrorMaker 2.0 is not available in the version at spec.version (" + specVersion + "). Kafka MirrorMaker 2.0 is available in Kafka version 2.4.0 and later."); } cluster.setImage(versions.kafkaMirrorMaker2Version(spec.getImage(), specVersion)); List<KafkaMirrorMaker2ClusterSpec> clustersList = ModelUtils.asListOrEmptyList(spec.getClusters()); cluster.setClusters(clustersList); KafkaMirrorMaker2ClusterSpec connectCluster = new KafkaMirrorMaker2ClusterSpecBuilder().build(); String connectClusterAlias = spec.getConnectCluster(); if (connectClusterAlias != null) { connectCluster = clustersList.stream() .filter(clustersListItem -> spec.getConnectCluster().equals(clustersListItem.getAlias())) .findFirst() .orElseThrow(() -> new InvalidResourceException("connectCluster with alias " + connectClusterAlias + " cannot be found in the list of clusters at spec.clusters")); } cluster.setConfiguration(new KafkaMirrorMaker2Configuration(connectCluster.getConfig().entrySet())); return fromSpec(buildKafkaConnectSpec(spec, connectCluster), versions, cluster); } private  KafkaMirrorMaker2Cluster(HasMetadata resource); static KafkaMirrorMaker2Cluster fromCrd(KafkaMirrorMaker2 kafkaMirrorMaker2, 
                                                   KafkaVersion.Lookup versions); @Override String getServiceAccountName(); }
KafkaMirrorMaker2Cluster extends KafkaConnectCluster { public static KafkaMirrorMaker2Cluster fromCrd(KafkaMirrorMaker2 kafkaMirrorMaker2, KafkaVersion.Lookup versions) { KafkaMirrorMaker2Cluster cluster = new KafkaMirrorMaker2Cluster(kafkaMirrorMaker2); KafkaMirrorMaker2Spec spec = kafkaMirrorMaker2.getSpec(); cluster.setOwnerReference(kafkaMirrorMaker2); String specVersion = spec.getVersion(); if (versions.version(specVersion).compareVersion("2.4.0") < 0) { throw new InvalidResourceException("Kafka MirrorMaker 2.0 is not available in the version at spec.version (" + specVersion + "). Kafka MirrorMaker 2.0 is available in Kafka version 2.4.0 and later."); } cluster.setImage(versions.kafkaMirrorMaker2Version(spec.getImage(), specVersion)); List<KafkaMirrorMaker2ClusterSpec> clustersList = ModelUtils.asListOrEmptyList(spec.getClusters()); cluster.setClusters(clustersList); KafkaMirrorMaker2ClusterSpec connectCluster = new KafkaMirrorMaker2ClusterSpecBuilder().build(); String connectClusterAlias = spec.getConnectCluster(); if (connectClusterAlias != null) { connectCluster = clustersList.stream() .filter(clustersListItem -> spec.getConnectCluster().equals(clustersListItem.getAlias())) .findFirst() .orElseThrow(() -> new InvalidResourceException("connectCluster with alias " + connectClusterAlias + " cannot be found in the list of clusters at spec.clusters")); } cluster.setConfiguration(new KafkaMirrorMaker2Configuration(connectCluster.getConfig().entrySet())); return fromSpec(buildKafkaConnectSpec(spec, connectCluster), versions, cluster); } private  KafkaMirrorMaker2Cluster(HasMetadata resource); static KafkaMirrorMaker2Cluster fromCrd(KafkaMirrorMaker2 kafkaMirrorMaker2, 
                                                   KafkaVersion.Lookup versions); @Override String getServiceAccountName();  }