Search in sources :

Example 1 with PoolConfigs

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)));
}
Also used : PoolConfigs(bio.terra.buffer.generated.model.PoolConfigs) PoolConfig(bio.terra.buffer.generated.model.PoolConfig) ResourceConfig(bio.terra.buffer.generated.model.ResourceConfig) Test(org.junit.jupiter.api.Test) BaseUnitTest(bio.terra.buffer.common.BaseUnitTest)

Example 2 with PoolConfigs

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);
}
Also used : PoolConfigs(bio.terra.buffer.generated.model.PoolConfigs) ResourceConfig(bio.terra.buffer.generated.model.ResourceConfig) VisibleForTesting(com.google.common.annotations.VisibleForTesting)

Example 3 with PoolConfigs

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));
}
Also used : PoolConfigs(bio.terra.buffer.generated.model.PoolConfigs) PoolConfig(bio.terra.buffer.generated.model.PoolConfig) ResourceConfig(bio.terra.buffer.generated.model.ResourceConfig) Test(org.junit.jupiter.api.Test) BaseUnitTest(bio.terra.buffer.common.BaseUnitTest)

Example 4 with PoolConfigs

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)));
}
Also used : PoolConfigs(bio.terra.buffer.generated.model.PoolConfigs) PoolConfig(bio.terra.buffer.generated.model.PoolConfig) ResourceConfig(bio.terra.buffer.generated.model.ResourceConfig) Test(org.junit.jupiter.api.Test) BaseUnitTest(bio.terra.buffer.common.BaseUnitTest)

Aggregations

PoolConfigs (bio.terra.buffer.generated.model.PoolConfigs)4 ResourceConfig (bio.terra.buffer.generated.model.ResourceConfig)4 BaseUnitTest (bio.terra.buffer.common.BaseUnitTest)3 PoolConfig (bio.terra.buffer.generated.model.PoolConfig)3 Test (org.junit.jupiter.api.Test)3 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1