• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java TestProtos类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.hadoop.hbase.ipc.protobuf.generated.TestProtos的典型用法代码示例。如果您正苦于以下问题:Java TestProtos类的具体用法?Java TestProtos怎么用?Java TestProtos使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



TestProtos类属于org.apache.hadoop.hbase.ipc.protobuf.generated包,在下文中一共展示了TestProtos类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: testCoprocessorError

import org.apache.hadoop.hbase.ipc.protobuf.generated.TestProtos; //导入依赖的package包/类
@Test
public void testCoprocessorError() throws Exception {
  Configuration configuration = new Configuration(util.getConfiguration());
  // Make it not retry forever
  configuration.setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 1);
  Table table = new HTable(configuration, TEST_TABLE);

  try {
    CoprocessorRpcChannel protocol = table.coprocessorService(ROWS[0]);

    TestRpcServiceProtos.TestProtobufRpcProto.BlockingInterface service =
        TestRpcServiceProtos.TestProtobufRpcProto.newBlockingStub(protocol);

    service.error(null, TestProtos.EmptyRequestProto.getDefaultInstance());
    fail("Should have thrown an exception");
  } catch (ServiceException e) {
  } finally {
    table.close();
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:21,代码来源:TestCoprocessorEndpoint.java


示例2: testCoprocessorError

import org.apache.hadoop.hbase.ipc.protobuf.generated.TestProtos; //导入依赖的package包/类
@Test
public void testCoprocessorError() throws Exception {
  Configuration configuration = new Configuration(util.getConfiguration());
  // Make it not retry forever
  configuration.setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 1);
  HTable table = new HTable(configuration, TEST_TABLE);

  try {
    CoprocessorRpcChannel protocol = table.coprocessorService(ROWS[0]);

    TestRpcServiceProtos.TestProtobufRpcProto.BlockingInterface service =
        TestRpcServiceProtos.TestProtobufRpcProto.newBlockingStub(protocol);

    service.error(null, TestProtos.EmptyRequestProto.getDefaultInstance());
    fail("Should have thrown an exception");
  } catch (ServiceException e) {
  } finally {
    table.close();
  }
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:21,代码来源:TestCoprocessorEndpoint.java


示例3: testCoprocessorError

import org.apache.hadoop.hbase.ipc.protobuf.generated.TestProtos; //导入依赖的package包/类
@Test
public void testCoprocessorError() throws Exception {
  Configuration configuration = new Configuration(util.getConfiguration());
  // Make it not retry forever
  configuration.setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 1);
  Table table = util.getConnection().getTable(TEST_TABLE);

  try {
    CoprocessorRpcChannel protocol = table.coprocessorService(ROWS[0]);

    TestRpcServiceProtos.TestProtobufRpcProto.BlockingInterface service =
        TestRpcServiceProtos.TestProtobufRpcProto.newBlockingStub(protocol);

    service.error(null, TestProtos.EmptyRequestProto.getDefaultInstance());
    fail("Should have thrown an exception");
  } catch (ServiceException e) {
  } finally {
    table.close();
  }
}
 
开发者ID:apache,项目名称:hbase,代码行数:21,代码来源:TestCoprocessorEndpoint.java


示例4: echo

