use of alluxio.client.file.options.CreateFileOptions in project alluxio by Alluxio.
the class JournalIntegrationTest method pin.
/**
* Tests journalling of inodes being pinned.
*/
@Test
public void pin() throws Exception {
SetAttributeOptions setPinned = SetAttributeOptions.defaults().setPinned(true);
SetAttributeOptions setUnpinned = SetAttributeOptions.defaults().setPinned(false);
AlluxioURI dirUri = new AlluxioURI("/myFolder");
mFileSystem.createDirectory(dirUri);
mFileSystem.setAttribute(dirUri, setPinned);
AlluxioURI file0Path = new AlluxioURI("/myFolder/file0");
CreateFileOptions op = CreateFileOptions.defaults().setBlockSizeBytes(64);
mFileSystem.createFile(file0Path, op).close();
mFileSystem.setAttribute(file0Path, setUnpinned);
AlluxioURI file1Path = new AlluxioURI("/myFolder/file1");
mFileSystem.createFile(file1Path, op).close();
URIStatus directoryStatus = mFileSystem.getStatus(dirUri);
URIStatus file0Status = mFileSystem.getStatus(file0Path);
URIStatus file1Status = mFileSystem.getStatus(file1Path);
mLocalAlluxioCluster.stopFS();
pinTestUtil(directoryStatus, file0Status, file1Status);
deleteFsMasterJournalLogs();
pinTestUtil(directoryStatus, file0Status, file1Status);
}
use of alluxio.client.file.options.CreateFileOptions in project alluxio by Alluxio.
the class MasterFaultToleranceIntegrationTest method createFiles.
@Test
public void createFiles() throws Exception {
int clients = 10;
CreateFileOptions option = CreateFileOptions.defaults().setBlockSizeBytes(1024).setWriteType(WriteType.THROUGH);
for (int k = 0; k < clients; k++) {
mFileSystem.createFile(new AlluxioURI(AlluxioURI.SEPARATOR + k), option).close();
}
List<String> files = FileSystemTestUtils.listFiles(mFileSystem, AlluxioURI.SEPARATOR);
Assert.assertEquals(clients, files.size());
Collections.sort(files);
for (int k = 0; k < clients; k++) {
Assert.assertEquals(AlluxioURI.SEPARATOR + k, files.get(k));
}
}
use of alluxio.client.file.options.CreateFileOptions in project alluxio by Alluxio.
the class CheckConsistencyIntegrationTest method largeTree.
/**
* Tests the {@link FileSystemMaster#checkConsistency(AlluxioURI, CheckConsistencyOptions)} method
* when some files are consistent in a larger inode tree.
*/
@Test
public void largeTree() throws Exception {
CreateDirectoryOptions dirOptions = CreateDirectoryOptions.defaults().setWriteType(WriteType.CACHE_THROUGH);
CreateFileOptions fileOptions = CreateFileOptions.defaults().setWriteType(WriteType.CACHE_THROUGH);
AlluxioURI nestedDir = DIRECTORY.join("/dir2");
AlluxioURI topLevelFile = new AlluxioURI("/file");
AlluxioURI thirdLevelFile = nestedDir.join("/file");
mFileSystem.createDirectory(nestedDir, dirOptions);
mFileSystem.createFile(topLevelFile, fileOptions).close();
mFileSystem.createFile(thirdLevelFile, fileOptions).close();
String ufsDirectory = mFileSystem.getStatus(nestedDir).getUfsPath();
UnderFileSystem ufs = UnderFileSystem.Factory.get(ufsDirectory);
ufs.deleteDirectory(ufsDirectory, DeleteOptions.defaults().setRecursive(true));
List<AlluxioURI> expected = Lists.newArrayList(nestedDir, thirdLevelFile);
List<AlluxioURI> result = mFileSystemMaster.checkConsistency(new AlluxioURI("/"), CheckConsistencyOptions.defaults());
Collections.sort(expected);
Collections.sort(result);
Assert.assertEquals(expected, result);
}
use of alluxio.client.file.options.CreateFileOptions in project alluxio by Alluxio.
the class JournalIntegrationTest method setAcl.
@Test
@LocalAlluxioClusterResource.Config(confParams = { PropertyKey.Name.SECURITY_AUTHENTICATION_TYPE, "SIMPLE", PropertyKey.Name.SECURITY_AUTHORIZATION_PERMISSION_ENABLED, "true", PropertyKey.Name.SECURITY_GROUP_MAPPING_CLASS, FakeUserGroupsMapping.FULL_CLASS_NAME })
public void setAcl() throws Exception {
AlluxioURI filePath = new AlluxioURI("/file");
String user = "alluxio";
Configuration.set(PropertyKey.SECURITY_LOGIN_USERNAME, user);
CreateFileOptions op = CreateFileOptions.defaults().setBlockSizeBytes(64);
mFileSystem.createFile(filePath, op).close();
// TODO(chaomin): also setOwner and setGroup once there's a way to fake the owner/group in UFS.
mFileSystem.setAttribute(filePath, SetAttributeOptions.defaults().setMode(new Mode((short) 0400)).setRecursive(false));
URIStatus status = mFileSystem.getStatus(filePath);
mLocalAlluxioCluster.stopFS();
aclTestUtil(status, user);
deleteFsMasterJournalLogs();
aclTestUtil(status, user);
}
use of alluxio.client.file.options.CreateFileOptions in project alluxio by Alluxio.
the class JournalIntegrationTest method delete.
/**
* Tests file and directory creation and deletion.
*/
@Test
public void delete() throws Exception {
CreateDirectoryOptions recMkdir = CreateDirectoryOptions.defaults().setRecursive(true);
DeleteOptions recDelete = DeleteOptions.defaults().setRecursive(true);
for (int i = 0; i < 10; i++) {
String dirPath = "/i" + i;
mFileSystem.createDirectory(new AlluxioURI(dirPath), recMkdir);
for (int j = 0; j < 10; j++) {
CreateFileOptions option = CreateFileOptions.defaults().setBlockSizeBytes((i + j + 1) * 64);
String filePath = dirPath + "/j" + j;
mFileSystem.createFile(new AlluxioURI(filePath), option).close();
if (j >= 5) {
mFileSystem.delete(new AlluxioURI(filePath), recDelete);
}
}
if (i >= 5) {
mFileSystem.delete(new AlluxioURI(dirPath), recDelete);
}
}
mLocalAlluxioCluster.stopFS();
deleteTestUtil();
deleteFsMasterJournalLogs();
deleteTestUtil();
}
Aggregations