@Test public void getNestedProperties() { mConfiguration.set( PropertyKey.Template.MASTER_MOUNT_TABLE_OPTION_PROPERTY.format("foo", PropertyKey.WEB_THREADS.toString()), "val1"); mConfiguration.set( PropertyKey.Template.MASTER_MOUNT_TABLE_OPTION_PROPERTY.format("foo", "alluxio.unknown.property"), "val2"); Map<String, String> expected = new HashMap<>(); expected.put(PropertyKey.WEB_THREADS.toString(), "val1"); expected.put("alluxio.unknown.property", "val2"); assertThat(mConfiguration.getNestedProperties( PropertyKey.Template.MASTER_MOUNT_TABLE_OPTION.format("foo")), CoreMatchers.is(expected)); }
@Override public Map<String, String> getNestedProperties(PropertyKey prefixKey) { Map<String, String> ret = Maps.newHashMap(); for (Map.Entry<PropertyKey, String> entry: mProperties.entrySet()) { String key = entry.getKey().getName(); if (prefixKey.isNested(key)) { String suffixKey = key.substring(prefixKey.length() + 1); ret.put(suffixKey, entry.getValue()); } } return ret; }
InstancedConfiguration implements AlluxioConfiguration { @Override public Map<String, String> getNestedProperties(PropertyKey prefixKey) { Map<String, String> ret = Maps.newHashMap(); for (Map.Entry<PropertyKey, String> entry: mProperties.entrySet()) { String key = entry.getKey().getName(); if (prefixKey.isNested(key)) { String suffixKey = key.substring(prefixKey.length() + 1); ret.put(suffixKey, entry.getValue()); } } return ret; } }
InstancedConfiguration implements AlluxioConfiguration { @Override public Map<String, String> getNestedProperties(PropertyKey prefixKey) { Map<String, String> ret = Maps.newHashMap(); for (Map.Entry<PropertyKey, String> entry: mProperties.entrySet()) { String key = entry.getKey().getName(); if (prefixKey.isNested(key)) { String suffixKey = key.substring(prefixKey.length() + 1); ret.put(suffixKey, entry.getValue()); } } return ret; } InstancedConfiguration(AlluxioProperties properties);  InstancedConfiguration(AlluxioProperties properties, boolean clusterDefaultsLoaded);  InstancedConfiguration(AlluxioConfiguration conf); }
InstancedConfiguration implements AlluxioConfiguration { @Override public Map<String, String> getNestedProperties(PropertyKey prefixKey) { Map<String, String> ret = Maps.newHashMap(); for (Map.Entry<PropertyKey, String> entry: mProperties.entrySet()) { String key = entry.getKey().getName(); if (prefixKey.isNested(key)) { String suffixKey = key.substring(prefixKey.length() + 1); ret.put(suffixKey, entry.getValue()); } } return ret; } InstancedConfiguration(AlluxioProperties properties);  InstancedConfiguration(AlluxioProperties properties, boolean clusterDefaultsLoaded);  InstancedConfiguration(AlluxioConfiguration conf); static InstancedConfiguration defaults(); AlluxioProperties copyProperties(); @Override String get(PropertyKey key); @Override String get(PropertyKey key, ConfigurationValueOptions options); @Override boolean isSet(PropertyKey key); @Override boolean isSetByUser(PropertyKey key); void set(PropertyKey key, Object value); void set(@Nonnull PropertyKey key, @Nonnull Object value, @Nonnull Source source); void unset(PropertyKey key); void merge(Map<?, ?> properties, Source source); @Override Set<PropertyKey> keySet(); @Override Set<PropertyKey> userKeySet(); @Override int getInt(PropertyKey key); @Override long getLong(PropertyKey key); @Override double getDouble(PropertyKey key); @Override float getFloat(PropertyKey key); @Override boolean getBoolean(PropertyKey key); @Override List<String> getList(PropertyKey key, String delimiter); @Override T getEnum(PropertyKey key, Class<T> enumType); @Override long getBytes(PropertyKey key); @Override long getMs(PropertyKey key); @Override Duration getDuration(PropertyKey key); @Override Class<T> getClass(PropertyKey key); @Override Map<String, String> getNestedProperties(PropertyKey prefixKey); @Override Source getSource(PropertyKey key); @Override Map<String, String> toMap(ConfigurationValueOptions opts); @Override void validate(); @Override boolean clusterDefaultsLoaded(); @Override String hash(); }
InstancedConfiguration implements AlluxioConfiguration { @Override public Map<String, String> getNestedProperties(PropertyKey prefixKey) { Map<String, String> ret = Maps.newHashMap(); for (Map.Entry<PropertyKey, String> entry: mProperties.entrySet()) { String key = entry.getKey().getName(); if (prefixKey.isNested(key)) { String suffixKey = key.substring(prefixKey.length() + 1); ret.put(suffixKey, entry.getValue()); } } return ret; } InstancedConfiguration(AlluxioProperties properties);  InstancedConfiguration(AlluxioProperties properties, boolean clusterDefaultsLoaded);  InstancedConfiguration(AlluxioConfiguration conf); static InstancedConfiguration defaults(); AlluxioProperties copyProperties(); @Override String get(PropertyKey key); @Override String get(PropertyKey key, ConfigurationValueOptions options); @Override boolean isSet(PropertyKey key); @Override boolean isSetByUser(PropertyKey key); void set(PropertyKey key, Object value); void set(@Nonnull PropertyKey key, @Nonnull Object value, @Nonnull Source source); void unset(PropertyKey key); void merge(Map<?, ?> properties, Source source); @Override Set<PropertyKey> keySet(); @Override Set<PropertyKey> userKeySet(); @Override int getInt(PropertyKey key); @Override long getLong(PropertyKey key); @Override double getDouble(PropertyKey key); @Override float getFloat(PropertyKey key); @Override boolean getBoolean(PropertyKey key); @Override List<String> getList(PropertyKey key, String delimiter); @Override T getEnum(PropertyKey key, Class<T> enumType); @Override long getBytes(PropertyKey key); @Override long getMs(PropertyKey key); @Override Duration getDuration(PropertyKey key); @Override Class<T> getClass(PropertyKey key); @Override Map<String, String> getNestedProperties(PropertyKey prefixKey); @Override Source getSource(PropertyKey key); @Override Map<String, String> toMap(ConfigurationValueOptions opts); @Override void validate(); @Override boolean clusterDefaultsLoaded(); @Override String hash();  }