import org.apache.hadoop.hbase.ipc.protobuf.generated.TestProtos; //导入依赖的package包/类
@Override
public TestProtos.EchoResponseProto echo(RpcController controller,
                                         TestProtos.EchoRequestProto request)
    throws ServiceException {
  if (controller instanceof PayloadCarryingRpcController) {
    PayloadCarryingRpcController pcrc = (PayloadCarryingRpcController) controller;
    // If cells, scan them to check we are able to iterate what we were given and since
    // this is
    // an echo, just put them back on the controller creating a new block. Tests our
    // block
    // building.
    CellScanner cellScanner = pcrc.cellScanner();
    List<Cell> list = null;
    if (cellScanner != null) {
      list = new ArrayList<Cell>();
      try {
        while (cellScanner.advance()) {
          list.add(cellScanner.current());
        }
      } catch (IOException e) {
        throw new ServiceException(e);
      }
    }
    cellScanner = CellUtil.createCellScanner(list);
    ((PayloadCarryingRpcController) controller).setCellScanner(cellScanner);
  }
  return TestProtos.EchoResponseProto.newBuilder()
      .setMessage(request.getMessage()).build();
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:30,代码来源:TestSecureRPC.java


示例5: run

import org.apache.hadoop.hbase.ipc.protobuf.generated.TestProtos; //导入依赖的package包/类
@Override
public void run() {
    String result;
    try {
        result = stub.echo(null, TestProtos.EchoRequestProto.newBuilder().setMessage(String.valueOf(
            ThreadLocalRandom.current().nextInt())).build()).getMessage();
      } catch (ServiceException e) {
        throw new RuntimeException(e);
      }
    if (results != null) {
        synchronized (results) {
            results.add(result);
          }
      }
  }
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:16,代码来源:TestSecureRPC.java


示例6: testMasterCoprocessorService

import org.apache.hadoop.hbase.ipc.protobuf.generated.TestProtos; //导入依赖的package包/类
@Test
public void testMasterCoprocessorService() throws Throwable {
  Admin admin = util.getHBaseAdmin();
  final TestProtos.EchoRequestProto request =
      TestProtos.EchoRequestProto.newBuilder().setMessage("hello").build();
  TestRpcServiceProtos.TestProtobufRpcProto.BlockingInterface service =
      TestRpcServiceProtos.TestProtobufRpcProto.newBlockingStub(admin.coprocessorService());
  assertEquals("hello", service.echo(null, request).getMessage());
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:10,代码来源:TestCoprocessorEndpoint.java


示例7: testMasterCoprocessorError

import org.apache.hadoop.hbase.ipc.protobuf.generated.TestProtos; //导入依赖的package包/类
@Test
public void testMasterCoprocessorError() throws Throwable {
  Admin admin = util.getHBaseAdmin();
  TestRpcServiceProtos.TestProtobufRpcProto.BlockingInterface service =
      TestRpcServiceProtos.TestProtobufRpcProto.newBlockingStub(admin.coprocessorService());
  try {
    service.error(null, TestProtos.EmptyRequestProto.getDefaultInstance());
    fail("Should have thrown an exception");
  } catch (ServiceException e) {
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:12,代码来源:TestCoprocessorEndpoint.java


示例8: testProtoBufRpc

import org.apache.hadoop.hbase.ipc.protobuf.generated.TestProtos; //导入依赖的package包/类
@Test
public void testProtoBufRpc() throws Exception {
  RpcClient rpcClient = RpcClientFactory.createClient(conf, HConstants.CLUSTER_ID_DEFAULT);
  try {
    BlockingRpcChannel channel = rpcClient.createBlockingRpcChannel(
        ServerName.valueOf(this.isa.getHostName(), this.isa.getPort(), System.currentTimeMillis()),
      User.getCurrent(), 0);
    TestRpcServiceProtos.TestProtobufRpcProto.BlockingInterface stub =
      TestRpcServiceProtos.TestProtobufRpcProto.newBlockingStub(channel);
    // Test ping method
    TestProtos.EmptyRequestProto emptyRequest =
      TestProtos.EmptyRequestProto.newBuilder().build();
    stub.ping(null, emptyRequest);

    // Test echo method
    EchoRequestProto echoRequest = EchoRequestProto.newBuilder().setMessage("hello").build();
    EchoResponseProto echoResponse = stub.echo(null, echoRequest);
    Assert.assertEquals(echoResponse.getMessage(), "hello");

    // Test error method - error should be thrown as RemoteException
    try {
      stub.error(null, emptyRequest);
      Assert.fail("Expected exception is not thrown");
    } catch (ServiceException e) {
    }
  } finally {
    rpcClient.close();
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:30,代码来源:TestProtoBufRpc.java


示例9: testMasterCoprocessorService

import org.apache.hadoop.hbase.ipc.protobuf.generated.TestProtos; //导入依赖的package包/类
@Test
public void testMasterCoprocessorService() throws Throwable {
  HBaseAdmin admin = util.getHBaseAdmin();
  final TestProtos.EchoRequestProto request =
      TestProtos.EchoRequestProto.newBuilder().setMessage("hello").build();
  TestRpcServiceProtos.TestProtobufRpcProto.BlockingInterface service =
      TestRpcServiceProtos.TestProtobufRpcProto.newBlockingStub(admin.coprocessorService());
  assertEquals("hello", service.echo(null, request).getMessage());
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:10,代码来源:TestCoprocessorEndpoint.java


示例10: testMasterCoprocessorError

import org.apache.hadoop.hbase.ipc.protobuf.generated.TestProtos; //导入依赖的package包/类
@Test
public void testMasterCoprocessorError() throws Throwable {
  HBaseAdmin admin = util.getHBaseAdmin();
  TestRpcServiceProtos.TestProtobufRpcProto.BlockingInterface service =
      TestRpcServiceProtos.TestProtobufRpcProto.newBlockingStub(admin.coprocessorService());
  try {
    service.error(null, TestProtos.EmptyRequestProto.getDefaultInstance());
    fail("Should have thrown an exception");
  } catch (ServiceException e) {
  }
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:12,代码来源:TestCoprocessorEndpoint.java


示例11: testProtoBufRpc

import org.apache.hadoop.hbase.ipc.protobuf.generated.TestProtos; //导入依赖的package包/类
@Test
public void testProtoBufRpc() throws Exception {
  RpcClient rpcClient = new RpcClient(conf, HConstants.CLUSTER_ID_DEFAULT);
  try {
    BlockingRpcChannel channel = rpcClient.createBlockingRpcChannel(
        ServerName.valueOf(this.isa.getHostName(), this.isa.getPort(), System.currentTimeMillis()),
      User.getCurrent(), 0);
    TestRpcServiceProtos.TestProtobufRpcProto.BlockingInterface stub =
      TestRpcServiceProtos.TestProtobufRpcProto.newBlockingStub(channel);
    // Test ping method
    TestProtos.EmptyRequestProto emptyRequest =
      TestProtos.EmptyRequestProto.newBuilder().build();
    stub.ping(null, emptyRequest);

    // Test echo method
    EchoRequestProto echoRequest = EchoRequestProto.newBuilder().setMessage("hello").build();
    EchoResponseProto echoResponse = stub.echo(null, echoRequest);
    Assert.assertEquals(echoResponse.getMessage(), "hello");

    // Test error method - error should be thrown as RemoteException
    try {
      stub.error(null, emptyRequest);
      Assert.fail("Expected exception is not thrown");
    } catch (ServiceException e) {
    }
  } finally {
    rpcClient.stop();
  }
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:30,代码来源:TestProtoBufRpc.java


示例12: testMasterCoprocessorService

import org.apache.hadoop.hbase.ipc.protobuf.generated.TestProtos; //导入依赖的package包/类
@Test
public void testMasterCoprocessorService() throws Throwable {
  Admin admin = util.getAdmin();
  final TestProtos.EchoRequestProto request =
      TestProtos.EchoRequestProto.newBuilder().setMessage("hello").build();
  TestRpcServiceProtos.TestProtobufRpcProto.BlockingInterface service =
      TestRpcServiceProtos.TestProtobufRpcProto.newBlockingStub(admin.coprocessorService());
  assertEquals("hello", service.echo(null, request).getMessage());
}
 
开发者ID:apache,项目名称:hbase,代码行数:10,代码来源:TestCoprocessorEndpoint.java


示例13: testMasterCoprocessorError

import org.apache.hadoop.hbase.ipc.protobuf.generated.TestProtos; //导入依赖的package包/类
@Test
public void testMasterCoprocessorError() throws Throwable {
  Admin admin = util.getAdmin();
  TestRpcServiceProtos.TestProtobufRpcProto.BlockingInterface service =
      TestRpcServiceProtos.TestProtobufRpcProto.newBlockingStub(admin.coprocessorService());
  try {
    service.error(null, TestProtos.EmptyRequestProto.getDefaultInstance());
    fail("Should have thrown an exception");
  } catch (ServiceException e) {
  }
}
 
开发者ID:apache,项目名称:hbase,代码行数:12,代码来源:TestCoprocessorEndpoint.java


示例14: testMasterCoprocessorService

import org.apache.hadoop.hbase.ipc.protobuf.generated.TestProtos; //导入依赖的package包/类
@Test
public void testMasterCoprocessorService() throws Exception {
  TestProtos.EchoRequestProto request =
      TestProtos.EchoRequestProto.newBuilder().setMessage("hello").build();
  TestProtos.EchoResponseProto response =
      admin
          .<TestRpcServiceProtos.TestProtobufRpcProto.Stub, TestProtos.EchoResponseProto> coprocessorService(
            TestRpcServiceProtos.TestProtobufRpcProto::newStub,
            (s, c, done) -> s.echo(c, request, done)).get();
  assertEquals("hello", response.getMessage());
}
 
开发者ID:apache,项目名称:hbase,代码行数:12,代码来源:TestAsyncCoprocessorEndpoint.java


示例15: testMasterCoprocessorError

import org.apache.hadoop.hbase.ipc.protobuf.generated.TestProtos; //导入依赖的package包/类
@Test
public void testMasterCoprocessorError() throws Exception {
  TestProtos.EmptyRequestProto emptyRequest = TestProtos.EmptyRequestProto.getDefaultInstance();
  try {
    admin
        .<TestRpcServiceProtos.TestProtobufRpcProto.Stub, TestProtos.EmptyResponseProto> coprocessorService(
          TestRpcServiceProtos.TestProtobufRpcProto::newStub,
          (s, c, done) -> s.error(c, emptyRequest, done)).get();
    fail("Should have thrown an exception");
  } catch (Exception e) {
  }
}
 
开发者ID:apache,项目名称:hbase,代码行数:13,代码来源:TestAsyncCoprocessorEndpoint.java


示例16: testMasterCoprocessorService

import org.apache.hadoop.hbase.ipc.protobuf.generated.TestProtos; //导入依赖的package包/类
@Test
public void testMasterCoprocessorService() throws Throwable {
  HBaseAdmin admin = util.getHBaseAdmin();
  final TestProtos.EchoRequestProto request =
      TestProtos.EchoRequestProto.newBuilder().setMessage("hello").build();
  TestRpcServiceProtos.TestProtobufRpcProto.BlockingInterface service =
      TestRpcServiceProtos.TestProtobufRpcProto.newBlockingStub(admin.coprocessorService());
  assertEquals("hello", service.echo(null, request).getMessage());
  admin.close();
}
 
开发者ID:daidong,项目名称:DominoHBase,代码行数:11,代码来源:TestCoprocessorEndpoint.java


示例17: ping

import org.apache.hadoop.hbase.ipc.protobuf.generated.TestProtos; //导入依赖的package包/类
@Override
public TestProtos.EmptyResponseProto ping(RpcController controller,
                                          TestProtos.EmptyRequestProto request)
    throws ServiceException {
  return null;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:7,代码来源:TestSecureRPC.java


示例18: error

import org.apache.hadoop.hbase.ipc.protobuf.generated.TestProtos; //导入依赖的package包/类
@Override
public TestProtos.EmptyResponseProto error(RpcController controller,
                                           TestProtos.EmptyRequestProto request)
    throws ServiceException {
  return null;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:7,代码来源:TestSecureRPC.java


示例19: ping

import org.apache.hadoop.hbase.ipc.protobuf.generated.TestProtos; //导入依赖的package包/类
@Override
public void ping(RpcController controller, TestProtos.EmptyRequestProto request,
                 RpcCallback<TestProtos.EmptyResponseProto> done) {
  done.run(TestProtos.EmptyResponseProto.getDefaultInstance());
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:6,代码来源:ProtobufCoprocessorService.java


示例20: echo

import org.apache.hadoop.hbase.ipc.protobuf.generated.TestProtos; //导入依赖的package包/类
@Override
public void echo(RpcController controller, TestProtos.EchoRequestProto request,
                 RpcCallback<TestProtos.EchoResponseProto> done) {
  String message = request.getMessage();
  done.run(TestProtos.EchoResponseProto.newBuilder().setMessage(message).build());
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:7,代码来源:ProtobufCoprocessorService.java



注:本文中的org.apache.hadoop.hbase.ipc.protobuf.generated.TestProtos类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Node类代码示例发布时间:2022-05-22
下一篇:
Java PopupOverlay类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap