use of org.apache.gobblin.qualitychecker.task.TaskLevelPolicyCheckResults in project incubator-gobblin by apache.
the class RowCountTaskLevelPolicyTest method testRowCountPolicyFailed.
@Test
public void testRowCountPolicyFailed() throws Exception {
State state = new State();
state.setProp(ConfigurationKeys.TASK_LEVEL_POLICY_LIST, "org.apache.gobblin.policies.count.RowCountPolicy");
state.setProp(ConfigurationKeys.TASK_LEVEL_POLICY_LIST_TYPE, "FAIL");
state.setProp(ConfigurationKeys.EXTRACTOR_ROWS_EXPECTED, EXTRACTOR_ROWS_READ);
state.setProp(ConfigurationKeys.WRITER_ROWS_WRITTEN, -1);
TaskLevelPolicyCheckResults results = getPolicyResults(state);
for (Map.Entry<TaskLevelPolicy.Result, TaskLevelPolicy.Type> entry : results.getPolicyResults().entrySet()) {
Assert.assertEquals(entry.getKey(), TaskLevelPolicy.Result.FAILED);
}
}
use of org.apache.gobblin.qualitychecker.task.TaskLevelPolicyCheckResults in project incubator-gobblin by apache.
the class RowCountTaskLevelPolicyTest method testRowCountRangePolicyPassedRange.
@Test
public void testRowCountRangePolicyPassedRange() throws Exception {
State state = new State();
state.setProp(ConfigurationKeys.TASK_LEVEL_POLICY_LIST, "org.apache.gobblin.policies.count.RowCountRangePolicy");
state.setProp(ConfigurationKeys.TASK_LEVEL_POLICY_LIST_TYPE, "FAIL");
state.setProp(ConfigurationKeys.EXTRACTOR_ROWS_EXPECTED, EXTRACTOR_ROWS_READ);
state.setProp(ConfigurationKeys.WRITER_ROWS_WRITTEN, (long) 0.03 * EXTRACTOR_ROWS_READ + EXTRACTOR_ROWS_READ);
state.setProp(ConfigurationKeys.ROW_COUNT_RANGE, "0.05");
TaskLevelPolicyCheckResults results = getPolicyResults(state);
for (Map.Entry<TaskLevelPolicy.Result, TaskLevelPolicy.Type> entry : results.getPolicyResults().entrySet()) {
Assert.assertEquals(entry.getKey(), TaskLevelPolicy.Result.PASSED);
}
}
use of org.apache.gobblin.qualitychecker.task.TaskLevelPolicyCheckResults in project incubator-gobblin by apache.
the class RowCountTaskLevelPolicyTest method testRowCountRangePolicyPassedExact.
@Test
public void testRowCountRangePolicyPassedExact() throws Exception {
State state = new State();
state.setProp(ConfigurationKeys.TASK_LEVEL_POLICY_LIST, "org.apache.gobblin.policies.count.RowCountRangePolicy");
state.setProp(ConfigurationKeys.TASK_LEVEL_POLICY_LIST_TYPE, "FAIL");
state.setProp(ConfigurationKeys.EXTRACTOR_ROWS_EXPECTED, EXTRACTOR_ROWS_READ);
state.setProp(ConfigurationKeys.WRITER_ROWS_WRITTEN, WRITER_ROWS_WRITTEN);
state.setProp(ConfigurationKeys.ROW_COUNT_RANGE, "0.05");
TaskLevelPolicyCheckResults results = getPolicyResults(state);
for (Map.Entry<TaskLevelPolicy.Result, TaskLevelPolicy.Type> entry : results.getPolicyResults().entrySet()) {
Assert.assertEquals(entry.getKey(), TaskLevelPolicy.Result.PASSED);
}
}
use of org.apache.gobblin.qualitychecker.task.TaskLevelPolicyCheckResults in project incubator-gobblin by apache.
the class TaskLevelQualityCheckerTest method testPolicyChecker.
@Test
public void testPolicyChecker() throws Exception {
State state = new State();
state.setProp(ConfigurationKeys.TASK_LEVEL_POLICY_LIST, "org.apache.gobblin.qualitychecker.TestTaskLevelPolicy");
state.setProp(ConfigurationKeys.TASK_LEVEL_POLICY_LIST_TYPE, "FAIL");
TaskLevelPolicyCheckResults results = getPolicyResults(state);
for (Map.Entry<TaskLevelPolicy.Result, TaskLevelPolicy.Type> entry : results.getPolicyResults().entrySet()) {
Assert.assertEquals(entry.getKey(), TaskLevelPolicy.Result.PASSED);
}
}
Aggregations