use of alluxio.client.file.URIStatus in project alluxio by Alluxio.
the class MkdirCommandTest method mkdirComplexPath.
@Test
public void mkdirComplexPath() throws IOException, AlluxioException {
mFsShell.run("mkdir", "/Complex!@#$%^&*()-_=+[]{};\"'<>,.?/File");
URIStatus status = mFileSystem.getStatus(new AlluxioURI("/Complex!@#$%^&*()-_=+[]{};\"'<>,.?/File"));
Assert.assertNotNull(status);
Assert.assertEquals(getCommandOutput(new String[] { "mkdir", "/Complex!@#$%^&*()-_=+[]{};\"'<>," + ".?/File" }), mOutput.toString());
Assert.assertTrue(status.isFolder());
}
use of alluxio.client.file.URIStatus in project alluxio by Alluxio.
the class MkdirCommandTest method mkdirShortPath.
@Test
public void mkdirShortPath() throws IOException, AlluxioException {
mFsShell.run("mkdir", "/root/testFile1");
URIStatus status = mFileSystem.getStatus(new AlluxioURI("/root/testFile1"));
Assert.assertNotNull(status);
Assert.assertEquals(getCommandOutput(new String[] { "mkdir", "/root/testFile1" }), mOutput.toString());
Assert.assertTrue(status.isFolder());
}
use of alluxio.client.file.URIStatus in project alluxio by Alluxio.
the class MkdirCommandTest method mkdirMultiPath.
@Test
public void mkdirMultiPath() throws IOException, AlluxioException {
String path1 = "/testDir1";
String path2 = "/testDir2";
String path3 = "/testDir2/testDir2.1";
Assert.assertEquals(0, mFsShell.run("mkdir", path1, path2, path3));
URIStatus status = mFileSystem.getStatus(new AlluxioURI(path1));
Assert.assertNotNull(status);
Assert.assertTrue(status.isFolder());
status = mFileSystem.getStatus(new AlluxioURI(path2));
Assert.assertNotNull(status);
Assert.assertTrue(status.isFolder());
status = mFileSystem.getStatus(new AlluxioURI(path3));
Assert.assertNotNull(status);
Assert.assertTrue(status.isFolder());
}
use of alluxio.client.file.URIStatus in project alluxio by Alluxio.
the class BlockServiceHandlerIntegrationTest method eviction.
// Tests that files are evicted when there is not enough space in the worker.
@Test
public void eviction() throws Exception {
final int blockSize = (int) WORKER_CAPACITY_BYTES / 2;
AlluxioURI file1 = new AlluxioURI("/file1");
FileSystemTestUtils.createByteFile(mFileSystem, file1, WriteType.MUST_CACHE, blockSize);
// File should be in memory after it is written with MUST_CACHE
URIStatus fileInfo1 = mFileSystem.getStatus(file1);
Assert.assertEquals(100, fileInfo1.getInMemoryPercentage());
AlluxioURI file2 = new AlluxioURI("/file2");
FileSystemTestUtils.createByteFile(mFileSystem, file2, WriteType.MUST_CACHE, blockSize);
// Both file 1 and 2 should be in memory since the combined size is not larger than worker space
fileInfo1 = mFileSystem.getStatus(file1);
URIStatus fileInfo2 = mFileSystem.getStatus(file2);
Assert.assertEquals(100, fileInfo1.getInMemoryPercentage());
Assert.assertEquals(100, fileInfo2.getInMemoryPercentage());
AlluxioURI file3 = new AlluxioURI("/file3");
FileSystemTestUtils.createByteFile(mFileSystem, file3, WriteType.MUST_CACHE, blockSize);
HeartbeatScheduler.execute(HeartbeatContext.WORKER_BLOCK_SYNC);
fileInfo1 = mFileSystem.getStatus(file1);
fileInfo2 = mFileSystem.getStatus(file2);
URIStatus fileInfo3 = mFileSystem.getStatus(file3);
// File 3 should be in memory and one of file 1 or 2 should be in memory
Assert.assertEquals(100, fileInfo3.getInMemoryPercentage());
Assert.assertTrue("Exactly one of file1 and file2 should be 100% in memory", fileInfo1.getInMemoryPercentage() == 100 ^ fileInfo2.getInMemoryPercentage() == 100);
}
use of alluxio.client.file.URIStatus in project alluxio by Alluxio.
the class SetTtlCommandTest method setTtlWithDelete.
@Test
public void setTtlWithDelete() throws Exception {
String filePath = "/testFile";
FileSystemTestUtils.createByteFile(mFileSystem, filePath, WriteType.MUST_CACHE, 1);
Assert.assertEquals(Constants.NO_TTL, mFileSystem.getStatus(new AlluxioURI("/testFile")).getTtl());
AlluxioURI uri = new AlluxioURI("/testFile");
long ttl = 1000L;
Assert.assertEquals(0, mFsShell.run("setTtl", "-action", "delete", filePath, String.valueOf(ttl)));
URIStatus status = mFileSystem.getStatus(uri);
Assert.assertEquals(ttl, status.getTtl());
Assert.assertEquals(TtlAction.DELETE, status.getTtlAction());
}
Aggregations