### Question:
MongoDBDriftServer implements DriftServerPluginFacet, ServerPluginComponent { @Override public void saveChangeSetFiles(final Subject subject, final File changeSetFilesZip) throws Exception { String zipFileName = changeSetFilesZip.getName(); File tmpDir = new File(System.getProperty("java.io.tmpdir")); File dir = FileUtil.createTempDirectory(zipFileName.substring(0, zipFileName.indexOf(".")),null,tmpDir); dir.mkdir(); ZipUtil.unzipFile(changeSetFilesZip, dir); for (File file : dir.listFiles()) { fileDAO.save(file); file.delete(); } }  Mongo getConnection(); void setConnection(Mongo connection); Morphia getMorphia(); void setMorphia(Morphia morphia); Datastore getDatastore(); void setDatastore(Datastore ds); ChangeSetDAO getChangeSetDAO(); void setChangeSetDAO(ChangeSetDAO changeSetDAO); FileDAO getFileDAO(); void setFileDAO(FileDAO fileDAO); @Override void initialize(ServerPluginContext context); @Override void start(); @Override void stop(); @Override void shutdown(); @Override DriftChangeSetSummary saveChangeSet(final Subject subject, final int resourceId, final File changeSetZip); @Override void saveChangeSetFiles(final Subject subject, final File changeSetFilesZip); @Override PageList<? extends DriftChangeSet<?>> findDriftChangeSetsByCriteria(Subject subject,
        DriftChangeSetCriteria criteria); @Override PageList<? extends Drift<?, ?>> findDriftsByCriteria(Subject subject, DriftCriteria criteria); @Override PageList<DriftComposite> findDriftCompositesByCriteria(Subject subject, DriftCriteria criteria); @Override DriftFile getDriftFile(Subject subject, String hashId); @Override void purgeByDriftDefinitionName(Subject subject, int resourceId, String driftDefName); @Override int purgeOrphanedDriftFiles(Subject subject, long purgeMillis); void purgeOrphanedContent(); @Override String getDriftFileBits(Subject subject, String hash); String persistChangeSet(Subject subject, DriftChangeSet<?> changeSet); @Override String copyChangeSet(Subject subject, String changeSetId, int driftDefId, int resourceId); @Override byte[] getDriftFileAsByteArray(Subject subject, String hash);  }### Answer:
@Test public void persistChangeSetFileContent() throws Exception { int size = 1024; File file1 = createRandomFile(getBaseDir(), size); File file2 = createRandomFile(getBaseDir(), size); driftServer.saveChangeSetFiles(null, createChangeSetContentZipFile(file1, file2)); FileDAO fileDAO = new FileDAO(ds.getDB()); for (File expectedFile : asList(file1, file2)) { InputStream inputStream = fileDAO.findOne(expectedFile.getName()); assertNotNull(inputStream, "Failed to find file in database with id " + expectedFile.getName()); File actualFile = new File(getBaseDir(), "actualContent"); actualFile.delete(); StreamUtil.copy(inputStream, new FileOutputStream(actualFile)); assertEquals(sha256(actualFile), sha256(expectedFile), "The SHA-256 hash in the database does not " + "match that of " + expectedFile.getPath()); } }