use of alluxio.grpc.GetStatusPOptions in project alluxio by Alluxio.
the class UfsSyncIntegrationTest method ufsModeSync.
@Test
public void ufsModeSync() throws Exception {
GetStatusPOptions options = GetStatusPOptions.newBuilder().setLoadMetadataType(LoadMetadataPType.NEVER).setCommonOptions(PSYNC_ALWAYS).build();
writeUfsFile(ufsPath(EXISTING_FILE), 10);
// Set the ufs permissions
File ufsFile = new File(ufsPath(EXISTING_FILE));
assertTrue(ufsFile.setReadable(true, false));
assertTrue(ufsFile.setWritable(true, false));
assertTrue(ufsFile.setExecutable(true, false));
URIStatus status = mFileSystem.getStatus(new AlluxioURI(alluxioPath(EXISTING_FILE)), options);
String startFingerprint = status.getUfsFingerprint();
// Update ufs permissions
assertTrue(ufsFile.setExecutable(false, false));
status = mFileSystem.getStatus(new AlluxioURI(alluxioPath(EXISTING_FILE)), options);
// Verify the fingerprints are different.
Assert.assertNotEquals(startFingerprint, status.getUfsFingerprint());
}
use of alluxio.grpc.GetStatusPOptions in project alluxio by Alluxio.
the class UfsSyncIntegrationTest method getStatusDirSync.
@Test
public void getStatusDirSync() throws Exception {
GetStatusPOptions options = GetStatusPOptions.newBuilder().setLoadMetadataType(LoadMetadataPType.NEVER).setCommonOptions(PSYNC_ALWAYS).build();
checkGetStatus(EXISTING_DIR, options, true);
}
use of alluxio.grpc.GetStatusPOptions in project alluxio by Alluxio.
the class UfsSyncIntegrationTest method mountPointConflict.
@Test
public void mountPointConflict() throws Exception {
GetStatusPOptions gsOptions = GetStatusPOptions.newBuilder().setLoadMetadataType(LoadMetadataPType.NEVER).setCommonOptions(PSYNC_ALWAYS).build();
URIStatus status = mFileSystem.getStatus(new AlluxioURI("/"), gsOptions);
// add a UFS dir which conflicts with a mount point.
String fromRootUfs = status.getUfsPath() + "/mnt";
assertTrue(new File(fromRootUfs).mkdirs());
ListStatusPOptions options = ListStatusPOptions.newBuilder().setLoadMetadataType(LoadMetadataPType.NEVER).setCommonOptions(PSYNC_ALWAYS).build();
List<URIStatus> rootListing = mFileSystem.listStatus(new AlluxioURI("/"), options);
assertEquals(1, rootListing.size());
assertEquals("mnt", rootListing.get(0).getName());
Assert.assertNotEquals(fromRootUfs, rootListing.get(0).getUfsPath());
}
use of alluxio.grpc.GetStatusPOptions in project alluxio by Alluxio.
the class BaseFileSystemTest method openFile.
/**
* Tests for the {@link BaseFileSystem#openFile(AlluxioURI, OpenFilePOptions)} method to
* complete successfully.
*/
@Test
public void openFile() throws Exception {
AlluxioURI file = new AlluxioURI("/file");
URIStatus status = new URIStatus(new FileInfo().setCompleted(true));
GetStatusPOptions getStatusOptions = getOpenOptions(GetStatusPOptions.getDefaultInstance());
when(mFileSystemMasterClient.getStatus(file, getStatusOptions)).thenReturn(status);
mFileSystem.openFile(file, OpenFilePOptions.getDefaultInstance());
verify(mFileSystemMasterClient).getStatus(file, getStatusOptions);
verifyFilesystemContextAcquiredAndReleased();
}
use of alluxio.grpc.GetStatusPOptions in project alluxio by Alluxio.
the class LoadMetadataCommandIntegrationTest method loadMetadataFile.
@Test
public void loadMetadataFile() throws IOException, AlluxioException {
String filePath = "/testRoot/layer1/layer2/layer3/testFile";
FileSystemTestUtils.createByteFile(sFileSystem, filePath, WritePType.CACHE_THROUGH, 10);
AlluxioURI uri = new AlluxioURI(filePath);
URIStatus statusBefore = sFileSystem.getStatus(uri);
DeletePOptions deletePOptions = DeletePOptions.newBuilder().setAlluxioOnly(true).setRecursive(true).build();
sFileSystem.delete(uri, deletePOptions);
sFsShell.run("loadMetadata", filePath);
// Use LoadMetadataPType.NEVER to avoid loading metadata during get file status
GetStatusPOptions getStatusPOptions = GetStatusPOptions.newBuilder().setLoadMetadataType(LoadMetadataPType.NEVER).build();
URIStatus statusAfter = sFileSystem.getStatus(uri, getStatusPOptions);
assertEquals(statusBefore.getFileInfo().getName(), statusAfter.getFileInfo().getName());
assertEquals(statusBefore.getFileInfo().getLength(), statusAfter.getFileInfo().getLength());
}
Aggregations