Java 类org.apache.hadoop.hbase.coprocessor.protobuf.generated.ColumnAggregationWithErrorsProtos 实例源码

项目:ditb    文件:TestBatchCoprocessorEndpoint.java   
@Test
public void testAggregationWithErrors() throws Throwable {
  Table table = new HTable(util.getConfiguration(), TEST_TABLE);
  final Map<byte[], ColumnAggregationWithErrorsProtos.SumResponse> results =
      Collections.synchronizedMap(
          new TreeMap<byte[], ColumnAggregationWithErrorsProtos.SumResponse>(
              Bytes.BYTES_COMPARATOR
          ));
  ColumnAggregationWithErrorsProtos.SumRequest.Builder builder =
      ColumnAggregationWithErrorsProtos.SumRequest
      .newBuilder();
  builder.setFamily(ByteStringer.wrap(TEST_FAMILY));
  if (TEST_QUALIFIER != null && TEST_QUALIFIER.length > 0) {
    builder.setQualifier(ByteStringer.wrap(TEST_QUALIFIER));
  }

  boolean hasError = false;
  try {
    table.batchCoprocessorService(
        ColumnAggregationWithErrorsProtos.ColumnAggregationServiceWithErrors.getDescriptor()
            .findMethodByName("sum"),
        builder.build(), ROWS[0], ROWS[ROWS.length - 1],
        ColumnAggregationWithErrorsProtos.SumResponse.getDefaultInstance(),
        new Batch.Callback<ColumnAggregationWithErrorsProtos.SumResponse>() {

          @Override
          public void update(byte[] region, byte[] row,
              ColumnAggregationWithErrorsProtos.SumResponse result) {
            results.put(region, result);
          }
        });
  } catch (Throwable t) {
    LOG.info("Exceptions in coprocessor service", t);
    hasError = true;
  }

  int sumResult = 0;
  int expectedResult = 0;
  for (Map.Entry<byte[], ColumnAggregationWithErrorsProtos.SumResponse> e : results.entrySet()) {
    LOG.info("Got value " + e.getValue().getSum() + " for region "
        + Bytes.toStringBinary(e.getKey()));
    sumResult += e.getValue().getSum();
  }
  for (int i = 0; i < rowSeperator2; i++) {
    expectedResult += i;
  }
  assertEquals("Invalid result", expectedResult, sumResult);
  assertTrue(hasError);
  table.close();
}
项目:pbase    文件:TestBatchCoprocessorEndpoint.java   
@Test
public void testAggregationWithErrors() throws Throwable {
  Table table = new HTable(util.getConfiguration(), TEST_TABLE);
  final Map<byte[], ColumnAggregationWithErrorsProtos.SumResponse> results =
      Collections.synchronizedMap(
          new TreeMap<byte[], ColumnAggregationWithErrorsProtos.SumResponse>(
              Bytes.BYTES_COMPARATOR
          ));
  ColumnAggregationWithErrorsProtos.SumRequest.Builder builder =
      ColumnAggregationWithErrorsProtos.SumRequest
      .newBuilder();
  builder.setFamily(ByteStringer.wrap(TEST_FAMILY));
  if (TEST_QUALIFIER != null && TEST_QUALIFIER.length > 0) {
    builder.setQualifier(ByteStringer.wrap(TEST_QUALIFIER));
  }

  boolean hasError = false;
  try {
    table.batchCoprocessorService(
        ColumnAggregationWithErrorsProtos.ColumnAggregationServiceWithErrors.getDescriptor()
            .findMethodByName("sum"),
        builder.build(), ROWS[0], ROWS[ROWS.length - 1],
        ColumnAggregationWithErrorsProtos.SumResponse.getDefaultInstance(),
        new Batch.Callback<ColumnAggregationWithErrorsProtos.SumResponse>() {

          @Override
          public void update(byte[] region, byte[] row,
              ColumnAggregationWithErrorsProtos.SumResponse result) {
            results.put(region, result);
          }
        });
  } catch (Throwable t) {
    LOG.info("Exceptions in coprocessor service", t);
    hasError = true;
  }

  int sumResult = 0;
  int expectedResult = 0;
  for (Map.Entry<byte[], ColumnAggregationWithErrorsProtos.SumResponse> e : results.entrySet()) {
    LOG.info("Got value " + e.getValue().getSum() + " for region "
        + Bytes.toStringBinary(e.getKey()));
    sumResult += e.getValue().getSum();
  }
  for (int i = 0; i < rowSeperator2; i++) {
    expectedResult += i;
  }
  assertEquals("Invalid result", expectedResult, sumResult);
  assertTrue(hasError);
  table.close();
}
项目:HIndex    文件:TestBatchCoprocessorEndpoint.java   
@Test
public void testAggregationWithErrors() throws Throwable {
  HTable table = new HTable(util.getConfiguration(), TEST_TABLE);
  final Map<byte[], ColumnAggregationWithErrorsProtos.SumResponse> results =
      Collections.synchronizedMap(
          new TreeMap<byte[], ColumnAggregationWithErrorsProtos.SumResponse>(
              Bytes.BYTES_COMPARATOR
          ));
  ColumnAggregationWithErrorsProtos.SumRequest.Builder builder =
      ColumnAggregationWithErrorsProtos.SumRequest
      .newBuilder();
  builder.setFamily(HBaseZeroCopyByteString.wrap(TEST_FAMILY));
  if (TEST_QUALIFIER != null && TEST_QUALIFIER.length > 0) {
    builder.setQualifier(HBaseZeroCopyByteString.wrap(TEST_QUALIFIER));
  }

  boolean hasError = false;
  try {
    table.batchCoprocessorService(
        ColumnAggregationWithErrorsProtos.ColumnAggregationServiceWithErrors.getDescriptor()
            .findMethodByName("sum"),
        builder.build(), ROWS[0], ROWS[ROWS.length - 1],
        ColumnAggregationWithErrorsProtos.SumResponse.getDefaultInstance(),
        new Batch.Callback<ColumnAggregationWithErrorsProtos.SumResponse>() {

          @Override
          public void update(byte[] region, byte[] row,
              ColumnAggregationWithErrorsProtos.SumResponse result) {
            results.put(region, result);
          }
        });
  } catch (Throwable t) {
    LOG.info("Exceptions in coprocessor service", t);
    hasError = true;
  }

  int sumResult = 0;
  int expectedResult = 0;
  for (Map.Entry<byte[], ColumnAggregationWithErrorsProtos.SumResponse> e : results.entrySet()) {
    LOG.info("Got value " + e.getValue().getSum() + " for region "
        + Bytes.toStringBinary(e.getKey()));
    sumResult += e.getValue().getSum();
  }
  for (int i = 0; i < rowSeperator2; i++) {
    expectedResult += i;
  }
  assertEquals("Invalid result", expectedResult, sumResult);
  assertTrue(hasError);
  table.close();
}
项目:hbase    文件:TestBatchCoprocessorEndpoint.java   
@Test
public void testAggregationWithErrors() throws Throwable {
  Table table = util.getConnection().getTable(TEST_TABLE);
  final Map<byte[], ColumnAggregationWithErrorsSumResponse> results =
      Collections.synchronizedMap(
          new TreeMap<byte[], ColumnAggregationWithErrorsSumResponse>(
              Bytes.BYTES_COMPARATOR
          ));
  ColumnAggregationWithErrorsSumRequest.Builder builder =
      ColumnAggregationWithErrorsSumRequest
      .newBuilder();
  builder.setFamily(ByteString.copyFrom(TEST_FAMILY));
  if (TEST_QUALIFIER != null && TEST_QUALIFIER.length > 0) {
    builder.setQualifier(ByteString.copyFrom(TEST_QUALIFIER));
  }

  boolean hasError = false;
  try {
    table.batchCoprocessorService(
        ColumnAggregationWithErrorsProtos.ColumnAggregationServiceWithErrors.getDescriptor()
            .findMethodByName("sum"),
        builder.build(), ROWS[0], ROWS[ROWS.length - 1],
        ColumnAggregationWithErrorsSumResponse.getDefaultInstance(),
        new Batch.Callback<ColumnAggregationWithErrorsSumResponse>() {

          @Override
          public void update(byte[] region, byte[] row,
              ColumnAggregationWithErrorsSumResponse result) {
            results.put(region, result);
          }
        });
  } catch (Throwable t) {
    LOG.info("Exceptions in coprocessor service", t);
    hasError = true;
  }

  int sumResult = 0;
  int expectedResult = 0;
  for (Map.Entry<byte[], ColumnAggregationWithErrorsSumResponse> e : results.entrySet()) {
    LOG.info("Got value " + e.getValue().getSum() + " for region "
        + Bytes.toStringBinary(e.getKey()));
    sumResult += e.getValue().getSum();
  }
  for (int i = 0; i < rowSeperator2; i++) {
    expectedResult += i;
  }
  assertEquals("Invalid result", expectedResult, sumResult);
  assertTrue(hasError);
  table.close();
}
项目:PyroDB    文件:TestBatchCoprocessorEndpoint.java   
@Test
public void testAggregationWithErrors() throws Throwable {
  HTable table = new HTable(util.getConfiguration(), TEST_TABLE);
  final Map<byte[], ColumnAggregationWithErrorsProtos.SumResponse> results =
      Collections.synchronizedMap(
          new TreeMap<byte[], ColumnAggregationWithErrorsProtos.SumResponse>(
              Bytes.BYTES_COMPARATOR
          ));
  ColumnAggregationWithErrorsProtos.SumRequest.Builder builder =
      ColumnAggregationWithErrorsProtos.SumRequest
      .newBuilder();
  builder.setFamily(HBaseZeroCopyByteString.wrap(TEST_FAMILY));
  if (TEST_QUALIFIER != null && TEST_QUALIFIER.length > 0) {
    builder.setQualifier(HBaseZeroCopyByteString.wrap(TEST_QUALIFIER));
  }

  boolean hasError = false;
  try {
    table.batchCoprocessorService(
        ColumnAggregationWithErrorsProtos.ColumnAggregationServiceWithErrors.getDescriptor()
            .findMethodByName("sum"),
        builder.build(), ROWS[0], ROWS[ROWS.length - 1],
        ColumnAggregationWithErrorsProtos.SumResponse.getDefaultInstance(),
        new Batch.Callback<ColumnAggregationWithErrorsProtos.SumResponse>() {

          @Override
          public void update(byte[] region, byte[] row,
              ColumnAggregationWithErrorsProtos.SumResponse result) {
            results.put(region, result);
          }
        });
  } catch (Throwable t) {
    LOG.info("Exceptions in coprocessor service", t);
    hasError = true;
  }

  int sumResult = 0;
  int expectedResult = 0;
  for (Map.Entry<byte[], ColumnAggregationWithErrorsProtos.SumResponse> e : results.entrySet()) {
    LOG.info("Got value " + e.getValue().getSum() + " for region "
        + Bytes.toStringBinary(e.getKey()));
    sumResult += e.getValue().getSum();
  }
  for (int i = 0; i < rowSeperator2; i++) {
    expectedResult += i;
  }
  assertEquals("Invalid result", expectedResult, sumResult);
  assertTrue(hasError);
  table.close();
}