Search in sources :

Example 1 with SimulacronConfig

use of com.datastax.oss.dsbulk.tests.simulacron.annotations.SimulacronConfig in project dsbulk by datastax.

the class BoundClusterFactory method createInstanceForClass.

public static BoundClusterFactory createInstanceForClass(Class<?> testClass) {
    SimulacronFactoryMethod factoryRef = ReflectionUtils.locateClassAnnotation(testClass, SimulacronFactoryMethod.class);
    SimulacronConfig config = ReflectionUtils.locateClassAnnotation(testClass, SimulacronConfig.class);
    if (factoryRef != null) {
        if (config != null) {
            throw new IllegalStateException(String.format("%s can be annotated with either @SimulacronClusterFactory or @SimulacronFactoryRef, but not both", testClass));
        }
        return new SimulacronClusterMethodFactory(factoryRef, testClass);
    }
    if (config == null) {
        config = DEFAULT_SIMULACRON_CONFIG;
    }
    return new SimulacronClusterAnnotationFactory(config);
}
Also used : SimulacronFactoryMethod(com.datastax.oss.dsbulk.tests.simulacron.annotations.SimulacronFactoryMethod) SimulacronConfig(com.datastax.oss.dsbulk.tests.simulacron.annotations.SimulacronConfig)

Aggregations

SimulacronConfig (com.datastax.oss.dsbulk.tests.simulacron.annotations.SimulacronConfig)1 SimulacronFactoryMethod (com.datastax.oss.dsbulk.tests.simulacron.annotations.SimulacronFactoryMethod)1