@Test
  public void testUserQuotaUtil() throws Exception {
    final TableName tableName = TableName.valueOf(name.getMethodName());
    final String namespace = "testNS";
    final String user = "testUser";

    Quotas quotaNamespace = Quotas.newBuilder()
      .setThrottle(Throttle.newBuilder()
        .setReqNum(ProtobufUtil.toTimedQuota(50000, TimeUnit.SECONDS, QuotaScope.MACHINE)).build())
      .build();
    Quotas quotaTable = Quotas.newBuilder().setThrottle(Throttle.newBuilder()
      .setReqNum(ProtobufUtil.toTimedQuota(1000, TimeUnit.SECONDS, QuotaScope.MACHINE))
      .setWriteNum(ProtobufUtil.toTimedQuota(600, TimeUnit.SECONDS, QuotaScope.MACHINE))
      .setReadSize(ProtobufUtil.toTimedQuota(10000, TimeUnit.SECONDS, QuotaScope.MACHINE)).build())
      .build();
    Quotas quota = Quotas.newBuilder()
      .setThrottle(Throttle.newBuilder()
        .setReqSize(ProtobufUtil.toTimedQuota(8192, TimeUnit.SECONDS, QuotaScope.MACHINE))
        .setWriteSize(ProtobufUtil.toTimedQuota(4096, TimeUnit.SECONDS, QuotaScope.MACHINE))
        .setReadNum(ProtobufUtil.toTimedQuota(1000, TimeUnit.SECONDS, QuotaScope.MACHINE)).build())
      .build();

    // Add user global quota
    QuotaUtil.addUserQuota(this.connection, user, quota);
    Quotas resQuota = QuotaUtil.getUserQuota(this.connection, user);
    assertEquals(quota, resQuota);

    // Add user quota for table
    QuotaUtil.addUserQuota(this.connection, user, tableName, quotaTable);
    Quotas resQuotaTable = QuotaUtil.getUserQuota(this.connection, user, tableName);
    assertEquals(quotaTable, resQuotaTable);

    // Add user quota for namespace
    QuotaUtil.addUserQuota(this.connection, user, namespace, quotaNamespace);
    Quotas resQuotaNS = QuotaUtil.getUserQuota(this.connection, user, namespace);
    assertEquals(quotaNamespace, resQuotaNS);

    // Delete user global quota
    QuotaUtil.deleteUserQuota(this.connection, user);
    resQuota = QuotaUtil.getUserQuota(this.connection, user);
    assertEquals(null, resQuota);

    // Delete user quota for table
    QuotaUtil.deleteUserQuota(this.connection, user, tableName);
    resQuotaTable = QuotaUtil.getUserQuota(this.connection, user, tableName);
    assertEquals(null, resQuotaTable);

    // Delete user quota for namespace
    QuotaUtil.deleteUserQuota(this.connection, user, namespace);
    resQuotaNS = QuotaUtil.getUserQuota(this.connection, user, namespace);
    assertEquals(null, resQuotaNS);
  }
Test the quota table helpers (e.g. CRUD operations)
hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/TestQuotaTableUtil.java