use of io.strimzi.api.kafka.model.KafkaJmxAuthenticationPasswordBuilder in project strimzi by strimzi.
the class KafkaAssemblyOperatorTest method testCreateClusterWithJmxTrans.
@ParameterizedTest
@MethodSource("data")
public void testCreateClusterWithJmxTrans(Params params, VertxTestContext context) {
setFields(params);
Kafka kafka = getKafkaAssembly("foo");
kafka.getSpec().getKafka().setJmxOptions(new KafkaJmxOptionsBuilder().withAuthentication(new KafkaJmxAuthenticationPasswordBuilder().build()).build());
kafka.getSpec().setJmxTrans(new JmxTransSpecBuilder().withKafkaQueries(new JmxTransQueryTemplateBuilder().withTargetMBean("mbean").withAttributes("attribute").withOutputs("output").build()).withOutputDefinitions(new JmxTransOutputDefinitionTemplateBuilder().withOutputType("host").withName("output").build()).build());
createCluster(context, kafka, Collections.singletonList(new SecretBuilder().withNewMetadata().withName(KafkaCluster.jmxSecretName("foo")).withNamespace("test").endMetadata().withData(Collections.singletonMap("foo", "bar")).build()));
}
use of io.strimzi.api.kafka.model.KafkaJmxAuthenticationPasswordBuilder in project strimzi by strimzi.
the class KafkaConnectAssemblyOperatorTest method testCreateClusterWithJmxEnabled.
@Test
public void testCreateClusterWithJmxEnabled(VertxTestContext context) {
String kcName = "foo";
String kcNamespace = "test";
KafkaConnect kc = ResourceUtils.createEmptyKafkaConnect(kcNamespace, kcName);
kc.getMetadata().getAnnotations().put("strimzi.io/use-connector-resources", "true");
kc.getSpec().setJmxOptions(new KafkaJmxOptionsBuilder().withAuthentication(new KafkaJmxAuthenticationPasswordBuilder().build()).build());
createKafkaConnectCluster(context, kc, true);
}
use of io.strimzi.api.kafka.model.KafkaJmxAuthenticationPasswordBuilder in project strimzi-kafka-operator by strimzi.
the class KafkaClusterTest method testJmxSecretCustomLabelsAndAnnotations.
@ParallelTest
public void testJmxSecretCustomLabelsAndAnnotations() {
Map<String, String> customLabels = new HashMap<>(2);
customLabels.put("label1", "value1");
customLabels.put("label2", "value2");
Map<String, String> customAnnotations = new HashMap<>(2);
customAnnotations.put("anno1", "value3");
customAnnotations.put("anno2", "value4");
Kafka kafka = new KafkaBuilder(kafkaAssembly).editSpec().editKafka().withJmxOptions(new KafkaJmxOptionsBuilder().withAuthentication(new KafkaJmxAuthenticationPasswordBuilder().build()).build()).withNewTemplate().withNewJmxSecret().withNewMetadata().withAnnotations(customAnnotations).withLabels(customLabels).endMetadata().endJmxSecret().endTemplate().endKafka().endSpec().build();
KafkaCluster kc = KafkaCluster.fromCrd(Reconciliation.DUMMY_RECONCILIATION, kafka, VERSIONS);
Secret jmxSecret = kc.generateJmxSecret();
for (Map.Entry<String, String> entry : customAnnotations.entrySet()) {
assertThat(jmxSecret.getMetadata().getAnnotations(), hasEntry(entry.getKey(), entry.getValue()));
}
for (Map.Entry<String, String> entry : customLabels.entrySet()) {
assertThat(jmxSecret.getMetadata().getLabels(), hasEntry(entry.getKey(), entry.getValue()));
}
}
use of io.strimzi.api.kafka.model.KafkaJmxAuthenticationPasswordBuilder in project strimzi-kafka-operator by strimzi.
the class KafkaConnectClusterTest method testJmxSecretCustomLabelsAndAnnotations.
@ParallelTest
public void testJmxSecretCustomLabelsAndAnnotations() {
Map<String, String> customLabels = new HashMap<>(2);
customLabels.put("label1", "value1");
customLabels.put("label2", "value2");
Map<String, String> customAnnotations = new HashMap<>(2);
customAnnotations.put("anno1", "value3");
customAnnotations.put("anno2", "value4");
KafkaConnect kafkaConnect = new KafkaConnectBuilder(this.resource).editSpec().withJmxOptions(new KafkaJmxOptionsBuilder().withAuthentication(new KafkaJmxAuthenticationPasswordBuilder().build()).build()).withNewTemplate().withNewJmxSecret().withNewMetadata().withAnnotations(customAnnotations).withLabels(customLabels).endMetadata().endJmxSecret().endTemplate().endSpec().build();
KafkaConnectCluster kafkaConnectCluster = KafkaConnectCluster.fromCrd(Reconciliation.DUMMY_RECONCILIATION, kafkaConnect, VERSIONS);
Secret jmxSecret = kafkaConnectCluster.generateJmxSecret();
for (Map.Entry<String, String> entry : customAnnotations.entrySet()) {
assertThat(jmxSecret.getMetadata().getAnnotations(), hasEntry(entry.getKey(), entry.getValue()));
}
for (Map.Entry<String, String> entry : customLabels.entrySet()) {
assertThat(jmxSecret.getMetadata().getLabels(), hasEntry(entry.getKey(), entry.getValue()));
}
}
use of io.strimzi.api.kafka.model.KafkaJmxAuthenticationPasswordBuilder in project strimzi-kafka-operator by strimzi.
the class KafkaMirrorMaker2ClusterTest method testJmxSecretCustomLabelsAndAnnotations.
@ParallelTest
public void testJmxSecretCustomLabelsAndAnnotations() {
Map<String, String> customLabels = new HashMap<>(2);
customLabels.put("label1", "value1");
customLabels.put("label2", "value2");
Map<String, String> customAnnotations = new HashMap<>(2);
customAnnotations.put("anno1", "value3");
customAnnotations.put("anno2", "value4");
KafkaMirrorMaker2 kafkaMirrorMaker2 = new KafkaMirrorMaker2Builder(this.resource).editSpec().withJmxOptions(new KafkaJmxOptionsBuilder().withAuthentication(new KafkaJmxAuthenticationPasswordBuilder().build()).build()).withNewTemplate().withNewJmxSecret().withNewMetadata().withAnnotations(customAnnotations).withLabels(customLabels).endMetadata().endJmxSecret().endTemplate().endSpec().build();
KafkaMirrorMaker2Cluster kmm2 = KafkaMirrorMaker2Cluster.fromCrd(Reconciliation.DUMMY_RECONCILIATION, kafkaMirrorMaker2, VERSIONS);
Secret jmxSecret = kmm2.generateJmxSecret();
for (Map.Entry<String, String> entry : customAnnotations.entrySet()) {
assertThat(jmxSecret.getMetadata().getAnnotations(), hasEntry(entry.getKey(), entry.getValue()));
}
for (Map.Entry<String, String> entry : customLabels.entrySet()) {
assertThat(jmxSecret.getMetadata().getLabels(), hasEntry(entry.getKey(), entry.getValue()));
}
}
Aggregations