Search in sources :

Example 6 with TaskLevelPolicyCheckResults

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);
    }
}
Also used : State(org.apache.gobblin.configuration.State) TaskLevelPolicyCheckResults(org.apache.gobblin.qualitychecker.task.TaskLevelPolicyCheckResults) Map(java.util.Map) Test(org.testng.annotations.Test)

Example 7 with TaskLevelPolicyCheckResults

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);
    }
}
Also used : State(org.apache.gobblin.configuration.State) TaskLevelPolicyCheckResults(org.apache.gobblin.qualitychecker.task.TaskLevelPolicyCheckResults) Map(java.util.Map) Test(org.testng.annotations.Test)

Example 8 with TaskLevelPolicyCheckResults

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);
    }
}
Also used : State(org.apache.gobblin.configuration.State) TaskLevelPolicyCheckResults(org.apache.gobblin.qualitychecker.task.TaskLevelPolicyCheckResults) Map(java.util.Map) Test(org.testng.annotations.Test)

Example 9 with TaskLevelPolicyCheckResults

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);
    }
}
Also used : State(org.apache.gobblin.configuration.State) TaskLevelPolicyCheckResults(org.apache.gobblin.qualitychecker.task.TaskLevelPolicyCheckResults) Map(java.util.Map) Test(org.testng.annotations.Test)

Aggregations

TaskLevelPolicyCheckResults (org.apache.gobblin.qualitychecker.task.TaskLevelPolicyCheckResults)9 Map (java.util.Map)8 State (org.apache.gobblin.configuration.State)8 Test (org.testng.annotations.Test)8 TaskPublisher (org.apache.gobblin.publisher.TaskPublisher)1