@Test(timeout = 300000) public void testMaxWithInvalidRange() { AggregationClient aClient = new AggregationClient(conf); final ColumnInterpreter<Double, Double, EmptyMsg, DoubleMsg, DoubleMsg> ci = new DoubleColumnInterpreter(); Scan scan = new Scan(); scan.setStartRow(ROWS[4]); scan.setStopRow(ROWS[2]); scan.addColumn(TEST_FAMILY, TEST_QUALIFIER); double max = Double.MIN_VALUE; ; try { max = aClient.max(TEST_TABLE, ci, scan); } catch (Throwable e) { max = 0.00; } assertEquals(0.00, max, 0.00);// control should go to the catch block }
@Test(timeout = 300000) public void testMaxWithInvalidRange2() throws Throwable { double max = Double.MIN_VALUE; Scan scan = new Scan(); scan.addColumn(TEST_FAMILY, TEST_QUALIFIER); scan.setStartRow(ROWS[4]); scan.setStopRow(ROWS[4]); try { AggregationClient aClient = new AggregationClient(conf); final ColumnInterpreter<Double, Double, EmptyMsg, DoubleMsg, DoubleMsg> ci = new DoubleColumnInterpreter(); max = aClient.max(TEST_TABLE, ci, scan); } catch (Exception e) { max = 0.00; } assertEquals(0.00, max, 0.00);// control should go to the catch block }
@Test(timeout = 300000) public void testMinWithValidRangeWithNullCF() { AggregationClient aClient = new AggregationClient(conf); Scan scan = new Scan(); scan.setStartRow(ROWS[5]); scan.setStopRow(ROWS[15]); final ColumnInterpreter<Double, Double, EmptyMsg, DoubleMsg, DoubleMsg> ci = new DoubleColumnInterpreter(); Double min = null; try { min = aClient.min(TEST_TABLE, ci, scan); } catch (Throwable e) { min = null; } assertEquals(null, min);// CP will throw an IOException about the // null column family, and min will be set to 0 }
@Test(timeout = 300000) public void testMinWithInvalidRange() { AggregationClient aClient = new AggregationClient(conf); Double min = null; Scan scan = new Scan(); scan.addFamily(TEST_FAMILY); scan.setStartRow(ROWS[4]); scan.setStopRow(ROWS[2]); final ColumnInterpreter<Double, Double, EmptyMsg, DoubleMsg, DoubleMsg> ci = new DoubleColumnInterpreter(); try { min = aClient.min(TEST_TABLE, ci, scan); } catch (Throwable e) { } assertEquals(null, min);// control should go to the catch block }
@Test(timeout = 300000) public void testMinWithInvalidRange2() { AggregationClient aClient = new AggregationClient(conf); Scan scan = new Scan(); scan.addFamily(TEST_FAMILY); scan.setStartRow(ROWS[6]); scan.setStopRow(ROWS[6]); final ColumnInterpreter<Double, Double, EmptyMsg, DoubleMsg, DoubleMsg> ci = new DoubleColumnInterpreter(); Double min = null; try { min = aClient.min(TEST_TABLE, ci, scan); } catch (Throwable e) { } assertEquals(null, min);// control should go to the catch block }
@Test(timeout = 300000) public void testSumWithValidRangeWithNullCF() { AggregationClient aClient = new AggregationClient(conf); Scan scan = new Scan(); scan.setStartRow(ROWS[6]); scan.setStopRow(ROWS[7]); final ColumnInterpreter<Double, Double, EmptyMsg, DoubleMsg, DoubleMsg> ci = new DoubleColumnInterpreter(); Double sum = null; try { sum = aClient.sum(TEST_TABLE, ci, scan); } catch (Throwable e) { } assertEquals(null, sum);// CP will throw an IOException about the // null column family, and max will be set to 0 }
@Test(timeout = 300000) public void testSumWithInvalidRange() { AggregationClient aClient = new AggregationClient(conf); Scan scan = new Scan(); scan.addFamily(TEST_FAMILY); scan.setStartRow(ROWS[6]); scan.setStopRow(ROWS[2]); final ColumnInterpreter<Double, Double, EmptyMsg, DoubleMsg, DoubleMsg> ci = new DoubleColumnInterpreter(); Double sum = null; try { sum = aClient.sum(TEST_TABLE, ci, scan); } catch (Throwable e) { } assertEquals(null, sum);// control should go to the catch block }
@Test(timeout = 300000) public void testAvgWithInvalidRange() { AggregationClient aClient = new AggregationClient(conf); Scan scan = new Scan(); scan.addColumn(TEST_FAMILY, TEST_QUALIFIER); scan.setStartRow(ROWS[5]); scan.setStopRow(ROWS[1]); final ColumnInterpreter<Double, Double, EmptyMsg, DoubleMsg, DoubleMsg> ci = new DoubleColumnInterpreter(); Double avg = null; try { avg = aClient.avg(TEST_TABLE, ci, scan); } catch (Throwable e) { } assertEquals(null, avg);// control should go to the catch block }
@Test(timeout = 300000) public void testStdWithValidRangeWithNullCF() { AggregationClient aClient = new AggregationClient(conf); Scan scan = new Scan(); scan.setStartRow(ROWS[6]); scan.setStopRow(ROWS[17]); final ColumnInterpreter<Double, Double, EmptyMsg, DoubleMsg, DoubleMsg> ci = new DoubleColumnInterpreter(); Double std = null; try { std = aClient.std(TEST_TABLE, ci, scan); } catch (Throwable e) { } assertEquals(null, std);// CP will throw an IOException about the // null column family, and max will be set to 0 }
@Test public void testStdWithInvalidRange() { AggregationClient aClient = new AggregationClient(conf); Scan scan = new Scan(); scan.addFamily(TEST_FAMILY); scan.setStartRow(ROWS[6]); scan.setStopRow(ROWS[1]); final ColumnInterpreter<Double, Double, EmptyMsg, DoubleMsg, DoubleMsg> ci = new DoubleColumnInterpreter(); Double std = null; try { std = aClient.std(TEST_TABLE, ci, scan); } catch (Throwable e) { } assertEquals(null, std);// control should go to the catch block }