@Test public void merge() { PropertyKey newKey = new PropertyKey.Builder("mergeNew").setDefaultValue("value3").build(); Properties sysProp = new Properties(); sysProp.put(mKeyWithValue, "value1"); sysProp.put(mKeyWithoutValue, "value2"); mProperties.merge(sysProp, Source.SYSTEM_PROPERTY); assertEquals(Source.SYSTEM_PROPERTY, mProperties.getSource(mKeyWithValue)); assertEquals(Source.SYSTEM_PROPERTY, mProperties.getSource(mKeyWithoutValue)); assertEquals(Source.DEFAULT, mProperties.getSource(newKey)); assertEquals("value1", mProperties.get(mKeyWithValue)); assertEquals("value2", mProperties.get(mKeyWithoutValue)); assertEquals("value3", mProperties.get(newKey)); }
public void merge(Map<?, ?> properties, Source source) { if (properties == null || properties.isEmpty()) { return; } for (Map.Entry<?, ?> entry : properties.entrySet()) { String key = entry.getKey().toString().trim(); String value = entry.getValue() == null ? null : entry.getValue().toString().trim(); PropertyKey propertyKey; if (PropertyKey.isValid(key)) { propertyKey = PropertyKey.fromString(key); } else { LOG.debug("Property {} from source {} is unrecognized", key, source); propertyKey = PropertyKey.getOrBuildCustom(key); } put(propertyKey, value, source); } mHash.markOutdated(); }
AlluxioProperties { public void merge(Map<?, ?> properties, Source source) { if (properties == null || properties.isEmpty()) { return; } for (Map.Entry<?, ?> entry : properties.entrySet()) { String key = entry.getKey().toString().trim(); String value = entry.getValue() == null ? null : entry.getValue().toString().trim(); PropertyKey propertyKey; if (PropertyKey.isValid(key)) { propertyKey = PropertyKey.fromString(key); } else { LOG.debug("Property {} from source {} is unrecognized", key, source); propertyKey = PropertyKey.getOrBuildCustom(key); } put(propertyKey, value, source); } mHash.markOutdated(); } }
AlluxioProperties { public void merge(Map<?, ?> properties, Source source) { if (properties == null || properties.isEmpty()) { return; } for (Map.Entry<?, ?> entry : properties.entrySet()) { String key = entry.getKey().toString().trim(); String value = entry.getValue() == null ? null : entry.getValue().toString().trim(); PropertyKey propertyKey; if (PropertyKey.isValid(key)) { propertyKey = PropertyKey.fromString(key); } else { LOG.debug("Property {} from source {} is unrecognized", key, source); propertyKey = PropertyKey.getOrBuildCustom(key); } put(propertyKey, value, source); } mHash.markOutdated(); } AlluxioProperties();  AlluxioProperties(AlluxioProperties alluxioProperties); }
AlluxioProperties { public void merge(Map<?, ?> properties, Source source) { if (properties == null || properties.isEmpty()) { return; } for (Map.Entry<?, ?> entry : properties.entrySet()) { String key = entry.getKey().toString().trim(); String value = entry.getValue() == null ? null : entry.getValue().toString().trim(); PropertyKey propertyKey; if (PropertyKey.isValid(key)) { propertyKey = PropertyKey.fromString(key); } else { LOG.debug("Property {} from source {} is unrecognized", key, source); propertyKey = PropertyKey.getOrBuildCustom(key); } put(propertyKey, value, 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 merge(Map<?, ?> properties, Source source) { if (properties == null || properties.isEmpty()) { return; } for (Map.Entry<?, ?> entry : properties.entrySet()) { String key = entry.getKey().toString().trim(); String value = entry.getValue() == null ? null : entry.getValue().toString().trim(); PropertyKey propertyKey; if (PropertyKey.isValid(key)) { propertyKey = PropertyKey.fromString(key); } else { LOG.debug("Property {} from source {} is unrecognized", key, source); propertyKey = PropertyKey.getOrBuildCustom(key); } put(propertyKey, value, 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();  }