當前位置: 首頁>>代碼示例>>Java>>正文


Java Admin.listNamespaceDescriptors方法代碼示例

本文整理匯總了Java中org.apache.hadoop.hbase.client.Admin.listNamespaceDescriptors方法的典型用法代碼示例。如果您正苦於以下問題:Java Admin.listNamespaceDescriptors方法的具體用法?Java Admin.listNamespaceDescriptors怎麽用?Java Admin.listNamespaceDescriptors使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.hadoop.hbase.client.Admin的用法示例。


在下文中一共展示了Admin.listNamespaceDescriptors方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: doesNamespaceExist

import org.apache.hadoop.hbase.client.Admin; //導入方法依賴的package包/類
private boolean doesNamespaceExist(Admin admin, String namespaceName) throws IOException{
  NamespaceDescriptor[] nd = admin.listNamespaceDescriptors();
  for(int i = 0; i < nd.length; i++){
    if(nd[i].getName().equals(namespaceName)){
      return true;
    }
  }
  return false;
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:10,代碼來源:NamespacesInstanceResource.java

示例2: NamespacesModel

import org.apache.hadoop.hbase.client.Admin; //導入方法依賴的package包/類
/**
 * Constructor
 * @param admin the administrative API
 * @throws IOException
 */
public NamespacesModel(Admin admin) throws IOException {
  NamespaceDescriptor[] nds = admin.listNamespaceDescriptors();
  namespaces = new ArrayList<String>();
  for (NamespaceDescriptor nd : nds) {
    namespaces.add(nd.getName());
  }
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:13,代碼來源:NamespacesModel.java

示例3: findNamespace

import org.apache.hadoop.hbase.client.Admin; //導入方法依賴的package包/類
private NamespaceDescriptor findNamespace(Admin admin, String namespaceName) throws IOException{
  NamespaceDescriptor[] nd = admin.listNamespaceDescriptors();
  for(int i = 0; i < nd.length; i++){
    if(nd[i].getName().equals(namespaceName)){
      return nd[i];
    }
  }
  return null;
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:10,代碼來源:TestNamespacesInstanceResource.java

示例4: doesNamespaceExist

import org.apache.hadoop.hbase.client.Admin; //導入方法依賴的package包/類
private boolean doesNamespaceExist(Admin admin, String namespaceName) throws IOException {
  NamespaceDescriptor[] nd = admin.listNamespaceDescriptors();
  for(int i = 0; i < nd.length; i++) {
    if(nd[i].getName().equals(namespaceName)) {
      return true;
    }
  }
  return false;
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:10,代碼來源:TestNamespacesResource.java

示例5: testNamespaceOperations

import org.apache.hadoop.hbase.client.Admin; //導入方法依賴的package包/類
@Test (timeout=180000)
public void testNamespaceOperations() throws Exception {
  MiniHBaseCluster cluster = UTIL.getHBaseCluster();
  String testNamespace = "observed_ns";
  HMaster master = cluster.getMaster();
  MasterCoprocessorHost host = master.getMasterCoprocessorHost();
  CPMasterObserver cp = (CPMasterObserver)host.findCoprocessor(
      CPMasterObserver.class.getName());

  cp.enableBypass(false);
  cp.resetStates();


  // create a table
  Admin admin = UTIL.getHBaseAdmin();
  admin.createNamespace(NamespaceDescriptor.create(testNamespace).build());
  assertTrue("Test namespace should be created", cp.wasCreateNamespaceCalled());

  assertNotNull(admin.getNamespaceDescriptor(testNamespace));
  assertTrue("Test namespace descriptor should have been called",
      cp.wasGetNamespaceDescriptorCalled());

  // turn off bypass, run the tests again
  cp.enableBypass(true);
  cp.resetStates();

  admin.modifyNamespace(NamespaceDescriptor.create(testNamespace).build());
  assertTrue("Test namespace should not have been modified",
      cp.preModifyNamespaceCalledOnly());

  assertNotNull(admin.getNamespaceDescriptor(testNamespace));
  assertTrue("Test namespace descriptor should have been called",
      cp.wasGetNamespaceDescriptorCalled());

  admin.deleteNamespace(testNamespace);
  assertTrue("Test namespace should not have been deleted", cp.preDeleteNamespaceCalledOnly());

  assertNotNull(admin.getNamespaceDescriptor(testNamespace));
  assertTrue("Test namespace descriptor should have been called",
      cp.wasGetNamespaceDescriptorCalled());

  cp.enableBypass(false);
  cp.resetStates();

  // delete table
  admin.modifyNamespace(NamespaceDescriptor.create(testNamespace).build());
  assertTrue("Test namespace should have been modified", cp.wasModifyNamespaceCalled());

  admin.deleteNamespace(testNamespace);
  assertTrue("Test namespace should have been deleted", cp.wasDeleteNamespaceCalled());

  cp.enableBypass(true);
  cp.resetStates();

  admin.createNamespace(NamespaceDescriptor.create(testNamespace).build());
  assertTrue("Test namespace should not be created", cp.preCreateNamespaceCalledOnly());

  // turn on bypass, run the test
  cp.enableBypass(true);
  cp.resetStates();

  admin.listNamespaceDescriptors();
  assertTrue("post listNamespace should not have been called",
             cp.preListNamespaceDescriptorsCalledOnly());

  // turn off bypass, run the tests again
  cp.enableBypass(false);
  cp.resetStates();

  admin.listNamespaceDescriptors();
  assertTrue("post listNamespace should have been called",
             cp.wasListNamespaceDescriptorsCalled());
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:74,代碼來源:TestMasterObserver.java


注:本文中的org.apache.hadoop.hbase.client.Admin.listNamespaceDescriptors方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。