use of alluxio.client.file.FileSystemCache.Key in project alluxio by Alluxio.
the class FileSystemCacheTest method createTestFSKey.
private Key createTestFSKey(String username) {
User user = new User(username);
Set<Principal> principals = new HashSet<>();
principals.add(user);
return new FileSystemCache.Key(new Subject(false, principals, new HashSet<>(), new HashSet<>()), new InstancedConfiguration(ConfigurationUtils.defaults()));
}
use of alluxio.client.file.FileSystemCache.Key in project alluxio by Alluxio.
the class FileSystemCacheTest method getSameKey.
@Test
public void getSameKey() {
Key key1 = createTestFSKey("user1");
FileSystem fs1 = mFileSystemCache.get(key1);
FileSystem fs2 = mFileSystemCache.get(key1);
assertSame(getDelegatedFileSystem(fs1), getDelegatedFileSystem(fs2));
assertFalse(fs1.isClosed());
assertFalse(fs2.isClosed());
}
use of alluxio.client.file.FileSystemCache.Key in project alluxio by Alluxio.
the class FileSystemCacheTest method getTwiceThenClose.
@Test
public void getTwiceThenClose() throws IOException {
Key key1 = createTestFSKey("user1");
FileSystem fs1 = mFileSystemCache.get(key1);
FileSystem fs2 = mFileSystemCache.get(key1);
fs1.close();
FileSystem fs3 = mFileSystemCache.get(key1);
assertSame(getDelegatedFileSystem(fs2), getDelegatedFileSystem(fs3));
assertTrue(fs1.isClosed());
assertFalse(fs2.isClosed());
assertFalse(fs3.isClosed());
}
use of alluxio.client.file.FileSystemCache.Key in project alluxio by Alluxio.
the class FileSystemCacheTest method doubleClose.
@Test
public void doubleClose() throws IOException {
Key key1 = createTestFSKey("user1");
FileSystem fs1 = mFileSystemCache.get(key1);
FileSystem fs2 = mFileSystemCache.get(key1);
assertSame(getDelegatedFileSystem(fs1), getDelegatedFileSystem(fs2));
fs1.close();
assertTrue(fs1.isClosed());
assertFalse(fs2.isClosed());
fs1.close();
assertTrue(fs1.isClosed());
assertFalse(fs2.isClosed());
}
use of alluxio.client.file.FileSystemCache.Key in project alluxio by Alluxio.
the class FileSystemCacheTest method getDifferentKeys.
@Test
public void getDifferentKeys() {
Key key1 = createTestFSKey("user1");
Key key2 = createTestFSKey("user2");
FileSystem fs1 = mFileSystemCache.get(key1);
FileSystem fs2 = mFileSystemCache.get(key2);
assertNotSame(getDelegatedFileSystem(fs1), getDelegatedFileSystem(fs2));
assertFalse(fs1.isClosed());
assertFalse(fs2.isClosed());
}
Aggregations