io.kroxylicious.testing.kafka.api.KafkaClusterProvisioningStrategy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of testing-api Show documentation
Show all versions of testing-api Show documentation
Provides the abstract API for a KafkaCluster and meta-annotation for annotations that constrain provided clusters.
/*
* Copyright Kroxylicious Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
package io.kroxylicious.testing.kafka.api;
import java.lang.annotation.Annotation;
import java.time.Duration;
import java.util.List;
import org.junit.jupiter.api.TestInfo;
/**
* Service interface for provisioning.
*/
public interface KafkaClusterProvisioningStrategy {
/**
* Set the supported annotation by the provisioning strategy
* @param constraint A {@link KafkaClusterConstraint}-annotated constraint annotation.
* @return Whether this provisioning strategy supports/understands the given {@code constraint}.
*/
boolean supportsAnnotation(Annotation constraint);
/**
* Set the supported type by the provisioning strategy
* @param declarationType The specific subtype of {@link KafkaCluster}
* @return Whether this provisioning strategy supports creating instances that
* are a subclass of the given {@code declarationType}.
*/
boolean supportsType(Class extends KafkaCluster> declarationType);
/**
* Estimate the time it would take to provision a cluster with the given configuration.
* @param constraints The {@link KafkaClusterConstraint}-annotated constraint annotations
* @param declarationType The specific subtype of {@link KafkaCluster} to be created.
* @return The estimated provisioning time (including the time taken for {@link KafkaCluster#start()}.
*/
Duration estimatedProvisioningTimeMs(List constraints,
Class extends KafkaCluster> declarationType);
/**
* Create a {@link KafkaCluster} instance with the given configuration.
*
* @param constraints The constraints.
* @param declarationType The subtype.
* @param testInfo Information about the test execution context.
* @return The created instance.
*/
KafkaCluster create(List constraints,
Class extends KafkaCluster> declarationType, TestInfo testInfo);
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy