Java 类org.apache.hadoop.hbase.client.HConnectionManager.HConnectionKey 实例源码

项目:LCIndex-HBase-0.94.16    文件:TestHCM.java   
@Test
public void abortingHConnectionRemovesItselfFromHCM() throws Exception {
  // Save off current HConnections
  Map<HConnectionKey, HConnectionImplementation> oldHBaseInstances = 
      new HashMap<HConnectionKey, HConnectionImplementation>();
  oldHBaseInstances.putAll(HConnectionManager.HBASE_INSTANCES);

  HConnectionManager.HBASE_INSTANCES.clear();

  try {
    HConnection connection = HConnectionManager.getConnection(TEST_UTIL.getConfiguration());
    connection.abort("test abortingHConnectionRemovesItselfFromHCM", new Exception(
        "test abortingHConnectionRemovesItselfFromHCM"));
    Assert.assertNotSame(connection,
      HConnectionManager.getConnection(TEST_UTIL.getConfiguration()));
  } finally {
    // Put original HConnections back
    HConnectionManager.HBASE_INSTANCES.clear();
    HConnectionManager.HBASE_INSTANCES.putAll(oldHBaseInstances);
  }
}
项目:IRIndex    文件:TestHCM.java   
@Test
public void abortingHConnectionRemovesItselfFromHCM() throws Exception {
  // Save off current HConnections
  Map<HConnectionKey, HConnectionImplementation> oldHBaseInstances = 
      new HashMap<HConnectionKey, HConnectionImplementation>();
  oldHBaseInstances.putAll(HConnectionManager.HBASE_INSTANCES);

  HConnectionManager.HBASE_INSTANCES.clear();

  try {
    HConnection connection = HConnectionManager.getConnection(TEST_UTIL.getConfiguration());
    connection.abort("test abortingHConnectionRemovesItselfFromHCM", new Exception(
        "test abortingHConnectionRemovesItselfFromHCM"));
    Assert.assertNotSame(connection,
      HConnectionManager.getConnection(TEST_UTIL.getConfiguration()));
  } finally {
    // Put original HConnections back
    HConnectionManager.HBASE_INSTANCES.clear();
    HConnectionManager.HBASE_INSTANCES.putAll(oldHBaseInstances);
  }
}
项目:HBase-Research    文件:TestHCM.java   
@Test
public void abortingHConnectionRemovesItselfFromHCM() throws Exception {
  // Save off current HConnections
  Map<HConnectionKey, HConnectionImplementation> oldHBaseInstances = 
      new HashMap<HConnectionKey, HConnectionImplementation>();
  oldHBaseInstances.putAll(HConnectionManager.HBASE_INSTANCES);

  HConnectionManager.HBASE_INSTANCES.clear();

  try {
    HConnection connection = HConnectionManager.getConnection(TEST_UTIL.getConfiguration());
    connection.abort("test abortingHConnectionRemovesItselfFromHCM", new Exception(
        "test abortingHConnectionRemovesItselfFromHCM"));
    Assert.assertNotSame(connection,
      HConnectionManager.getConnection(TEST_UTIL.getConfiguration()));
  } finally {
    // Put original HConnections back
    HConnectionManager.HBASE_INSTANCES.clear();
    HConnectionManager.HBASE_INSTANCES.putAll(oldHBaseInstances);
  }
}
项目:hbase-0.94.8-qod    文件:TestHCM.java   
@Test
public void abortingHConnectionRemovesItselfFromHCM() throws Exception {
  // Save off current HConnections
  Map<HConnectionKey, HConnectionImplementation> oldHBaseInstances = 
      new HashMap<HConnectionKey, HConnectionImplementation>();
  oldHBaseInstances.putAll(HConnectionManager.HBASE_INSTANCES);

  HConnectionManager.HBASE_INSTANCES.clear();

  try {
    HConnection connection = HConnectionManager.getConnection(TEST_UTIL.getConfiguration());
    connection.abort("test abortingHConnectionRemovesItselfFromHCM", new Exception(
        "test abortingHConnectionRemovesItselfFromHCM"));
    Assert.assertNotSame(connection,
      HConnectionManager.getConnection(TEST_UTIL.getConfiguration()));
  } finally {
    // Put original HConnections back
    HConnectionManager.HBASE_INSTANCES.clear();
    HConnectionManager.HBASE_INSTANCES.putAll(oldHBaseInstances);
  }
}
项目:hbase-0.94.8-qod    文件:TestHCM.java   
@Test
public void abortingHConnectionRemovesItselfFromHCM() throws Exception {
  // Save off current HConnections
  Map<HConnectionKey, HConnectionImplementation> oldHBaseInstances = 
      new HashMap<HConnectionKey, HConnectionImplementation>();
  oldHBaseInstances.putAll(HConnectionManager.HBASE_INSTANCES);

  HConnectionManager.HBASE_INSTANCES.clear();

  try {
    HConnection connection = HConnectionManager.getConnection(TEST_UTIL.getConfiguration());
    connection.abort("test abortingHConnectionRemovesItselfFromHCM", new Exception(
        "test abortingHConnectionRemovesItselfFromHCM"));
    Assert.assertNotSame(connection,
      HConnectionManager.getConnection(TEST_UTIL.getConfiguration()));
  } finally {
    // Put original HConnections back
    HConnectionManager.HBASE_INSTANCES.clear();
    HConnectionManager.HBASE_INSTANCES.putAll(oldHBaseInstances);
  }
}
项目:DominoHBase    文件:TestHCM.java   
@Test
public void abortingHConnectionRemovesItselfFromHCM() throws Exception {
  // Save off current HConnections
  Map<HConnectionKey, HConnectionImplementation> oldHBaseInstances = 
      new HashMap<HConnectionKey, HConnectionImplementation>();
  oldHBaseInstances.putAll(HConnectionManager.HBASE_INSTANCES);

  HConnectionManager.HBASE_INSTANCES.clear();

  try {
    HConnection connection = HConnectionManager.getConnection(TEST_UTIL.getConfiguration());
    connection.abort("test abortingHConnectionRemovesItselfFromHCM", new Exception(
        "test abortingHConnectionRemovesItselfFromHCM"));
    Assert.assertNotSame(connection,
      HConnectionManager.getConnection(TEST_UTIL.getConfiguration()));
  } finally {
    // Put original HConnections back
    HConnectionManager.HBASE_INSTANCES.clear();
    HConnectionManager.HBASE_INSTANCES.putAll(oldHBaseInstances);
  }
}
项目:hindex    文件:TestHCM.java   
@Test
public void abortingHConnectionRemovesItselfFromHCM() throws Exception {
  // Save off current HConnections
  Map<HConnectionKey, HConnectionImplementation> oldHBaseInstances = 
      new HashMap<HConnectionKey, HConnectionImplementation>();
  oldHBaseInstances.putAll(HConnectionManager.HBASE_INSTANCES);

  HConnectionManager.HBASE_INSTANCES.clear();

  try {
    HConnection connection = HConnectionManager.getConnection(TEST_UTIL.getConfiguration());
    connection.abort("test abortingHConnectionRemovesItselfFromHCM", new Exception(
        "test abortingHConnectionRemovesItselfFromHCM"));
    Assert.assertNotSame(connection,
      HConnectionManager.getConnection(TEST_UTIL.getConfiguration()));
  } finally {
    // Put original HConnections back
    HConnectionManager.HBASE_INSTANCES.clear();
    HConnectionManager.HBASE_INSTANCES.putAll(oldHBaseInstances);
  }
}
项目:LCIndex-HBase-0.94.16    文件:HConnectionTestingUtility.java   
/**
 * Get a Mocked {@link HConnection} that goes with the passed <code>conf</code>
 * configuration instance.  Minimally the mock will return
 * <code>conf</conf> when {@link HConnection#getConfiguration()} is invoked.
 * Be sure to shutdown the connection when done by calling
 * {@link HConnectionManager#deleteConnection(Configuration, boolean)} else it
 * will stick around; this is probably not what you want.
 * @param conf configuration
 * @return HConnection object for <code>conf</code>
 * @throws ZooKeeperConnectionException
 */
public static HConnection getMockedConnection(final Configuration conf)
throws ZooKeeperConnectionException {
  HConnectionKey connectionKey = new HConnectionKey(conf);
  synchronized (HConnectionManager.HBASE_INSTANCES) {
    HConnectionImplementation connection =
      HConnectionManager.HBASE_INSTANCES.get(connectionKey);
    if (connection == null) {
      connection = Mockito.mock(HConnectionImplementation.class);
      Mockito.when(connection.getConfiguration()).thenReturn(conf);
      HConnectionManager.HBASE_INSTANCES.put(connectionKey, connection);
    }
    return connection;
  }
}
项目:LCIndex-HBase-0.94.16    文件:HConnectionTestingUtility.java   
/**
 * Get a Mockito spied-upon {@link HConnection} that goes with the passed
 * <code>conf</code> configuration instance.
 * Be sure to shutdown the connection when done by calling
 * {@link HConnectionManager#deleteConnection(Configuration, boolean)} else it
 * will stick around; this is probably not what you want.
 * @param conf configuration
 * @return HConnection object for <code>conf</code>
 * @throws ZooKeeperConnectionException
 * @see http://mockito.googlecode.com/svn/branches/1.6/javadoc/org/mockito/Mockito.html#spy(T)
 */
public static HConnection getSpiedConnection(final Configuration conf)
throws ZooKeeperConnectionException {
  HConnectionKey connectionKey = new HConnectionKey(conf);
  synchronized (HConnectionManager.HBASE_INSTANCES) {
    HConnectionImplementation connection =
      HConnectionManager.HBASE_INSTANCES.get(connectionKey);
    if (connection == null) {
      connection = Mockito.spy(new HConnectionImplementation(conf, true, null));
      HConnectionManager.HBASE_INSTANCES.put(connectionKey, connection);
    }
    return connection;
  }
}
项目:IRIndex    文件:HConnectionTestingUtility.java   
/**
 * Get a Mocked {@link HConnection} that goes with the passed <code>conf</code>
 * configuration instance.  Minimally the mock will return
 * <code>conf</conf> when {@link HConnection#getConfiguration()} is invoked.
 * Be sure to shutdown the connection when done by calling
 * {@link HConnectionManager#deleteConnection(Configuration, boolean)} else it
 * will stick around; this is probably not what you want.
 * @param conf configuration
 * @return HConnection object for <code>conf</code>
 * @throws ZooKeeperConnectionException
 */
public static HConnection getMockedConnection(final Configuration conf)
throws ZooKeeperConnectionException {
  HConnectionKey connectionKey = new HConnectionKey(conf);
  synchronized (HConnectionManager.HBASE_INSTANCES) {
    HConnectionImplementation connection =
      HConnectionManager.HBASE_INSTANCES.get(connectionKey);
    if (connection == null) {
      connection = Mockito.mock(HConnectionImplementation.class);
      Mockito.when(connection.getConfiguration()).thenReturn(conf);
      HConnectionManager.HBASE_INSTANCES.put(connectionKey, connection);
    }
    return connection;
  }
}
项目:IRIndex    文件:HConnectionTestingUtility.java   
/**
 * Get a Mockito spied-upon {@link HConnection} that goes with the passed
 * <code>conf</code> configuration instance.
 * Be sure to shutdown the connection when done by calling
 * {@link HConnectionManager#deleteConnection(Configuration, boolean)} else it
 * will stick around; this is probably not what you want.
 * @param conf configuration
 * @return HConnection object for <code>conf</code>
 * @throws ZooKeeperConnectionException
 * @see http://mockito.googlecode.com/svn/branches/1.6/javadoc/org/mockito/Mockito.html#spy(T)
 */
public static HConnection getSpiedConnection(final Configuration conf)
throws ZooKeeperConnectionException {
  HConnectionKey connectionKey = new HConnectionKey(conf);
  synchronized (HConnectionManager.HBASE_INSTANCES) {
    HConnectionImplementation connection =
      HConnectionManager.HBASE_INSTANCES.get(connectionKey);
    if (connection == null) {
      connection = Mockito.spy(new HConnectionImplementation(conf, true, null));
      HConnectionManager.HBASE_INSTANCES.put(connectionKey, connection);
    }
    return connection;
  }
}
项目:HBase-Research    文件:HConnectionTestingUtility.java   
/**
 * Get a Mocked {@link HConnection} that goes with the passed <code>conf</code>
 * configuration instance.  Minimally the mock will return
 * <code>conf</conf> when {@link HConnection#getConfiguration()} is invoked.
 * Be sure to shutdown the connection when done by calling
 * {@link HConnectionManager#deleteConnection(Configuration, boolean)} else it
 * will stick around; this is probably not what you want.
 * @param conf configuration
 * @return HConnection object for <code>conf</code>
 * @throws ZooKeeperConnectionException
 */
public static HConnection getMockedConnection(final Configuration conf)
throws ZooKeeperConnectionException {
  HConnectionKey connectionKey = new HConnectionKey(conf);
  synchronized (HConnectionManager.HBASE_INSTANCES) {
    HConnectionImplementation connection =
      HConnectionManager.HBASE_INSTANCES.get(connectionKey);
    if (connection == null) {
      connection = Mockito.mock(HConnectionImplementation.class);
      Mockito.when(connection.getConfiguration()).thenReturn(conf);
      HConnectionManager.HBASE_INSTANCES.put(connectionKey, connection);
    }
    return connection;
  }
}
项目:HBase-Research    文件:HConnectionTestingUtility.java   
/**
 * Get a Mockito spied-upon {@link HConnection} that goes with the passed
 * <code>conf</code> configuration instance.
 * Be sure to shutdown the connection when done by calling
 * {@link HConnectionManager#deleteConnection(Configuration, boolean)} else it
 * will stick around; this is probably not what you want.
 * @param conf configuration
 * @return HConnection object for <code>conf</code>
 * @throws ZooKeeperConnectionException
 * @see http://mockito.googlecode.com/svn/branches/1.6/javadoc/org/mockito/Mockito.html#spy(T)
 */
public static HConnection getSpiedConnection(final Configuration conf)
throws ZooKeeperConnectionException {
  HConnectionKey connectionKey = new HConnectionKey(conf);
  synchronized (HConnectionManager.HBASE_INSTANCES) {
    HConnectionImplementation connection =
      HConnectionManager.HBASE_INSTANCES.get(connectionKey);
    if (connection == null) {
      connection = Mockito.spy(new HConnectionImplementation(conf, true));
      HConnectionManager.HBASE_INSTANCES.put(connectionKey, connection);
    }
    return connection;
  }
}
项目:hbase-0.94.8-qod    文件:HConnectionTestingUtility.java   
/**
 * Get a Mocked {@link HConnection} that goes with the passed <code>conf</code>
 * configuration instance.  Minimally the mock will return
 * <code>conf</conf> when {@link HConnection#getConfiguration()} is invoked.
 * Be sure to shutdown the connection when done by calling
 * {@link HConnectionManager#deleteConnection(Configuration, boolean)} else it
 * will stick around; this is probably not what you want.
 * @param conf configuration
 * @return HConnection object for <code>conf</code>
 * @throws ZooKeeperConnectionException
 */
public static HConnection getMockedConnection(final Configuration conf)
throws ZooKeeperConnectionException {
  HConnectionKey connectionKey = new HConnectionKey(conf);
  synchronized (HConnectionManager.HBASE_INSTANCES) {
    HConnectionImplementation connection =
      HConnectionManager.HBASE_INSTANCES.get(connectionKey);
    if (connection == null) {
      connection = Mockito.mock(HConnectionImplementation.class);
      Mockito.when(connection.getConfiguration()).thenReturn(conf);
      HConnectionManager.HBASE_INSTANCES.put(connectionKey, connection);
    }
    return connection;
  }
}
项目:hbase-0.94.8-qod    文件:HConnectionTestingUtility.java   
/**
 * Get a Mockito spied-upon {@link HConnection} that goes with the passed
 * <code>conf</code> configuration instance.
 * Be sure to shutdown the connection when done by calling
 * {@link HConnectionManager#deleteConnection(Configuration, boolean)} else it
 * will stick around; this is probably not what you want.
 * @param conf configuration
 * @return HConnection object for <code>conf</code>
 * @throws ZooKeeperConnectionException
 * @see http://mockito.googlecode.com/svn/branches/1.6/javadoc/org/mockito/Mockito.html#spy(T)
 */
public static HConnection getSpiedConnection(final Configuration conf)
throws ZooKeeperConnectionException {
  HConnectionKey connectionKey = new HConnectionKey(conf);
  synchronized (HConnectionManager.HBASE_INSTANCES) {
    HConnectionImplementation connection =
      HConnectionManager.HBASE_INSTANCES.get(connectionKey);
    if (connection == null) {
      connection = Mockito.spy(new HConnectionImplementation(conf, true));
      HConnectionManager.HBASE_INSTANCES.put(connectionKey, connection);
    }
    return connection;
  }
}
项目:hbase-0.94.8-qod    文件:HConnectionTestingUtility.java   
/**
 * Get a Mocked {@link HConnection} that goes with the passed <code>conf</code>
 * configuration instance.  Minimally the mock will return
 * <code>conf</conf> when {@link HConnection#getConfiguration()} is invoked.
 * Be sure to shutdown the connection when done by calling
 * {@link HConnectionManager#deleteConnection(Configuration, boolean)} else it
 * will stick around; this is probably not what you want.
 * @param conf configuration
 * @return HConnection object for <code>conf</code>
 * @throws ZooKeeperConnectionException
 */
public static HConnection getMockedConnection(final Configuration conf)
throws ZooKeeperConnectionException {
  HConnectionKey connectionKey = new HConnectionKey(conf);
  synchronized (HConnectionManager.HBASE_INSTANCES) {
    HConnectionImplementation connection =
      HConnectionManager.HBASE_INSTANCES.get(connectionKey);
    if (connection == null) {
      connection = Mockito.mock(HConnectionImplementation.class);
      Mockito.when(connection.getConfiguration()).thenReturn(conf);
      HConnectionManager.HBASE_INSTANCES.put(connectionKey, connection);
    }
    return connection;
  }
}
项目:hbase-0.94.8-qod    文件:HConnectionTestingUtility.java   
/**
 * Get a Mockito spied-upon {@link HConnection} that goes with the passed
 * <code>conf</code> configuration instance.
 * Be sure to shutdown the connection when done by calling
 * {@link HConnectionManager#deleteConnection(Configuration, boolean)} else it
 * will stick around; this is probably not what you want.
 * @param conf configuration
 * @return HConnection object for <code>conf</code>
 * @throws ZooKeeperConnectionException
 * @see http://mockito.googlecode.com/svn/branches/1.6/javadoc/org/mockito/Mockito.html#spy(T)
 */
public static HConnection getSpiedConnection(final Configuration conf)
throws ZooKeeperConnectionException {
  HConnectionKey connectionKey = new HConnectionKey(conf);
  synchronized (HConnectionManager.HBASE_INSTANCES) {
    HConnectionImplementation connection =
      HConnectionManager.HBASE_INSTANCES.get(connectionKey);
    if (connection == null) {
      connection = Mockito.spy(new HConnectionImplementation(conf, true));
      HConnectionManager.HBASE_INSTANCES.put(connectionKey, connection);
    }
    return connection;
  }
}
项目:DominoHBase    文件:HConnectionTestingUtility.java   
/**
 * Get a Mocked {@link HConnection} that goes with the passed <code>conf</code>
 * configuration instance.  Minimally the mock will return
 * <code>conf</conf> when {@link HConnection#getConfiguration()} is invoked.
 * Be sure to shutdown the connection when done by calling
 * {@link HConnectionManager#deleteConnection(Configuration, boolean)} else it
 * will stick around; this is probably not what you want.
 * @param conf configuration
 * @return HConnection object for <code>conf</code>
 * @throws ZooKeeperConnectionException
 */
public static HConnection getMockedConnection(final Configuration conf)
throws ZooKeeperConnectionException {
  HConnectionKey connectionKey = new HConnectionKey(conf);
  synchronized (HConnectionManager.HBASE_INSTANCES) {
    HConnectionImplementation connection =
      HConnectionManager.HBASE_INSTANCES.get(connectionKey);
    if (connection == null) {
      connection = Mockito.mock(HConnectionImplementation.class);
      Mockito.when(connection.getConfiguration()).thenReturn(conf);
      HConnectionManager.HBASE_INSTANCES.put(connectionKey, connection);
    }
    return connection;
  }
}
项目:DominoHBase    文件:HConnectionTestingUtility.java   
/**
 * Get a Mockito spied-upon {@link HConnection} that goes with the passed
 * <code>conf</code> configuration instance.
 * Be sure to shutdown the connection when done by calling
 * {@link HConnectionManager#deleteConnection(Configuration, boolean)} else it
 * will stick around; this is probably not what you want.
 * @param conf configuration
 * @return HConnection object for <code>conf</code>
 * @throws ZooKeeperConnectionException
 * @see http://mockito.googlecode.com/svn/branches/1.6/javadoc/org/mockito/Mockito.html#spy(T)
 */
public static HConnection getSpiedConnection(final Configuration conf)
throws ZooKeeperConnectionException {
  HConnectionKey connectionKey = new HConnectionKey(conf);
  synchronized (HConnectionManager.HBASE_INSTANCES) {
    HConnectionImplementation connection =
      HConnectionManager.HBASE_INSTANCES.get(connectionKey);
    if (connection == null) {
      connection = Mockito.spy(new HConnectionImplementation(conf, true));
      HConnectionManager.HBASE_INSTANCES.put(connectionKey, connection);
    }
    return connection;
  }
}
项目:hindex    文件:HConnectionTestingUtility.java   
/**
 * Get a Mocked {@link HConnection} that goes with the passed <code>conf</code>
 * configuration instance.  Minimally the mock will return
 * <code>conf</conf> when {@link HConnection#getConfiguration()} is invoked.
 * Be sure to shutdown the connection when done by calling
 * {@link HConnectionManager#deleteConnection(Configuration, boolean)} else it
 * will stick around; this is probably not what you want.
 * @param conf configuration
 * @return HConnection object for <code>conf</code>
 * @throws ZooKeeperConnectionException
 */
public static HConnection getMockedConnection(final Configuration conf)
throws ZooKeeperConnectionException {
  HConnectionKey connectionKey = new HConnectionKey(conf);
  synchronized (HConnectionManager.HBASE_INSTANCES) {
    HConnectionImplementation connection =
      HConnectionManager.HBASE_INSTANCES.get(connectionKey);
    if (connection == null) {
      connection = Mockito.mock(HConnectionImplementation.class);
      Mockito.when(connection.getConfiguration()).thenReturn(conf);
      HConnectionManager.HBASE_INSTANCES.put(connectionKey, connection);
    }
    return connection;
  }
}
项目:hindex    文件:HConnectionTestingUtility.java   
/**
 * Get a Mockito spied-upon {@link HConnection} that goes with the passed
 * <code>conf</code> configuration instance.
 * Be sure to shutdown the connection when done by calling
 * {@link HConnectionManager#deleteConnection(Configuration, boolean)} else it
 * will stick around; this is probably not what you want.
 * @param conf configuration
 * @return HConnection object for <code>conf</code>
 * @throws ZooKeeperConnectionException
 * @see http://mockito.googlecode.com/svn/branches/1.6/javadoc/org/mockito/Mockito.html#spy(T)
 */
public static HConnection getSpiedConnection(final Configuration conf)
throws ZooKeeperConnectionException {
  HConnectionKey connectionKey = new HConnectionKey(conf);
  synchronized (HConnectionManager.HBASE_INSTANCES) {
    HConnectionImplementation connection =
      HConnectionManager.HBASE_INSTANCES.get(connectionKey);
    if (connection == null) {
      connection = Mockito.spy(new HConnectionImplementation(conf, true));
      HConnectionManager.HBASE_INSTANCES.put(connectionKey, connection);
    }
    return connection;
  }
}