use of com.facebook.buck.io.ArchiveMemberPath in project buck by facebook.
the class StackedFileHashCacheTest method usesSecondCacheForArchivePathAbsolutePath.
@Test
public void usesSecondCacheForArchivePathAbsolutePath() throws IOException {
Path path = Paths.get("world.jar");
Path fullPath = tmp2.getRoot().resolve(path);
ProjectFileHashCache innerCache = DefaultFileHashCache.createDefaultFileHashCache(new ProjectFilesystem(tmp.getRoot()));
// The second project filesystem has the file.
ProjectFilesystem filesystem2 = new ProjectFilesystem(tmp2.getRoot());
ProjectFileHashCache innerCache2 = DefaultFileHashCache.createDefaultFileHashCache(filesystem2);
writeJarWithHashes(filesystem2, fullPath);
ArchiveMemberPath archiveMemberPath = ArchiveMemberPath.of(path, Paths.get(SOME_FILE_INSIDE_JAR));
ArchiveMemberPath fullArchiveMemberPath = archiveMemberPath.withArchivePath(filesystem2.resolve(archiveMemberPath.getArchivePath()));
StackedFileHashCache cache = new StackedFileHashCache(ImmutableList.of(innerCache, innerCache2));
cache.get(fullArchiveMemberPath);
assertTrue(innerCache2.willGet(archiveMemberPath));
}
use of com.facebook.buck.io.ArchiveMemberPath in project buck by facebook.
the class StackedFileHashCacheTest method usesSecondCacheForArchivePath.
@Test
public void usesSecondCacheForArchivePath() throws IOException {
ProjectFileHashCache innerCache = DefaultFileHashCache.createDefaultFileHashCache(new ProjectFilesystem(tmp.getRoot()));
// The second project filesystem has the file.
ProjectFilesystem filesystem2 = new ProjectFilesystem(tmp2.getRoot());
Path path = filesystem2.getPath("world.jar");
ProjectFileHashCache innerCache2 = DefaultFileHashCache.createDefaultFileHashCache(filesystem2);
writeJarWithHashes(filesystem2, path);
ArchiveMemberPath archiveMemberPath = ArchiveMemberPath.of(path, Paths.get(SOME_FILE_INSIDE_JAR));
StackedFileHashCache cache = new StackedFileHashCache(ImmutableList.of(innerCache, innerCache2));
cache.get(filesystem2, archiveMemberPath);
assertTrue(innerCache2.willGet(archiveMemberPath));
}
use of com.facebook.buck.io.ArchiveMemberPath in project buck by facebook.
the class StackedFileHashCacheTest method skipsFirstCacheBecauseIgnoredForArchiveMemberPathAbsolutePath.
@Test
public void skipsFirstCacheBecauseIgnoredForArchiveMemberPathAbsolutePath() throws IOException {
Config config = ConfigBuilder.createFromText("[project]", "ignore = world.jar");
Path fullPath = Paths.get("world.jar");
ProjectFilesystem filesystem = new ProjectFilesystem(tmp.getRoot(), config);
writeJarWithHashes(filesystem, filesystem.resolve(fullPath));
ArchiveMemberPath archiveMemberPath = ArchiveMemberPath.of(filesystem.resolve(fullPath), Paths.get("Nonexistent.class"));
ProjectFileHashCache innerCache = DefaultFileHashCache.createDefaultFileHashCache(filesystem);
StackedFileHashCache cache = new StackedFileHashCache(ImmutableList.of(innerCache));
expectedException.expect(NoSuchFileException.class);
cache.get(archiveMemberPath);
}
use of com.facebook.buck.io.ArchiveMemberPath in project buck by facebook.
the class StackedFileHashCacheTest method usesFirstCacheForArchivePathAbsolutePath.
@Test
public void usesFirstCacheForArchivePathAbsolutePath() throws IOException {
ProjectFilesystem filesystem = new FakeProjectFilesystem();
Path path = Paths.get("world.jar");
writeJarWithHashes(filesystem, path);
ArchiveMemberPath archiveMemberPath = ArchiveMemberPath.of(path, Paths.get(SOME_FILE_INSIDE_JAR));
ArchiveMemberPath fullArchiveMemberPath = archiveMemberPath.withArchivePath(filesystem.resolve(archiveMemberPath.getArchivePath()));
ProjectFileHashCache innerCache = DefaultFileHashCache.createDefaultFileHashCache(filesystem);
StackedFileHashCache cache = new StackedFileHashCache(ImmutableList.of(innerCache));
cache.get(fullArchiveMemberPath);
assertTrue(innerCache.willGet(archiveMemberPath));
}
use of com.facebook.buck.io.ArchiveMemberPath in project buck by facebook.
the class StackedFileHashCacheTest method skipsFirstCacheForArchiveMemberPath.
@Test
public void skipsFirstCacheForArchiveMemberPath() throws IOException {
ProjectFilesystem filesystem = new ProjectFilesystem(tmp.getRoot());
Path path = filesystem.getPath("world.jar");
writeJarWithHashes(filesystem, path);
ArchiveMemberPath archiveMemberPath = ArchiveMemberPath.of(path, filesystem.getPath("Nonexistent.class"));
ProjectFileHashCache innerCache = DefaultFileHashCache.createDefaultFileHashCache(filesystem);
StackedFileHashCache cache = new StackedFileHashCache(ImmutableList.of(innerCache));
expectedException.expect(NoSuchFileException.class);
cache.get(filesystem, archiveMemberPath);
}
Aggregations