/** * {@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 Config getResolvedConfig(final ConfigKeyPath configKey) { return getResolvedConfig(configKey, Optional.<Config>absent()); }
inMemoryValueInspector = new InMemoryValueInspector(rawValueInspector, false); result = new ConfigStoreAccessor(cs, inMemoryValueInspector, inMemoryTopology); inMemoryValueInspector = new InMemoryValueInspector(rawValueInspector, true); result = new ConfigStoreAccessor(cs, inMemoryValueInspector, inMemoryTopology);
@Test public void testNonRootValues() { ConfigStoreBackedTopology csTopology = new ConfigStoreBackedTopology(this.mockConfigStore, this.version); InMemoryTopology inMemory = new InMemoryTopology(csTopology); ConfigStoreBackedValueInspector rawValueInspector = new ConfigStoreBackedValueInspector(this.mockConfigStore, this.version, inMemory); InMemoryValueInspector inMemoryStrongRef = new InMemoryValueInspector(rawValueInspector, true); InMemoryValueInspector inMemoryWeakRef = new InMemoryValueInspector(rawValueInspector, false); // test values for Identity testValuesForIdentity(rawValueInspector); testValuesForIdentity(inMemoryStrongRef); testValuesForIdentity(inMemoryWeakRef); // test values for Espresso Tag testValuesForEspressoTag(rawValueInspector); testValuesForEspressoTag(inMemoryStrongRef); testValuesForEspressoTag(inMemoryWeakRef); // test for batch Collection<ConfigKeyPath> inputs = new ArrayList<ConfigKeyPath>(); inputs.add(espressoTag); inputs.add(identity); Map<ConfigKeyPath, Config> resultMap = rawValueInspector.getOwnConfigs(inputs); Assert.assertEquals(resultMap.size(), 2); testValuesForEspressoTagOwnConfig(resultMap.get(espressoTag)); checkValuesForIdentityOwnConfig(resultMap.get(identity)); resultMap = rawValueInspector.getResolvedConfigs(inputs); Assert.assertEquals(resultMap.size(), 2); testValuesForEspressoTagResolvedConfig(resultMap.get(espressoTag)); checkValuesForIdentityResolvedConfig(resultMap.get(identity)); }
inMemoryValueInspector = new InMemoryValueInspector(rawValueInspector, false); result = new ConfigStoreAccessor(cs, inMemoryValueInspector, inMemoryTopology); inMemoryValueInspector = new InMemoryValueInspector(rawValueInspector, true); result = new ConfigStoreAccessor(cs, inMemoryValueInspector, inMemoryTopology);
/** * {@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 Config getResolvedConfig(final ConfigKeyPath configKey) { return getResolvedConfig(configKey, Optional.<Config>absent()); }