@Test public void testRangePolicyFailure() { RowCountRangePolicy rangePolicy = new RowCountRangePolicy(getTestState(4, 1, 0.5), TaskLevelPolicy.Type.FAIL); Assert.assertEquals(rangePolicy.executePolicy(), Result.FAILED); rangePolicy = new RowCountRangePolicy(getTestState(20, 8, 0.2), TaskLevelPolicy.Type.FAIL); Assert.assertEquals(rangePolicy.executePolicy(), Result.FAILED); }
@Override public Result executePolicy() { double computedRange = Math.abs((this.rowsWritten - this.rowsRead) / (double) this.rowsRead); if (computedRange <= this.range) { return Result.PASSED; } LOG.error(String.format( "RowCountRangePolicy check failed. Rows read %s, Rows written %s, computed range %s, expected range %s ", this.rowsRead, this.rowsWritten, computedRange, this.range)); return Result.FAILED; }
RowCountRangePolicy extends TaskLevelPolicy { @Override public Result executePolicy() { double computedRange = Math.abs((this.rowsWritten - this.rowsRead) / (double) this.rowsRead); if (computedRange <= this.range) { return Result.PASSED; } LOG.error(String.format( "RowCountRangePolicy check failed. Rows read %s, Rows written %s, computed range %s, expected range %s ", this.rowsRead, this.rowsWritten, computedRange, this.range)); return Result.FAILED; } }
RowCountRangePolicy extends TaskLevelPolicy { @Override public Result executePolicy() { double computedRange = Math.abs((this.rowsWritten - this.rowsRead) / (double) this.rowsRead); if (computedRange <= this.range) { return Result.PASSED; } LOG.error(String.format( "RowCountRangePolicy check failed. Rows read %s, Rows written %s, computed range %s, expected range %s ", this.rowsRead, this.rowsWritten, computedRange, this.range)); return Result.FAILED; } RowCountRangePolicy(State state, Type type); }
RowCountRangePolicy extends TaskLevelPolicy { @Override public Result executePolicy() { double computedRange = Math.abs((this.rowsWritten - this.rowsRead) / (double) this.rowsRead); if (computedRange <= this.range) { return Result.PASSED; } LOG.error(String.format( "RowCountRangePolicy check failed. Rows read %s, Rows written %s, computed range %s, expected range %s ", this.rowsRead, this.rowsWritten, computedRange, this.range)); return Result.FAILED; } RowCountRangePolicy(State state, Type type); @Override Result executePolicy(); }
RowCountRangePolicy extends TaskLevelPolicy { @Override public Result executePolicy() { double computedRange = Math.abs((this.rowsWritten - this.rowsRead) / (double) this.rowsRead); if (computedRange <= this.range) { return Result.PASSED; } LOG.error(String.format( "RowCountRangePolicy check failed. Rows read %s, Rows written %s, computed range %s, expected range %s ", this.rowsRead, this.rowsWritten, computedRange, this.range)); return Result.FAILED; } RowCountRangePolicy(State state, Type type); @Override Result executePolicy();  }