public static Collection<PropertyChange> getChangedProperties(Configuration newConf, Configuration oldConf) { Map<String, PropertyChange> changes = new HashMap<String, PropertyChange>(); // iterate over old configuration for (Map.Entry<String, String> oldEntry: oldConf) { String prop = oldEntry.getKey(); String oldVal = oldEntry.getValue(); String newVal = newConf.getRaw(prop); if (newVal == null || !newVal.equals(oldVal)) { changes.put(prop, new PropertyChange(prop, newVal, oldVal)); } } // now iterate over new configuration // (to look for properties not present in old conf) for (Map.Entry<String, String> newEntry: newConf) { String prop = newEntry.getKey(); String newVal = newEntry.getValue(); if (oldConf.get(prop) == null) { changes.put(prop, new PropertyChange(prop, newVal, null)); } } return changes.values(); }
File newDir = new File(cluster.getDataDirectory(), "data_new"); newDir.mkdirs(); changes.add(new ReconfigurationUtil.PropertyChange( DFS_DATANODE_DATA_DIR_KEY, newDir.toString(), datanode.getConf().get(DFS_DATANODE_DATA_DIR_KEY))); changes.add(new ReconfigurationUtil.PropertyChange( "randomKey", "new123", "old456")); when(ru.parseChangedProperties(any(Configuration.class),
AsyncReconfigurableDummy dummy = spy(new AsyncReconfigurableDummy(conf1)); List<PropertyChange> changes = Lists.newArrayList( new PropertyChange(PROP1, "new1", "old1") ); doReturn(changes).when(dummy).getChangedProperties(
AsyncReconfigurableDummy dummy = spy(new AsyncReconfigurableDummy(conf1)); List<PropertyChange> changes = Lists.newArrayList( new PropertyChange(PROP1, "new1", "old1") ); doReturn(changes).when(dummy).getChangedProperties(
changes.add(new PropertyChange("name1", "new1", "old1")); changes.add(new PropertyChange("name2", "new2", "old2")); changes.add(new PropertyChange("name3", "new3", "old3")); doReturn(changes).when(dummy).getChangedProperties( any(Configuration.class), any(Configuration.class));
changes.add(new PropertyChange("name1", "new1", "old1")); changes.add(new PropertyChange("name2", "new2", "old2")); changes.add(new PropertyChange("name3", "new3", "old3")); doReturn(changes).when(dummy).getChangedProperties( any(Configuration.class), any(Configuration.class));
for (GetReconfigurationStatusConfigChangeProto change : response.getChangesList()) { PropertyChange pc = new PropertyChange( change.getName(), change.getNewValue(), change.getOldValue()); String errorMessage = null;
for (GetReconfigurationStatusConfigChangeProto change : response.getChangesList()) { PropertyChange pc = new PropertyChange( change.getName(), change.getNewValue(), change.getOldValue()); String errorMessage = null;
public static Collection<PropertyChange> getChangedProperties(Configuration newConf, Configuration oldConf) { Map<String, PropertyChange> changes = new HashMap<String, PropertyChange>(); // iterate over old configuration for (Map.Entry<String, String> oldEntry: oldConf) { String prop = oldEntry.getKey(); String oldVal = oldEntry.getValue(); String newVal = newConf.getRaw(prop); if (newVal == null || !newVal.equals(oldVal)) { changes.put(prop, new PropertyChange(prop, newVal, oldVal)); } } // now iterate over new configuration // (to look for properties not present in old conf) for (Map.Entry<String, String> newEntry: newConf) { String prop = newEntry.getKey(); String newVal = newEntry.getValue(); if (oldConf.get(prop) == null) { changes.put(prop, new PropertyChange(prop, newVal, null)); } } return changes.values(); }
public static ReconfigurationTaskStatus getReconfigurationStatus( GetReconfigurationStatusResponseProto response) { Map<PropertyChange, Optional<String>> statusMap = null; long startTime; long endTime = 0; startTime = response.getStartTime(); if (response.hasEndTime()) { endTime = response.getEndTime(); } if (response.getChangesCount() > 0) { statusMap = Maps.newHashMap(); for (GetReconfigurationStatusConfigChangeProto change : response .getChangesList()) { PropertyChange pc = new PropertyChange(change.getName(), change.getNewValue(), change.getOldValue()); String errorMessage = null; if (change.hasErrorMessage()) { errorMessage = change.getErrorMessage(); } statusMap.put(pc, Optional.ofNullable(errorMessage)); } } return new ReconfigurationTaskStatus(startTime, endTime, statusMap); } }
public static Collection<PropertyChange> getChangedProperties(Configuration newConf, Configuration oldConf) { Map<String, PropertyChange> changes = new HashMap<String, PropertyChange>(); // iterate over old configuration for (Map.Entry<String, String> oldEntry: oldConf) { String prop = oldEntry.getKey(); String oldVal = oldEntry.getValue(); String newVal = newConf.getRaw(prop); if (newVal == null || !newVal.equals(oldVal)) { changes.put(prop, new PropertyChange(prop, newVal, oldVal)); } } // now iterate over new configuration // (to look for properties not present in old conf) for (Map.Entry<String, String> newEntry: newConf) { String prop = newEntry.getKey(); String newVal = newEntry.getValue(); if (oldConf.get(prop) == null) { changes.put(prop, new PropertyChange(prop, newVal, null)); } } return changes.values(); } }
public static Collection<PropertyChange> getChangedProperties(Configuration newConf, Configuration oldConf) { Map<String, PropertyChange> changes = new HashMap<String, PropertyChange>(); // iterate over old configuration for (Map.Entry<String, String> oldEntry: oldConf) { String prop = oldEntry.getKey(); String oldVal = oldEntry.getValue(); String newVal = newConf.getRaw(prop); if (newVal == null || !newVal.equals(oldVal)) { changes.put(prop, new PropertyChange(prop, newVal, oldVal)); } } // now iterate over new configuration // (to look for properties not present in old conf) for (Map.Entry<String, String> newEntry: newConf) { String prop = newEntry.getKey(); String newVal = newEntry.getValue(); if (oldConf.get(prop) == null) { changes.put(prop, new PropertyChange(prop, newVal, null)); } } return changes.values(); }
public static Collection<PropertyChange> getChangedProperties(Configuration newConf, Configuration oldConf) { Map<String, PropertyChange> changes = new HashMap<String, PropertyChange>(); // iterate over old configuration for (Map.Entry<String, String> oldEntry: oldConf) { String prop = oldEntry.getKey(); String oldVal = oldEntry.getValue(); String newVal = newConf.getRaw(prop); if (newVal == null || !newVal.equals(oldVal)) { changes.put(prop, new PropertyChange(prop, newVal, oldVal)); } } // now iterate over new configuration // (to look for properties not present in old conf) for (Map.Entry<String, String> newEntry: newConf) { String prop = newEntry.getKey(); String newVal = newEntry.getValue(); if (oldConf.get(prop) == null) { changes.put(prop, new PropertyChange(prop, newVal, null)); } } return changes.values(); }
public static Collection<PropertyChange> getChangedProperties(Configuration newConf, Configuration oldConf) { Map<String, PropertyChange> changes = new HashMap<String, PropertyChange>(); // iterate over old configuration for (Map.Entry<String, String> oldEntry: oldConf) { String prop = oldEntry.getKey(); String oldVal = oldEntry.getValue(); String newVal = newConf.getRaw(prop); if (newVal == null || !newVal.equals(oldVal)) { changes.put(prop, new PropertyChange(prop, newVal, oldVal)); } } // now iterate over new configuration // (to look for properties not present in old conf) for (Map.Entry<String, String> newEntry: newConf) { String prop = newEntry.getKey(); String newVal = newEntry.getValue(); if (oldConf.get(prop) == null) { changes.put(prop, new PropertyChange(prop, newVal, null)); } } return changes.values(); }