com.klarna.hiverunner.annotations.HiveResource Java Examples
The following examples show how to use
com.klarna.hiverunner.annotations.HiveResource.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FlinkStandaloneHiveRunner.java From flink with Apache License 2.0 | 6 votes |
private void loadAnnotatedResources(Class testClass, HiveShellBuilder workFlowBuilder) throws IOException { Set<Field> fields = ReflectionUtils.getAllFields(testClass, withAnnotation(HiveResource.class)); for (Field resourceField : fields) { HiveResource annotation = resourceField.getAnnotation(HiveResource.class); String targetFile = annotation.targetFile(); if (ReflectionUtils.isOfType(resourceField, String.class)) { String data = ReflectionUtils.getStaticFieldValue(testClass, resourceField.getName(), String.class); workFlowBuilder.addResource(targetFile, data); } else if (ReflectionUtils.isOfType(resourceField, File.class) || ReflectionUtils.isOfType(resourceField, Path.class)) { Path dataFile = getMandatoryPathFromField(testClass, resourceField); workFlowBuilder.addResource(targetFile, dataFile); } else { throw new IllegalArgumentException( "Fields annotated with @HiveResource currently only supports field type String, File or Path"); } } }
Example #2
Source File: FlinkStandaloneHiveRunner.java From flink with Apache License 2.0 | 6 votes |
private void loadAnnotatedResources(Class testClass, HiveShellBuilder workFlowBuilder) throws IOException { Set<Field> fields = ReflectionUtils.getAllFields(testClass, withAnnotation(HiveResource.class)); for (Field resourceField : fields) { HiveResource annotation = resourceField.getAnnotation(HiveResource.class); String targetFile = annotation.targetFile(); if (ReflectionUtils.isOfType(resourceField, String.class)) { String data = ReflectionUtils.getStaticFieldValue(testClass, resourceField.getName(), String.class); workFlowBuilder.addResource(targetFile, data); } else if (ReflectionUtils.isOfType(resourceField, File.class) || ReflectionUtils.isOfType(resourceField, Path.class)) { Path dataFile = getMandatoryPathFromField(testClass, resourceField); workFlowBuilder.addResource(targetFile, dataFile); } else { throw new IllegalArgumentException( "Fields annotated with @HiveResource currently only supports field type String, File or Path"); } } }
Example #3
Source File: HiveRunnerCore.java From HiveRunner with Apache License 2.0 | 6 votes |
private void loadAnnotatedResources(Object testCase, HiveShellBuilder workFlowBuilder) throws IOException { Set<Field> fields = ReflectionUtils.getAllFields(testCase.getClass(), withAnnotation(HiveResource.class)); for (Field resourceField : fields) { HiveResource annotation = resourceField.getAnnotation(HiveResource.class); String targetFile = annotation.targetFile(); if (ReflectionUtils.isOfType(resourceField, String.class)) { String data = ReflectionUtils.getFieldValue(testCase, resourceField.getName(), String.class); workFlowBuilder.addResource(targetFile, data); } else if (ReflectionUtils.isOfType(resourceField, File.class) || ReflectionUtils.isOfType(resourceField, Path.class)) { Path dataFile = getMandatoryPathFromField(testCase, resourceField); workFlowBuilder.addResource(targetFile, dataFile); } else { throw new IllegalArgumentException( "Fields annotated with @HiveResource currently only supports field type String, File or Path"); } } }