use of com.klarna.hiverunner.annotations.HiveRunnerSetup 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));
}
}
Aggregations