Configuration implements DataSerializable { public void putDeployment(Deployment deployment) { String artifactId = getArtifactId(deployment.getFileName()); deployments.values().removeIf(d -> getArtifactId(d.getFileName()).equals(artifactId)); deployments.put(deployment.getId(), deployment); } Configuration();  Configuration(Configuration that);  Configuration(String configName); String getCacheXmlContent(); void setCacheXmlContent(String cacheXmlContent); void setCacheXmlFile(File cacheXmlFile); void setPropertiesFile(File propertiesFile); String getCacheXmlFileName(); Properties getGemfireProperties(); void setGemfireProperties(Properties gemfireProperties); void addGemfireProperties(Properties gemfireProperties); String getConfigName(); String getPropertiesFileName(); void putDeployment(Deployment deployment); Collection<Deployment> getDeployments(); void removeJarNames(String[] jarNames); Set<String> getJarNames(); @Override void toData(DataOutput out); @Override void fromData(DataInput in); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode();  }
@Test public void dataSerializationRoundTrip() throws IOException, ClassNotFoundException { ByteArrayOutputStream outBytes = new ByteArrayOutputStream(); DataOutputStream dataOut = new DataOutputStream(outBytes); Configuration originalConfig = new Configuration(); originalConfig.putDeployment(new Deployment("jarName1.jar", "deployedBy1", "deployedTime1")); originalConfig.putDeployment(new Deployment("jarName2.jar", "deployedBy2", "deployedTime2")); originalConfig.putDeployment(new Deployment("jarName3.jar", "deployedBy3", "deployedTime3")); DataSerializer.writeObject(originalConfig, dataOut); dataOut.flush(); ByteArrayInputStream inBytes = new ByteArrayInputStream(outBytes.toByteArray()); DataInput dataIn = new DataInputStream(inBytes); Configuration deserializedConfig = DataSerializer.readObject(dataIn); assertThat(deserializedConfig) .isEqualTo(originalConfig); }