use of org.apache.cassandra.service.snapshot.SnapshotManifest in project cassandra by apache.
the class DirectoriesTest method testMaybeManifestLoading.
@Test
public void testMaybeManifestLoading() throws Exception {
for (TableMetadata cfm : CFM) {
String tag = "test";
Directories directories = new Directories(cfm, toDataDirectories(tempDataDir));
Descriptor parentDesc = new Descriptor(directories.getDirectoryForNewSSTables(), KS, cfm.name, 0, SSTableFormat.Type.BIG);
File parentSnapshotDirectory = Directories.getSnapshotDirectory(parentDesc, tag);
List<String> files = new LinkedList<>();
files.add(parentSnapshotDirectory.toAbsolute().absolutePath());
File manifestFile = directories.getSnapshotManifestFile(tag);
SnapshotManifest manifest = new SnapshotManifest(files, new DurationSpec("1m"), Instant.now());
manifest.serializeToJsonFile(manifestFile);
Set<File> dirs = new HashSet<>();
dirs.add(manifestFile.parent());
dirs.add(new File("buzz"));
SnapshotManifest loadedManifest = Directories.maybeLoadManifest(KS, cfm.name, tag, dirs);
assertEquals(manifest, loadedManifest);
}
}
Aggregations