use of alluxio.client.file.FileSystemCache.Key in project alluxio by Alluxio.
the class FileSystemCacheTest method getThenClose.
@Test
public void getThenClose() throws IOException {
Key key1 = createTestFSKey("user1");
FileSystem fs1 = mFileSystemCache.get(key1);
fs1.close();
FileSystem fs2 = mFileSystemCache.get(key1);
assertNotSame(getDelegatedFileSystem(fs1), getDelegatedFileSystem(fs2));
assertTrue(fs1.isClosed());
assertFalse(fs2.isClosed());
}
use of alluxio.client.file.FileSystemCache.Key in project alluxio by Alluxio.
the class FileSystemCacheTest method listStatusClosed.
@Test
public void listStatusClosed() throws IOException, AlluxioException {
Exception e = assertThrows(IOException.class, () -> {
Key key1 = createTestFSKey("user1");
FileSystem fs1 = mFileSystemCache.get(key1);
fs1.close();
assertTrue(fs1.isClosed());
fs1.listStatus(new AlluxioURI("/"));
});
assertTrue(e.getMessage().contains(FileSystemCache.InstanceCachingFileSystem.CLOSED_FS_ERROR_MESSAGE));
}
use of alluxio.client.file.FileSystemCache.Key in project alluxio by Alluxio.
the class FileSystemCacheTest method getTwiceThenClose2.
@Test
public void getTwiceThenClose2() 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());
fs2.close();
assertTrue(fs1.isClosed());
assertTrue(fs2.isClosed());
}
Aggregations