Search in sources :

Example 1 with HiveRunnerConfig

use of com.klarna.hiverunner.config.HiveRunnerConfig in project flink by apache.

the class FlinkEmbeddedHiveRunner method loadAnnotatesHiveRunnerConfig.

private void loadAnnotatesHiveRunnerConfig(Class testClass) {
    Set<Field> fields = ReflectionUtils.getAllFields(testClass, withAnnotation(HiveRunnerSetup.class));
    Preconditions.checkState(fields.size() <= 1, "Exact one field of type HiveRunnerConfig should to be annotated with @HiveRunnerSetup");
    // has been passes around and referenced by some of the other test rules.
    if (!fields.isEmpty()) {
        Field field = fields.iterator().next();
        Preconditions.checkState(ReflectionUtils.isOfType(field, HiveRunnerConfig.class), "Field annotated with @HiveRunnerSetup should be of type HiveRunnerConfig");
        config.override(ReflectionUtils.getStaticFieldValue(testClass, field.getName(), HiveRunnerConfig.class));
    }
}
Also used : Field(java.lang.reflect.Field) HiveRunnerConfig(com.klarna.hiverunner.config.HiveRunnerConfig) HiveRunnerSetup(com.klarna.hiverunner.annotations.HiveRunnerSetup)

Aggregations

HiveRunnerSetup (com.klarna.hiverunner.annotations.HiveRunnerSetup)1 HiveRunnerConfig (com.klarna.hiverunner.config.HiveRunnerConfig)1 Field (java.lang.reflect.Field)1