use of com.facebook.presto.resourceGroups.db.DbSourceExactMatchSelector in project presto by prestodb.
the class TestReloadingResourceGroupConfigurationManager method testExactMatchSelector.
@Test
public void testExactMatchSelector() {
H2DaoProvider daoProvider = setup("test_exact_match_selector");
H2ResourceGroupsDao dao = daoProvider.get();
dao.createResourceGroupsGlobalPropertiesTable();
dao.createResourceGroupsTable();
dao.createSelectorsTable();
dao.createExactMatchSelectorsTable();
dao.insertResourceGroup(1, "global", "1MB", 1000, 100, 100, "weighted", null, true, "1h", "1d", null, null, null, null, ENVIRONMENT);
dao.insertResourceGroup(2, "sub", "2MB", 4, 3, 3, null, 5, null, null, null, null, null, null, 1L, ENVIRONMENT);
dao.insertSelector(2, 1, null, null, null, null, null);
dao.insertResourceGroupsGlobalProperties("cpu_quota_period", "1h");
ReloadingResourceGroupConfig config = new ReloadingResourceGroupConfig();
config.setExactMatchSelectorEnabled(true);
DbManagerSpecProvider dbManagerSpecProvider = new DbManagerSpecProvider(daoProvider.get(), ENVIRONMENT, config);
ReloadingResourceGroupConfigurationManager manager = new ReloadingResourceGroupConfigurationManager((poolId, listener) -> {
}, config, dbManagerSpecProvider);
manager.load();
assertEquals(manager.getSelectors().size(), 2);
assertTrue(manager.getSelectors().get(0) instanceof DbSourceExactMatchSelector);
config.setExactMatchSelectorEnabled(false);
manager = new ReloadingResourceGroupConfigurationManager((poolId, listener) -> {
}, config, dbManagerSpecProvider);
manager.load();
assertEquals(manager.getSelectors().size(), 1);
assertFalse(manager.getSelectors().get(0) instanceof DbSourceExactMatchSelector);
}
Aggregations