### Question:
DriftManager extends AgentService implements DriftAgentService, DriftClient, ContainerService { @Override public void ackChangeSet(int resourceId, String defName) { log.info("Received server change set ack for [resourceId: " + resourceId + ", driftDefinition:" + defName + "]"); File resourceDir = new File(changeSetsDir, Integer.toString(resourceId)); File changeSetDir = new File(resourceDir, defName); if (!changeSetDir.exists()) { log.warn("Cannot complete acknowledgement. Change set directory " + changeSetDir.getPath() + " does not exist."); return; } try { File snapshot = changeSetMgr.findChangeSet(resourceId, defName, COVERAGE); if (null == snapshot) { log.warn("Cannot complete acknowledgement. Could not find coverage changeset for [" + resourceId + "," + defName + "]."); return; } File previousSnapshot = new File(snapshot.getParentFile(), snapshot.getName() + ".previous"); previousSnapshot.delete(); } finally { deleteZipFiles(changeSetDir, "changeset_"); } } DriftManager(PluginContainerConfiguration configuration, AgentServiceStreamRemoter streamRemoter, InventoryManager inventoryManager); boolean isInitialized(); void scanForContentToResend(); ScheduleQueue getSchedulesQueue(); @Override void shutdown(); @Override void sendChangeSetToServer(DriftDetectionSummary detectionSummary); @Override void sendChangeSetContentToServer(int resourceId, String driftDefName, File contentZipFile); @Override void repeatChangeSet(int resourceId, String driftDefName, int version); @Override void detectDrift(int resourceId, DriftDefinition driftDefinition); @Override void scheduleDriftDetection(int resourceId, DriftDefinition driftDefinition); @Override boolean requestDriftFiles(int resourceId, Headers headers, List<? extends DriftFile> driftFiles); @Override void unscheduleDriftDetection(final int resourceId, final DriftDefinition driftDefinition); @Override void updateDriftDetection(int resourceId, DriftDefinition driftDefinition); @Override void updateDriftDetection(int resourceId, DriftDefinition driftDef, DriftSnapshot driftSnapshot); @Override void reportMissingBaseDir(int resourceId, DriftDefinition driftDefinition); @Override void pinSnapshot(final int resourceId, final String defName, final DriftSnapshot snapshot); @Override void ackChangeSet(int resourceId, String defName); @Override void ackChangeSetContent(int resourceId, String driftDefName, String token); @Override File getAbsoluteBaseDirectory(int resourceId, DriftDefinition driftDefinition); InventoryManager getInventoryManager();  }### Answer:
@Test public void cleanUpWhenServerAcksChangeSet() throws Exception { DriftDefinition config = driftDefinition("clean-up-when-server-acks-changeset", resourceDir.getAbsolutePath()); File changeSetDir = changeSetDir(config.getName()); File snapshotFile = createRandomFile(changeSetDir, "changeset.txt"); File previousSnapshotFile = createRandomFile(changeSetDir, "changeset.txt.previous"); createRandomFile(changeSetDir, "changeset_" + System.currentTimeMillis() + ".zip"); driftMgr.ackChangeSet(resourceId(), config.getName()); assertTrue(snapshotFile.exists(), "Snapshot file should exist after server acks change set"); assertFalse(previousSnapshotFile.exists(), "Previous version snapshot file should be deleted when server " + "acks change set"); assertEquals(findChangeSetZipFiles(changeSetDir).size(), 0, "All change set zip files should be deleted when " + "server acks change set"); }