use of bio.terra.buffer.generated.model.PoolConfigs in project terra-resource-buffer by DataBiosphere.
the class PoolConfigLoaderTest method combineParsedResult_resourceConfigNotFound.
@Test
public void combineParsedResult_resourceConfigNotFound() {
String resourceConfigName = "configName";
PoolConfig poolConfig = new PoolConfig().poolId("id").resourceConfigName("badName");
PoolConfigs pools = new PoolConfigs().poolConfigs(ImmutableList.of(poolConfig, poolConfig));
ResourceConfig resourceConfig = new ResourceConfig().configName(resourceConfigName);
assertThrows(BadPoolConfigException.class, () -> combineParsedConfig(pools, ImmutableMap.of(resourceConfigName, resourceConfig)));
}
use of bio.terra.buffer.generated.model.PoolConfigs in project terra-resource-buffer by DataBiosphere.
the class PoolConfigLoader method loadPoolConfig.
/**
* Parse and validate {@link PoolConfig} and {@link ResourceConfig} from file.
*/
@VisibleForTesting
public static List<PoolWithResourceConfig> loadPoolConfig(String folderName, Optional<String> systemFilePath) {
PoolConfigs poolConfigs;
Map<String, ResourceConfig> resourceConfigNameMap;
if (systemFilePath.isPresent()) {
poolConfigs = parsePoolsAsSystemFile(systemFilePath.get());
resourceConfigNameMap = parseResourceConfigAsSystemFile(systemFilePath.get());
} else {
// TODO (PF-1273): clean up once all environments are switched to using system file path.
poolConfigs = parsePools(folderName);
resourceConfigNameMap = parseResourceConfig(folderName);
}
validateResourceConfig(new ArrayList<>(resourceConfigNameMap.values()));
return combineParsedConfig(poolConfigs, resourceConfigNameMap);
}
use of bio.terra.buffer.generated.model.PoolConfigs in project terra-resource-buffer by DataBiosphere.
the class PoolConfigLoaderTest method combineParsedResult.
@Test
public void combineParsedResult() {
String resourceConfigName = "configName";
PoolConfig poolConfig = new PoolConfig().poolId("id").resourceConfigName(resourceConfigName);
PoolConfigs pools = new PoolConfigs().poolConfigs(ImmutableList.of(poolConfig));
ResourceConfig resourceConfig = new ResourceConfig().configName(resourceConfigName);
PoolWithResourceConfig expected = PoolWithResourceConfig.create(poolConfig, resourceConfig);
assertThat(combineParsedConfig(pools, ImmutableMap.of(resourceConfigName, resourceConfig)), Matchers.contains(expected));
}
use of bio.terra.buffer.generated.model.PoolConfigs in project terra-resource-buffer by DataBiosphere.
the class PoolConfigLoaderTest method combineParsedResult_duplicatePoolId.
@Test
public void combineParsedResult_duplicatePoolId() {
String resourceConfigName = "configName";
PoolConfig poolConfig = new PoolConfig().poolId("id").resourceConfigName(resourceConfigName);
PoolConfigs pools = new PoolConfigs().poolConfigs(ImmutableList.of(poolConfig, poolConfig));
ResourceConfig resourceConfig = new ResourceConfig().configName(resourceConfigName);
assertThrows(BadPoolConfigException.class, () -> combineParsedConfig(pools, ImmutableMap.of(resourceConfigName, resourceConfig)));
}
Aggregations