All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.kroxylicious.testing.kafka.api.KafkaClusterProvisioningStrategy Maven / Gradle / Ivy

Go to download

Provides the abstract API for a KafkaCluster and meta-annotation for annotations that constrain provided clusters.

There is a newer version: 0.10.0
Show newest version
/*
 * 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 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 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 declarationType, TestInfo testInfo);

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy