DynamicPropUtils implements Serializable, Cloneable, Closeable { public boolean sync(String projectName) { if (uninitialized()) return false; if (projectName == null) { LOGGER.error("Sync failed! Cause projectName cannot be null!"); return false; } ExistsBuilder existsBuilder = curatorFramework.checkExists(); Stat stat; try { stat = existsBuilder.forPath(ZNODE_PREFIX.concat(projectName)); } catch (Exception e) { LOGGER.error("Sync failed!", e); return false; } Prop localProp = PROJECT_PROPERTIES.get(projectName); boolean isRemote, isLocal; if (stat == null) { LOGGER.debug("Configuration about project[{}] is not on remote.", projectName); isRemote = false; } else { LOGGER.debug("Configuration about project[{}] is on remote.", projectName); isRemote = true; } if (localProp == null) { LOGGER.debug("Configuration about project[{}] is not on local.", projectName); isLocal = false; } else { LOGGER.debug("Configuration about project[{}] is on local.", projectName); isLocal = true; } boolean isSynced = internalSync(projectName, localProp, isRemote, isLocal); if (isSynced) LOGGER.debug("Sync success!"); return isSynced; } private  DynamicPropUtils(); static DynamicPropUtils getInstance(); boolean add(String projectName, Properties p); Object get(String projectName, String key); Properties getProperties(String projectName); Object getFromLocal(String projectName, String key); Object getFromRemote(String projectName, String key); boolean sync(String projectName); @Override void close(); @Override Object clone();  }
@Test public void syncTest() { String projectName = "yuzhouwan", key = "site", value = "blog"; Properties p = new Properties(); p.put(key, value); dp.add(projectName, p); assertEquals(value, dp.get(projectName, key)); dp.sync(projectName); assertEquals(value, dp.getFromRemote(projectName, key)); dp.close(); }