use of alluxio.client.file.options.CreateFileOptions in project alluxio by Alluxio.
the class LineageFileSystemTest method getDummyOutStream.
/**
* Tests that a {@link DummyFileOutputStream} is returned.
*/
@Test
public void getDummyOutStream() throws Exception {
AlluxioURI path = new AlluxioURI("test");
Mockito.when(mLineageMasterClient.reinitializeFile("test", TEST_BLOCK_SIZE, 0, TtlAction.DELETE)).thenReturn(-1L);
CreateFileOptions options = CreateFileOptions.defaults().setBlockSizeBytes(TEST_BLOCK_SIZE).setTtl(0);
FileOutStream outStream = mAlluxioLineageFileSystem.createFile(path, options);
Assert.assertTrue(outStream instanceof DummyFileOutputStream);
// verify client is released
Mockito.verify(mLineageContext).releaseMasterClient(mLineageMasterClient);
}
use of alluxio.client.file.options.CreateFileOptions in project alluxio by Alluxio.
the class LineageFileSystemTest method getLineageOutStream.
/**
* Tests that a {@link LineageFileOutStream} is returned.
*/
@Test
public void getLineageOutStream() throws Exception {
AlluxioURI path = new AlluxioURI("test");
Mockito.when(mLineageMasterClient.reinitializeFile("test", TEST_BLOCK_SIZE, 0, TtlAction.FREE)).thenReturn(1L);
CreateFileOptions options = CreateFileOptions.defaults().setBlockSizeBytes(TEST_BLOCK_SIZE).setTtl(0).setTtlAction(alluxio.wire.TtlAction.FREE);
FileOutStream outStream = mAlluxioLineageFileSystem.createFile(path, options);
Assert.assertTrue(outStream instanceof LineageFileOutStream);
// verify client is released
Mockito.verify(mLineageContext).releaseMasterClient(mLineageMasterClient);
}
use of alluxio.client.file.options.CreateFileOptions in project alluxio by Alluxio.
the class PinIntegrationTest method createEmptyFile.
private void createEmptyFile(AlluxioURI fileURI) throws IOException, AlluxioException {
CreateFileOptions options = CreateFileOptions.defaults().setWriteType(WriteType.MUST_CACHE);
FileOutStream os = mFileSystem.createFile(fileURI, options);
os.close();
}
use of alluxio.client.file.options.CreateFileOptions in project alluxio by Alluxio.
the class StartupConsistencyCheckTest method before.
@Before
public void before() throws Exception {
CreateFileOptions fileOptions = CreateFileOptions.defaults().setWriteType(WriteType.THROUGH);
CreateDirectoryOptions dirOptions = CreateDirectoryOptions.defaults().setWriteType(WriteType.THROUGH);
mCluster = mLocalAlluxioClusterResource.get();
mFileSystem = mCluster.getClient();
mFileSystem.createFile(TOP_LEVEL_FILE, fileOptions).close();
mFileSystem.createDirectory(TOP_LEVEL_DIR, dirOptions);
mFileSystem.createDirectory(SECOND_LEVEL_DIR, dirOptions);
mFileSystem.createFile(SECOND_LEVEL_FILE, fileOptions).close();
mFileSystem.createFile(THIRD_LEVEL_FILE, fileOptions).close();
}
use of alluxio.client.file.options.CreateFileOptions in project alluxio by Alluxio.
the class JournalIntegrationTest method rename.
/**
* Tests file and directory creation, and rename.
*/
@Test
public void rename() throws Exception {
for (int i = 0; i < 10; i++) {
mFileSystem.createDirectory(new AlluxioURI("/i" + i));
for (int j = 0; j < 10; j++) {
CreateFileOptions option = CreateFileOptions.defaults().setBlockSizeBytes((i + j + 1) * 64);
AlluxioURI path = new AlluxioURI("/i" + i + "/j" + j);
mFileSystem.createFile(path, option).close();
mFileSystem.rename(path, new AlluxioURI("/i" + i + "/jj" + j));
}
mFileSystem.rename(new AlluxioURI("/i" + i), new AlluxioURI("/ii" + i));
}
mLocalAlluxioCluster.stopFS();
renameTestUtil();
deleteFsMasterJournalLogs();
renameTestUtil();
}
Aggregations