Package org.apache.hadoop.hbase.ipc

Examples of org.apache.hadoop.hbase.ipc.HMasterInterface


    Configuration conf = HBaseConfiguration.create();
    // setup the conf to match the expected properties
    conf.setInt("hbase.client.retries.number", numRetries);
    conf.setLong("hbase.client.pause", pauseTime);
    // mock the master admin to our mock
    HMasterInterface mockMaster = Mockito.mock(HMasterInterface.class);
    Mockito.when(mockConnection.getConfiguration()).thenReturn(conf);
    Mockito.when(mockConnection.getMaster()).thenReturn(mockMaster);
    // set the max wait time for the snapshot to complete
    Mockito
        .when(
          mockMaster.snapshot(
            Mockito.any(HSnapshotDescription.class))).thenReturn((long)maxWaitTime);
    // first five times, we return false, last we get success
    Mockito.when(
      mockMaster.isSnapshotDone(
        Mockito.any(HSnapshotDescription.class))).thenReturn(false, false,
          false, false, false, true);

    // setup the admin and run the test
    HBaseAdmin admin = new HBaseAdmin(mockConnection);
View Full Code Here


    Configuration conf = HBaseConfiguration.create();
    // setup the conf to match the expected properties
    conf.setInt("hbase.client.retries.number", numRetries);
    conf.setLong("hbase.client.pause", pauseTime);
    // mock the master admin to our mock
    HMasterInterface mockMaster = Mockito.mock(HMasterInterface.class);
    Mockito.when(mockConnection.getConfiguration()).thenReturn(conf);
    Mockito.when(mockConnection.getMaster()).thenReturn(mockMaster);
    // set the max wait time for the snapshot to complete
    Mockito
        .when(
          mockMaster.snapshot(
            Mockito.any(HSnapshotDescription.class))).thenReturn((long)maxWaitTime);

    // first five times, we return false, last we get success
    Mockito.when(
      mockMaster.isSnapshotDone(
        Mockito.any(HSnapshotDescription.class))).thenReturn(false, false,
      false, false, false, true);

    // setup the admin and run the test
    HBaseAdmin admin = new HBaseAdmin(mockConnection);
View Full Code Here

    failSnapshotStart(admin, builder.setName("snapshot").setTable("-table").build());
    failSnapshotStart(admin, builder.setName("snapshot").setTable("table fails").build());
    failSnapshotStart(admin, builder.setName("snapshot").setTable("tab%le").build());

    // mock the master connection
    HMasterInterface master = Mockito.mock(HMasterInterface.class);
    Mockito.when(mockConnection.getMaster()).thenReturn(master);

    Mockito.when(
      master.snapshot(Mockito.any(HSnapshotDescription.class))).thenReturn((long)0);
    Mockito.when(
      master.isSnapshotDone(
        Mockito.any(HSnapshotDescription.class))).thenReturn(true);

      // make sure that we can use valid names
    admin.snapshot(builder.setName("snapshot").setTable("table").build());
  }
View Full Code Here

              throw new MasterNotRunningException();
            }

            InetSocketAddress isa =
              new InetSocketAddress(sn.getHostname(), sn.getPort());
            HMasterInterface tryMaster = rpcEngine.getProxy(
                HMasterInterface.class, HMasterInterface.VERSION, isa, this.conf,
                this.rpcTimeout);

            if (tryMaster.isMasterRunning()) {
              this.master = tryMaster;
              this.masterLock.notifyAll();
              break;
            }
View Full Code Here

    Configuration conf = HBaseConfiguration.create();
    // setup the conf to match the expected properties
    conf.setInt("hbase.client.retries.number", numRetries);
    conf.setLong("hbase.client.pause", pauseTime);
    // mock the master admin to our mock
    HMasterInterface mockMaster = Mockito.mock(HMasterInterface.class);
    Mockito.when(mockConnection.getConfiguration()).thenReturn(conf);
    Mockito.when(mockConnection.getMaster()).thenReturn(mockMaster);
    // set the max wait time for the snapshot to complete
    Mockito
        .when(
          mockMaster.snapshot(
            Mockito.any(HSnapshotDescription.class))).thenReturn((long)maxWaitTime);
    // first five times, we return false, last we get success
    Mockito.when(
      mockMaster.isSnapshotDone(
        Mockito.any(HSnapshotDescription.class))).thenReturn(false, false,
          false, false, false, true);

    // setup the admin and run the test
    HBaseAdmin admin = new HBaseAdmin(mockConnection);
