@Test public void testGetAllTablesWithQuotas() throws Exception { final Multimap<TableName, QuotaSettings> quotas = helper.createTablesWithSpaceQuotas(); Set<TableName> tablesWithQuotas = new HashSet<>(); Set<TableName> namespaceTablesWithQuotas = new HashSet<>(); // Partition the tables with quotas by table and ns quota helper.partitionTablesByQuotaTarget(quotas, tablesWithQuotas, namespaceTablesWithQuotas); TablesWithQuotas tables = chore.fetchAllTablesWithQuotasDefined(); assertEquals("Found tables: " + tables, tablesWithQuotas, tables.getTableQuotaTables()); assertEquals("Found tables: " + tables, namespaceTablesWithQuotas, tables.getNamespaceQuotaTables()); }
@Test public void testRpcQuotaTablesAreFiltered() throws Exception { final Multimap<TableName, QuotaSettings> quotas = helper.createTablesWithSpaceQuotas(); Set<TableName> tablesWithQuotas = new HashSet<>(); Set<TableName> namespaceTablesWithQuotas = new HashSet<>(); // Partition the tables with quotas by table and ns quota helper.partitionTablesByQuotaTarget(quotas, tablesWithQuotas, namespaceTablesWithQuotas); TableName rpcQuotaTable = helper.createTable(); TEST_UTIL.getAdmin().setQuota(QuotaSettingsFactory .throttleTable(rpcQuotaTable, ThrottleType.READ_NUMBER, 6, TimeUnit.MINUTES)); // The `rpcQuotaTable` should not be included in this Set TablesWithQuotas tables = chore.fetchAllTablesWithQuotasDefined(); assertEquals("Found tables: " + tables, tablesWithQuotas, tables.getTableQuotaTables()); assertEquals("Found tables: " + tables, namespaceTablesWithQuotas, tables.getNamespaceQuotaTables()); }
@Test public void testGetAllTablesWithQuotas() throws Exception { final Multimap<TableName, QuotaSettings> quotas = helper.createTablesWithSpaceQuotas(); Set<TableName> tablesWithQuotas = new HashSet<>(); Set<TableName> namespaceTablesWithQuotas = new HashSet<>(); // Partition the tables with quotas by table and ns quota helper.partitionTablesByQuotaTarget(quotas, tablesWithQuotas, namespaceTablesWithQuotas); TablesWithQuotas tables = chore.fetchAllTablesWithQuotasDefined(); assertEquals("Found tables: " + tables, tablesWithQuotas, tables.getTableQuotaTables()); assertEquals("Found tables: " + tables, namespaceTablesWithQuotas, tables.getNamespaceQuotaTables()); }
@Test public void testRpcQuotaTablesAreFiltered() throws Exception { final Multimap<TableName, QuotaSettings> quotas = helper.createTablesWithSpaceQuotas(); Set<TableName> tablesWithQuotas = new HashSet<>(); Set<TableName> namespaceTablesWithQuotas = new HashSet<>(); // Partition the tables with quotas by table and ns quota helper.partitionTablesByQuotaTarget(quotas, tablesWithQuotas, namespaceTablesWithQuotas); TableName rpcQuotaTable = helper.createTable(); TEST_UTIL.getAdmin().setQuota(QuotaSettingsFactory .throttleTable(rpcQuotaTable, ThrottleType.READ_NUMBER, 6, TimeUnit.MINUTES)); // The `rpcQuotaTable` should not be included in this Set TablesWithQuotas tables = chore.fetchAllTablesWithQuotasDefined(); assertEquals("Found tables: " + tables, tablesWithQuotas, tables.getTableQuotaTables()); assertEquals("Found tables: " + tables, namespaceTablesWithQuotas, tables.getNamespaceQuotaTables()); }