@Test public void testUpdateRepairStateAllRepaired() { int expectedRepaired = 1; int expectedNotRepaired = 0; double expectedRatio = 1; myTableMetricHolder.repairState(expectedRepaired, expectedNotRepaired); assertThat(getGague(TableMetricHolder.REPAIR_STATE).getValue()).isEqualTo(expectedRatio); verify(myNodeMetricHolder).repairState(eq(myTableReference), eq(expectedRatio)); }
public void repairState(int repairedRanges, int notRepairedRanges) { myRepairState.set(new RangeRepairState(repairedRanges, notRepairedRanges)); double ratio; if (notRepairedRanges == 0) { ratio = 1; } else if (repairedRanges == 0) { ratio = 0; } else { ratio = (double)repairedRanges / (repairedRanges + notRepairedRanges); } myNodeMetricHolder.repairState(myTableReference, ratio); }
TableMetricHolder implements Closeable { public void repairState(int repairedRanges, int notRepairedRanges) { myRepairState.set(new RangeRepairState(repairedRanges, notRepairedRanges)); double ratio; if (notRepairedRanges == 0) { ratio = 1; } else if (repairedRanges == 0) { ratio = 0; } else { ratio = (double)repairedRanges / (repairedRanges + notRepairedRanges); } myNodeMetricHolder.repairState(myTableReference, ratio); } }
TableMetricHolder implements Closeable { public void repairState(int repairedRanges, int notRepairedRanges) { myRepairState.set(new RangeRepairState(repairedRanges, notRepairedRanges)); double ratio; if (notRepairedRanges == 0) { ratio = 1; } else if (repairedRanges == 0) { ratio = 0; } else { ratio = (double)repairedRanges / (repairedRanges + notRepairedRanges); } myNodeMetricHolder.repairState(myTableReference, ratio); } TableMetricHolder(TableReference tableReference, MetricRegistry metricRegistry, NodeMetricHolder nodeMetricHolder); }
TableMetricHolder implements Closeable { public void repairState(int repairedRanges, int notRepairedRanges) { myRepairState.set(new RangeRepairState(repairedRanges, notRepairedRanges)); double ratio; if (notRepairedRanges == 0) { ratio = 1; } else if (repairedRanges == 0) { ratio = 0; } else { ratio = (double)repairedRanges / (repairedRanges + notRepairedRanges); } myNodeMetricHolder.repairState(myTableReference, ratio); } TableMetricHolder(TableReference tableReference, MetricRegistry metricRegistry, NodeMetricHolder nodeMetricHolder); void init(); void repairState(int repairedRanges, int notRepairedRanges); void lastRepairedAt(long lastRepairedAt); void repairTiming(long timeTaken, TimeUnit timeUnit, boolean successful); @Override void close(); }
TableMetricHolder implements Closeable { public void repairState(int repairedRanges, int notRepairedRanges) { myRepairState.set(new RangeRepairState(repairedRanges, notRepairedRanges)); double ratio; if (notRepairedRanges == 0) { ratio = 1; } else if (repairedRanges == 0) { ratio = 0; } else { ratio = (double)repairedRanges / (repairedRanges + notRepairedRanges); } myNodeMetricHolder.repairState(myTableReference, ratio); } TableMetricHolder(TableReference tableReference, MetricRegistry metricRegistry, NodeMetricHolder nodeMetricHolder); void init(); void repairState(int repairedRanges, int notRepairedRanges); void lastRepairedAt(long lastRepairedAt); void repairTiming(long timeTaken, TimeUnit timeUnit, boolean successful); @Override void close();  }