View Full Code Here

    Configuration conf = HBaseConfiguration.create();
    // setup the conf to match the expected properties
    conf.setInt("hbase.client.retries.number", numRetries);
    conf.setLong("hbase.client.pause", pauseTime);
    // mock the master admin to our mock
    HMasterInterface mockMaster = Mockito.mock(HMasterInterface.class);
    Mockito.when(mockConnection.getConfiguration()).thenReturn(conf);
    Mockito.when(mockConnection.getMaster()).thenReturn(mockMaster);
    // set the max wait time for the snapshot to complete
    Mockito
        .when(
          mockMaster.snapshot(
            Mockito.any(HSnapshotDescription.class))).thenReturn((long)maxWaitTime);

    // first five times, we return false, last we get success
    Mockito.when(
      mockMaster.isSnapshotDone(
        Mockito.any(HSnapshotDescription.class))).thenReturn(false, false,
      false, false, false, true);

    // setup the admin and run the test
    HBaseAdmin admin = new HBaseAdmin(mockConnection);
View Full Code Here

    failSnapshotStart(admin, builder.setName("snapshot").setTable("-table").build());
    failSnapshotStart(admin, builder.setName("snapshot").setTable("table fails").build());
    failSnapshotStart(admin, builder.setName("snapshot").setTable("tab%le").build());

    // mock the master connection
    HMasterInterface master = Mockito.mock(HMasterInterface.class);
    Mockito.when(mockConnection.getMaster()).thenReturn(master);

    Mockito.when(
      master.snapshot(Mockito.any(HSnapshotDescription.class))).thenReturn((long)0);
    Mockito.when(
      master.isSnapshotDone(
        Mockito.any(HSnapshotDescription.class))).thenReturn(true);

      // make sure that we can use valid names
    admin.snapshot(builder.setName("snapshot").setTable("table").build());
  }
View Full Code Here

        tries++) {
         
          masterLocation = new HServerAddress(this.conf.get(MASTER_ADDRESS,
            DEFAULT_MASTER_ADDRESS));
          try {
            HMasterInterface tryMaster = (HMasterInterface)HBaseRPC.getProxy(
                HMasterInterface.class, HBaseRPCProtocolVersion.versionID,
                masterLocation.getInetSocketAddress(), this.conf);
           
            if (tryMaster.isMasterRunning()) {
              this.master = tryMaster;
              break;
            }
           
          } catch (IOException e) {
View Full Code Here

        tries++) {

          try {
            masterLocation = zk.readMasterAddressOrThrow();

            HMasterInterface tryMaster = (HMasterInterface)HBaseRPC.getProxy(
                HMasterInterface.class, HBaseRPCProtocolVersion.versionID,
                masterLocation.getInetSocketAddress(), this.conf);
           
            if (tryMaster.isMasterRunning()) {
              this.master = tryMaster;
              break;
            }
           
          } catch (IOException e) {
View Full Code Here

        tries++) {
         
          masterLocation = new HServerAddress(this.conf.get(MASTER_ADDRESS,
            DEFAULT_MASTER_ADDRESS));
          try {
            HMasterInterface tryMaster = (HMasterInterface)HbaseRPC.getProxy(
                HMasterInterface.class, HMasterInterface.versionID,
                masterLocation.getInetSocketAddress(), this.conf);
           
            if (tryMaster.isMasterRunning()) {
              this.master = tryMaster;
              break;
            }
           
          } catch (IOException e) {
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hbase.ipc.HMasterInterface

Copyright © 2018 www.massapicom. 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.