Examples of HConnection


Examples of org.apache.hadoop.hbase.client.HConnection

  }

  @Test (expected = NotAllMetaRegionsOnlineException.class)
  public void testTimeoutWaitForRoot()
  throws IOException, InterruptedException {
    HConnection connection = Mockito.mock(HConnection.class);
    final CatalogTracker ct = constructAndStartCatalogTracker(connection);
    ct.waitForRoot(100);
  }
View Full Code Here

Examples of org.apache.hadoop.hbase.client.HConnection

  }

  @Test (expected = RetriesExhaustedException.class)
  public void testTimeoutWaitForMeta()
  throws IOException, InterruptedException {
    HConnection connection =
      HConnectionTestingUtility.getMockedConnection(UTIL.getConfiguration());
    try {
      final CatalogTracker ct = constructAndStartCatalogTracker(connection);
      ct.waitForMeta(100);
    } finally {
View Full Code Here

Examples of org.apache.hadoop.hbase.client.HConnection

   * @throws InterruptedException
   * @throws KeeperException
   */
  @Test public void testNoTimeoutWaitForRoot()
  throws IOException, InterruptedException, KeeperException {
    HConnection connection = Mockito.mock(HConnection.class);
    final CatalogTracker ct = constructAndStartCatalogTracker(connection);
    ServerName hsa = ct.getRootLocation();
    Assert.assertNull(hsa);

    // Now test waiting on root location getting set.
View Full Code Here

Examples of org.apache.hadoop.hbase.client.HConnection

    // Mock an HConnection and a HRegionInterface implementation.  Have the
    // HConnection return the HRI.  Have the HRI return a few mocked up responses
    // to make our test work.
    // Mock an HRegionInterface.
    final HRegionInterface implementation = Mockito.mock(HRegionInterface.class);
    HConnection connection = mockConnection(implementation);
    try {
      // Now the ct is up... set into the mocks some answers that make it look
      // like things have been getting assigned. Make it so we'll return a
      // location (no matter what the Get is). Same for getHRegionInfo -- always
      // just return the meta region.
      final Result result = getMetaTableRowResult();

      // TODO: Refactor.  This method has been moved out of HConnection.
      // It works for now but has been deprecated.
      Mockito.when(connection.getRegionServerWithRetries((ServerCallable<Result>)Mockito.any())).
        thenReturn(result);
      Mockito.when(implementation.getRegionInfo((byte[]) Mockito.any())).
        thenReturn(HRegionInfo.FIRST_META_REGIONINFO);
      final CatalogTracker ct = constructAndStartCatalogTracker(connection);
      ServerName hsa = ct.getMetaLocation();
View Full Code Here

Examples of org.apache.hadoop.hbase.client.HConnection

   * when done with this mocked Connection.
   * @throws IOException
   */
  private HConnection mockConnection(final HRegionInterface implementation)
  throws IOException {
    HConnection connection =
      HConnectionTestingUtility.getMockedConnection(UTIL.getConfiguration());
    Mockito.doNothing().when(connection).close();
    // Make it so we return any old location when asked.
    final HRegionLocation anyLocation =
      new HRegionLocation(HRegionInfo.FIRST_META_REGIONINFO, SN.getHostname(),
        SN.getPort());
    Mockito.when(connection.getRegionLocation((byte[]) Mockito.any(),
        (byte[]) Mockito.any(), Mockito.anyBoolean())).
      thenReturn(anyLocation);
    Mockito.when(connection.locateRegion((byte[]) Mockito.any(),
        (byte[]) Mockito.any())).
      thenReturn(anyLocation);
    if (implementation != null) {
      // If a call to getHRegionConnection, return this implementation.
      Mockito.when(connection.getHRegionConnection(Mockito.anyString(), Mockito.anyInt())).
        thenReturn(implementation);
    }
    return connection;
  }
View Full Code Here

Examples of org.apache.hadoop.hbase.client.HConnection

      final HBaseAdmin admin) throws IOException {
    ClusterStatus status = admin.getClusterStatus();
    Collection<ServerName> regionServers = status.getServers();
    Map<ServerName, List<String>> mm =
        new HashMap<ServerName, List<String>>();
    HConnection connection = admin.getConnection();
    for (ServerName hsi : regionServers) {
      AdminProtos.AdminService.BlockingInterface server = connection.getAdmin(hsi);

      // list all online regions from this region server
      List<HRegionInfo> regions = ProtobufUtil.getOnlineRegions(server);
      List<String> regionNames = new ArrayList<String>();
      for (HRegionInfo hri : regions) {
View Full Code Here

Examples of org.apache.hadoop.hbase.client.HConnection

    assertNoErrors(hbck);
  }

  private void deleteMetaRegion(Configuration conf, boolean unassign, boolean hdfs,
      boolean regionInfoOnly) throws IOException, InterruptedException {
    HConnection connection = HConnectionManager.getConnection(conf);
    HRegionLocation metaLocation = connection.locateRegion(TableName.META_TABLE_NAME,
        HConstants.EMPTY_START_ROW);
    ServerName hsa = ServerName.valueOf(metaLocation.getHostnamePort(), 0L);
    HRegionInfo hri = metaLocation.getRegionInfo();
    if (unassign) {
      LOG.info("Undeploying meta region " + hri + " from server " + hsa);
View Full Code Here

Examples of org.apache.hadoop.hbase.client.HConnection

            return builder.build();
          }
      });

    // Get a connection w/ mocked up common methods.
    HConnection connection =
      HConnectionTestingUtility.getMockedConnectionAndDecorate(HTU.getConfiguration(),
        null, implementation, SERVERNAME_B, REGIONINFO);

    // Make it so we can get a catalogtracker from servermanager.. .needed
    // down in guts of server shutdown handler.
View Full Code Here

Examples of org.apache.hadoop.hbase.client.HConnection

    GetResponse.Builder getBuilder = GetResponse.newBuilder();
    getBuilder.setResult(ProtobufUtil.toResult(r));
    Mockito.when(ri.get((RpcController)Mockito.any(), (GetRequest) Mockito.any())).
      thenReturn(getBuilder.build());
    // Get a connection w/ mocked up common methods.
    HConnection connection = HConnectionTestingUtility.
      getMockedConnectionAndDecorate(HTU.getConfiguration(), null,
        ri, SERVERNAME_B, REGIONINFO);
    // Make it so we can get the connection from our mocked catalogtracker
    Mockito.when(ct.getConnection()).thenReturn(connection);
    // Create and startup an executor. Used by AM handling zk callbacks.
View Full Code Here

Examples of org.apache.hadoop.hbase.client.HConnection

   * @throws TableNotFoundException if table does not yet exist
   */
  public void doBulkLoad(Path hfofDir, final HTable table)
    throws TableNotFoundException, IOException
  {
    final HConnection conn = table.getConnection();

    if (!conn.isTableAvailable(table.getTableName())) {
      throw new TableNotFoundException("Table " +
          Bytes.toStringBinary(table.getTableName()) +
          "is not currently available.");
    }

View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.