### Question:
FileResourceGroupConfigurationManager extends AbstractResourceConfigurationManager { @Override public void configure(ResourceGroup group, SelectionContext<ResourceGroupIdTemplate> context) { configureGroup(group, getMatchingSpec(group, context)); } @Inject  FileResourceGroupConfigurationManager(ClusterMemoryPoolManager memoryPoolManager, FileResourceGroupConfig config); @VisibleForTesting  FileResourceGroupConfigurationManager(ClusterMemoryPoolManager memoryPoolManager, ManagerSpec managerSpec); @Override void configure(ResourceGroup group, SelectionContext<ResourceGroupIdTemplate> context); @Override Optional<SelectionContext<ResourceGroupIdTemplate>> match(SelectionCriteria criteria);  }### Answer:
@Test public void testConfiguration() { FileResourceGroupConfigurationManager manager = parse("resource_groups_config.json"); ResourceGroupId globalId = new ResourceGroupId("global"); ResourceGroup global = new TestingResourceGroup(globalId); manager.configure(global, new SelectionContext<>(globalId, new ResourceGroupIdTemplate("global"))); assertEquals(global.getSoftMemoryLimitBytes(), DataSize.of(1, MEGABYTE).toBytes()); assertEquals(global.getSoftCpuLimit(), Duration.ofHours(1)); assertEquals(global.getHardCpuLimit(), Duration.ofDays(1)); assertEquals(global.getCpuQuotaGenerationMillisPerSecond(), 1000 * 24); assertEquals(global.getMaxQueuedQueries(), 1000); assertEquals(global.getHardConcurrencyLimit(), 100); assertEquals(global.getSchedulingPolicy(), WEIGHTED); assertEquals(global.getSchedulingWeight(), 0); assertTrue(global.getJmxExport()); ResourceGroupId subId = new ResourceGroupId(globalId, "sub"); ResourceGroup sub = new TestingResourceGroup(subId); manager.configure(sub, new SelectionContext<>(subId, new ResourceGroupIdTemplate("global.sub"))); assertEquals(sub.getSoftMemoryLimitBytes(), DataSize.of(2, MEGABYTE).toBytes()); assertEquals(sub.getHardConcurrencyLimit(), 3); assertEquals(sub.getMaxQueuedQueries(), 4); assertNull(sub.getSchedulingPolicy()); assertEquals(sub.getSchedulingWeight(), 5); assertFalse(sub.getJmxExport()); }
@Test public void testLegacyConfiguration() { FileResourceGroupConfigurationManager manager = parse("resource_groups_config_legacy.json"); ResourceGroupId globalId = new ResourceGroupId("global"); ResourceGroup global = new TestingResourceGroup(globalId); manager.configure(global, new SelectionContext<>(globalId, new ResourceGroupIdTemplate("global"))); assertEquals(global.getSoftMemoryLimitBytes(), DataSize.of(3, MEGABYTE).toBytes()); assertEquals(global.getMaxQueuedQueries(), 99); assertEquals(global.getHardConcurrencyLimit(), 42); }