use of org.apache.gobblin.config.store.api.ConfigKeyPath in project incubator-gobblin by apache.
the class SimpleHdfsConfigStoreTest method testGetOwnConfig.
@Test
public void testGetOwnConfig() throws ConfigStoreCreationException, URISyntaxException, IOException {
String datasetName = "dataset-test-get-own-config";
Path datasetPath = new Path(CONFIG_DIR_PATH, datasetName);
try {
this.fs.mkdirs(datasetPath);
this.fs.create(new Path(datasetPath, "main.conf")).close();
ConfigKeyPath datasetConfigKey = SingleLinkedListConfigKeyPath.ROOT.createChild(datasetName);
Config config = this._simpleHadoopFilesystemConfigStore.getOwnConfig(datasetConfigKey, VERSION);
Assert.assertTrue(config.isEmpty());
} finally {
if (this.fs.exists(datasetPath)) {
this.fs.delete(datasetPath, true);
}
}
}
use of org.apache.gobblin.config.store.api.ConfigKeyPath in project incubator-gobblin by apache.
the class InMemoryValueInspector method getResolvedConfigs.
/**
* {@inheritDoc}.
*
* <p>
* If present in the cache, return the cached {@link com.typesafe.config.Config} for given input
* Otherwise, simply delegate the functionality to the internal {ConfigStoreValueInspector} and store the value into cache
* </p>
*/
@Override
public Map<ConfigKeyPath, Config> getResolvedConfigs(Collection<ConfigKeyPath> configKeys) {
Collection<ConfigKeyPath> configKeysNotInCache = new ArrayList<>();
Map<ConfigKeyPath, Config> result = new HashMap<>();
for (ConfigKeyPath configKey : configKeys) {
Config cachedValue = this.recursiveConfigCache.getIfPresent(configKey);
if (cachedValue == null) {
configKeysNotInCache.add(configKey);
} else {
result.put(configKey, cachedValue);
}
}
// for ConfigKeyPath which are not in cache
if (configKeysNotInCache.size() > 0) {
Map<ConfigKeyPath, Config> configsFromFallBack = this.valueFallback.getResolvedConfigs(configKeysNotInCache);
this.recursiveConfigCache.putAll(configsFromFallBack);
result.putAll(configsFromFallBack);
}
return result;
}
Aggregations