use of org.apache.hadoop.hive.ql.parse.repl.metric.event.ReplicationMetric in project hive by apache.
the class TestScheduledReplicationScenarios method checkMetrics.
private void checkMetrics(List<ReplicationMetric> expectedReplicationMetrics, List<ReplicationMetric> actualMetrics) {
Assert.assertEquals(expectedReplicationMetrics.size(), actualMetrics.size());
int metricCounter = 0;
for (ReplicationMetric actualMetric : actualMetrics) {
for (ReplicationMetric expecMetric : expectedReplicationMetrics) {
if (actualMetric.getPolicy().equalsIgnoreCase(expecMetric.getPolicy())) {
Assert.assertEquals(expecMetric.getDumpExecutionId(), actualMetric.getDumpExecutionId());
Assert.assertEquals(expecMetric.getMetadata().getDbName(), actualMetric.getMetadata().getDbName());
Assert.assertEquals(expecMetric.getMetadata().getLastReplId(), actualMetric.getMetadata().getLastReplId());
Assert.assertEquals(expecMetric.getMetadata().getStagingDir(), actualMetric.getMetadata().getStagingDir());
Assert.assertEquals(expecMetric.getMetadata().getReplicationType(), actualMetric.getMetadata().getReplicationType());
Assert.assertEquals(expecMetric.getProgress().getStatus(), actualMetric.getProgress().getStatus());
Assert.assertEquals(expecMetric.getProgress().getStages().size(), actualMetric.getProgress().getStages().size());
List<Stage> expectedStages = expecMetric.getProgress().getStages();
List<Stage> actualStages = actualMetric.getProgress().getStages();
int counter = 0;
for (Stage actualStage : actualStages) {
for (Stage expeStage : expectedStages) {
if (actualStage.getName().equalsIgnoreCase(expeStage.getName())) {
Assert.assertEquals(expeStage.getStatus(), actualStage.getStatus());
Assert.assertEquals(expeStage.getMetrics().size(), actualStage.getMetrics().size());
for (Metric actMetric : actualStage.getMetrics()) {
for (Metric expMetric : expeStage.getMetrics()) {
if (actMetric.getName().equalsIgnoreCase(expMetric.getName())) {
Assert.assertEquals(expMetric.getTotalCount(), actMetric.getTotalCount());
Assert.assertEquals(expMetric.getCurrentCount(), actMetric.getCurrentCount());
}
}
}
counter++;
if (counter == actualStages.size()) {
break;
}
}
}
}
metricCounter++;
if (metricCounter == actualMetrics.size()) {
break;
}
}
}
}
}
Aggregations