use of io.strimzi.api.kafka.model.EntityOperatorSpecBuilder in project strimzi-kafka-operator by strimzi.
the class EntityTopicOperatorTest method testWatchedNamespace.
@ParallelTest
public void testWatchedNamespace() {
EntityOperatorSpec entityOperatorSpec = new EntityOperatorSpecBuilder().withNewTopicOperator().withWatchedNamespace("some-other-namespace").endTopicOperator().build();
Kafka resource = new KafkaBuilder(ResourceUtils.createKafka(namespace, cluster, replicas, image, healthDelay, healthTimeout)).editSpec().withEntityOperator(entityOperatorSpec).endSpec().build();
EntityTopicOperator entityTopicOperator = EntityTopicOperator.fromCrd(new Reconciliation("test", resource.getKind(), resource.getMetadata().getNamespace(), resource.getMetadata().getName()), resource);
assertThat(entityTopicOperator.watchedNamespace(), is("some-other-namespace"));
}
use of io.strimzi.api.kafka.model.EntityOperatorSpecBuilder in project strimzi-kafka-operator by strimzi.
the class EntityTopicOperatorTest method testNoWatchedNamespace.
@ParallelTest
public void testNoWatchedNamespace() {
EntityOperatorSpec entityOperatorSpec = new EntityOperatorSpecBuilder().withNewTopicOperator().endTopicOperator().build();
Kafka resource = new KafkaBuilder(ResourceUtils.createKafka(namespace, cluster, replicas, image, healthDelay, healthTimeout)).editSpec().withEntityOperator(entityOperatorSpec).endSpec().build();
EntityTopicOperator entityTopicOperator = EntityTopicOperator.fromCrd(new Reconciliation("test", resource.getKind(), resource.getMetadata().getNamespace(), resource.getMetadata().getName()), resource);
assertThat(entityTopicOperator.watchedNamespace(), is(namespace));
}
use of io.strimzi.api.kafka.model.EntityOperatorSpecBuilder in project strimzi-kafka-operator by strimzi.
the class EntityTopicOperatorTest method testFromCrdNoTopicOperatorInEntityOperator.
@ParallelTest
public void testFromCrdNoTopicOperatorInEntityOperator() {
EntityOperatorSpec entityOperatorSpec = new EntityOperatorSpecBuilder().build();
Kafka resource = new KafkaBuilder(ResourceUtils.createKafka(namespace, cluster, replicas, image, healthDelay, healthTimeout)).editSpec().withEntityOperator(entityOperatorSpec).endSpec().build();
EntityTopicOperator entityTopicOperator = EntityTopicOperator.fromCrd(new Reconciliation("test", resource.getKind(), resource.getMetadata().getNamespace(), resource.getMetadata().getName()), resource);
assertThat(entityTopicOperator, is(nullValue()));
}
use of io.strimzi.api.kafka.model.EntityOperatorSpecBuilder in project strimzi-kafka-operator by strimzi.
the class EntityUserOperatorTest method testFromCrdCaValidityAndRenewal.
@ParallelTest
public void testFromCrdCaValidityAndRenewal() {
EntityUserOperatorSpec entityUserOperatorSpec = new EntityUserOperatorSpecBuilder().build();
EntityOperatorSpec entityOperatorSpec = new EntityOperatorSpecBuilder().withUserOperator(entityUserOperatorSpec).build();
CertificateAuthority ca = new CertificateAuthority();
ca.setValidityDays(42);
ca.setRenewalDays(69);
Kafka customValues = new KafkaBuilder(ResourceUtils.createKafka(namespace, cluster, replicas, image, healthDelay, healthTimeout)).editSpec().withEntityOperator(entityOperatorSpec).withClientsCa(ca).endSpec().build();
EntityUserOperator entityUserOperator = EntityUserOperator.fromCrd(new Reconciliation("test", resource.getKind(), resource.getMetadata().getNamespace(), resource.getMetadata().getName()), customValues, true);
Kafka defaultValues = new KafkaBuilder(ResourceUtils.createKafka(namespace, cluster, replicas, image, healthDelay, healthTimeout)).editSpec().withEntityOperator(entityOperatorSpec).endSpec().build();
EntityUserOperator entityUserOperator2 = EntityUserOperator.fromCrd(new Reconciliation("test", resource.getKind(), resource.getMetadata().getNamespace(), resource.getMetadata().getName()), defaultValues, true);
assertThat(entityUserOperator.clientsCaValidityDays, is(42));
assertThat(entityUserOperator.clientsCaRenewalDays, is(69));
assertThat(entityUserOperator2.clientsCaValidityDays, is(CertificateAuthority.DEFAULT_CERTS_VALIDITY_DAYS));
assertThat(entityUserOperator2.clientsCaRenewalDays, is(CertificateAuthority.DEFAULT_CERTS_RENEWAL_DAYS));
}
use of io.strimzi.api.kafka.model.EntityOperatorSpecBuilder in project strimzi-kafka-operator by strimzi.
the class KRaftUtilsTest method testEnabledOnlyUserOperator.
@ParallelTest
public void testEnabledOnlyUserOperator() {
Set<String> errors = new HashSet<>(0);
EntityOperatorSpec eo = new EntityOperatorSpecBuilder().withNewUserOperator().endUserOperator().build();
KRaftUtils.validateEntityOperatorSpec(errors, eo);
assertThat(errors, is(Collections.emptySet()));
}
Aggregations