Search in sources :

Example 1 with CCMFactoryMethod

use of com.datastax.oss.dsbulk.tests.ccm.annotations.CCMFactoryMethod in project dsbulk by datastax.

the class CCMClusterFactory method createInstanceForClass.

public static CCMClusterFactory createInstanceForClass(Class<?> testClass) {
    CCMFactoryMethod factoryRef = ReflectionUtils.locateClassAnnotation(testClass, CCMFactoryMethod.class);
    CCMConfig config = ReflectionUtils.locateClassAnnotation(testClass, CCMConfig.class);
    if (factoryRef != null) {
        if (config != null) {
            throw new IllegalStateException(String.format("%s can be annotated with either @CCMConfig or @CCMFactoryMethod, but not both", testClass));
        }
        return new CCMClusterMethodFactory(factoryRef, testClass);
    }
    if (config == null) {
        config = DEFAULT_CCM_CONFIG;
    }
    return new CCMClusterAnnotationFactory(config);
}
Also used : CCMConfig(com.datastax.oss.dsbulk.tests.ccm.annotations.CCMConfig) CCMFactoryMethod(com.datastax.oss.dsbulk.tests.ccm.annotations.CCMFactoryMethod)

Aggregations

CCMConfig (com.datastax.oss.dsbulk.tests.ccm.annotations.CCMConfig)1 CCMFactoryMethod (com.datastax.oss.dsbulk.tests.ccm.annotations.CCMFactoryMethod)1