oldImpl.put(Fqn.fromString("/a/b/d"), "key2", "value2");
oldImpl.put(Fqn.fromString("/a/b/e"), "key3", "value3");
oldImpl.put(Fqn.fromString("/a/f/e"), "key4", "value4");
oldImpl.put(Fqn.ROOT, "root_key", "root_value");
ByteArrayOutputStream newBaos = new ByteArrayOutputStream(1024);
MarshalledValueOutputStream newOs = new MarshalledValueOutputStream(newBaos);
newImpl.start();
newImpl.loadEntireState(newOs);
newImpl.getMarshaller().objectToObjectStream(DefaultStateTransferManager.STREAMING_DELIMITER_NODE, newOs);
newOs.close();
newImpl.remove(Fqn.ROOT);
assertNull(newImpl.get(Fqn.fromString("/a/b/c")));
assertNull(newImpl.get(Fqn.fromString("/a/b/d")));
assertNull(newImpl.get(Fqn.fromString("/a/b/e")));
assertNull(newImpl.get(Fqn.fromString("/a/f/e")));
assertNull(newImpl.get(Fqn.ROOT));
ByteArrayInputStream bais = new ByteArrayInputStream(newBaos.toByteArray());
MarshalledValueInputStream is = new MarshalledValueInputStream(bais);
newImpl.storeEntireState(is);
assertEquals(newImpl.get(Fqn.fromString("/a/b/c")).get("key1"), "value1");
assertEquals(newImpl.get(Fqn.fromString("/a/b/d")).get("key2"), "value2");
assertEquals(newImpl.get(Fqn.fromString("/a/b/e")).get("key3"), "value3");