@Test public void put() { mProperties.put(mKeyWithValue, "value1", Source.SYSTEM_PROPERTY); mProperties.put(mKeyWithoutValue, "value2", Source.SYSTEM_PROPERTY); assertEquals("value1", mProperties.get(mKeyWithValue)); assertEquals("value2", mProperties.get(mKeyWithoutValue)); mProperties.put(mKeyWithValue, "valueLowerPriority", Source.siteProperty("")); assertEquals("value1", mProperties.get(mKeyWithValue)); mProperties.put(mKeyWithValue, "valueSamePriority", Source.SYSTEM_PROPERTY); assertEquals("valueSamePriority", mProperties.get(mKeyWithValue)); mProperties.put(mKeyWithValue, "valueHigherPriority", Source.RUNTIME); assertEquals("valueHigherPriority", mProperties.get(mKeyWithValue)); }
public void put(PropertyKey key, String value, Source source) { if (!mUserProps.containsKey(key) || source.compareTo(getSource(key)) >= 0) { mUserProps.put(key, Optional.ofNullable(value)); mSources.put(key, source); mHash.markOutdated(); } }
AlluxioProperties { public void put(PropertyKey key, String value, Source source) { if (!mUserProps.containsKey(key) || source.compareTo(getSource(key)) >= 0) { mUserProps.put(key, Optional.ofNullable(value)); mSources.put(key, source); mHash.markOutdated(); } } }
AlluxioProperties { public void put(PropertyKey key, String value, Source source) { if (!mUserProps.containsKey(key) || source.compareTo(getSource(key)) >= 0) { mUserProps.put(key, Optional.ofNullable(value)); mSources.put(key, source); mHash.markOutdated(); } } AlluxioProperties();  AlluxioProperties(AlluxioProperties alluxioProperties); }
AlluxioProperties { public void put(PropertyKey key, String value, Source source) { if (!mUserProps.containsKey(key) || source.compareTo(getSource(key)) >= 0) { mUserProps.put(key, Optional.ofNullable(value)); mSources.put(key, source); mHash.markOutdated(); } } AlluxioProperties();  AlluxioProperties(AlluxioProperties alluxioProperties); @Nullable String get(PropertyKey key); void clear(); void put(PropertyKey key, String value, Source source); void set(PropertyKey key, String value); void merge(Map<?, ?> properties, Source source); void remove(PropertyKey key); boolean isSet(PropertyKey key); boolean isSetByUser(PropertyKey key); Set<Map.Entry<PropertyKey, String>> entrySet(); Set<PropertyKey> keySet(); Set<PropertyKey> userKeySet(); void forEach(BiConsumer<? super PropertyKey, ? super String> action); AlluxioProperties copy(); @VisibleForTesting void setSource(PropertyKey key, Source source); Source getSource(PropertyKey key); String hash(); }
AlluxioProperties { public void put(PropertyKey key, String value, Source source) { if (!mUserProps.containsKey(key) || source.compareTo(getSource(key)) >= 0) { mUserProps.put(key, Optional.ofNullable(value)); mSources.put(key, source); mHash.markOutdated(); } } AlluxioProperties();  AlluxioProperties(AlluxioProperties alluxioProperties); @Nullable String get(PropertyKey key); void clear(); void put(PropertyKey key, String value, Source source); void set(PropertyKey key, String value); void merge(Map<?, ?> properties, Source source); void remove(PropertyKey key); boolean isSet(PropertyKey key); boolean isSetByUser(PropertyKey key); Set<Map.Entry<PropertyKey, String>> entrySet(); Set<PropertyKey> keySet(); Set<PropertyKey> userKeySet(); void forEach(BiConsumer<? super PropertyKey, ? super String> action); AlluxioProperties copy(); @VisibleForTesting void setSource(PropertyKey key, Source source); Source getSource(PropertyKey key); String hash();  }