use of alluxio.grpc.CreateFilePOptions in project alluxio by Alluxio.
the class FileInStreamIntegrationTest method eofSeek.
/**
* Tests {@link FileInStream#seek(long)} when at the end of a file at the block boundary.
*/
@Test
public void eofSeek() throws Exception {
String uniqPath = PathUtils.uniqPath();
int length = BLOCK_SIZE * 3;
for (CreateFilePOptions op : getOptionSet()) {
String filename = uniqPath + "/file_" + op.hashCode();
AlluxioURI uri = new AlluxioURI(filename);
FileSystemTestUtils.createByteFile(mFileSystem, filename, length, op);
FileInStream is = mFileSystem.openFile(uri, FileSystemTestUtils.toOpenFileOptions(op));
byte[] data = new byte[length];
is.read(data, 0, length);
Assert.assertTrue(BufferUtils.equalIncreasingByteArray(length, data));
is.seek(0);
is.read(data, 0, length);
Assert.assertTrue(BufferUtils.equalIncreasingByteArray(length, data));
is.close();
}
}
use of alluxio.grpc.CreateFilePOptions in project alluxio by Alluxio.
the class UfsJournalIntegrationTest method manyFile.
/**
* Tests files creation.
*/
@Test
public void manyFile() throws Exception {
for (int i = 0; i < 10; i++) {
CreateFilePOptions option = CreateFilePOptions.newBuilder().setBlockSizeBytes((i + 1) * 64).build();
mFileSystem.createFile(new AlluxioURI("/a" + i), option).close();
}
mLocalAlluxioCluster.stopFS();
manyFileTestUtil();
deleteFsMasterJournalLogs();
manyFileTestUtil();
}
use of alluxio.grpc.CreateFilePOptions in project alluxio by Alluxio.
the class UfsJournalIntegrationTest method delete.
/**
* Tests file and directory creation and deletion.
*/
@Test
public void delete() throws Exception {
CreateDirectoryPOptions recMkdir = CreateDirectoryPOptions.newBuilder().setRecursive(true).build();
DeletePOptions recDelete = DeletePOptions.newBuilder().setRecursive(true).build();
for (int i = 0; i < 10; i++) {
String dirPath = "/i" + i;
mFileSystem.createDirectory(new AlluxioURI(dirPath), recMkdir);
for (int j = 0; j < 10; j++) {
CreateFilePOptions option = CreateFilePOptions.newBuilder().setBlockSizeBytes((i + j + 1) * 64).build();
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();
}
use of alluxio.grpc.CreateFilePOptions in project alluxio by Alluxio.
the class UfsJournalIntegrationTest method multiEditLog.
/**
* Tests reading multiple edit logs.
*/
@Test
public void multiEditLog() throws Exception {
for (int i = 0; i < 124; i++) {
CreateFilePOptions op = CreateFilePOptions.newBuilder().setBlockSizeBytes((i + 10) / 10 * 64).build();
mFileSystem.createFile(new AlluxioURI("/a" + i), op).close();
}
mLocalAlluxioCluster.stopFS();
multiEditLogTestUtil();
deleteFsMasterJournalLogs();
multiEditLogTestUtil();
}
use of alluxio.grpc.CreateFilePOptions in project alluxio by Alluxio.
the class MasterFaultToleranceIntegrationTest method createFiles.
@Test
public void createFiles() throws Exception {
int clients = 10;
CreateFilePOptions option = CreateFilePOptions.newBuilder().setBlockSizeBytes(1024).setWriteType(WritePType.THROUGH).build();
for (int k = 0; k < clients; k++) {
mFileSystem.createFile(new AlluxioURI(AlluxioURI.SEPARATOR + k), option).close();
}
List<String> files = FileSystemTestUtils.listFiles(mFileSystem, AlluxioURI.SEPARATOR);
assertEquals(clients, files.size());
Collections.sort(files);
for (int k = 0; k < clients; k++) {
assertEquals(AlluxioURI.SEPARATOR + k, files.get(k));
}
}
Aggregations