use of alluxio.client.file.options.CreateDirectoryOptions in project alluxio by Alluxio.
the class BaseFileSystemTest method createDirectory.
/**
* Tests for the {@link BaseFileSystem#createDirectory(AlluxioURI, CreateDirectoryOptions)}
* method.
*/
@Test
public void createDirectory() throws Exception {
AlluxioURI dir = new AlluxioURI("/dir");
CreateDirectoryOptions createDirectoryOptions = CreateDirectoryOptions.defaults();
Mockito.doNothing().when(mFileSystemMasterClient).createDirectory(dir, createDirectoryOptions);
mFileSystem.createDirectory(dir, createDirectoryOptions);
Mockito.verify(mFileSystemMasterClient).createDirectory(dir, createDirectoryOptions);
}
use of alluxio.client.file.options.CreateDirectoryOptions in project alluxio by Alluxio.
the class BaseFileSystemTest method createDirectoryException.
/**
* Ensures that an exception is propagated correctly when creating a directory.
*/
@Test
public void createDirectoryException() throws Exception {
AlluxioURI dir = new AlluxioURI("/dir");
CreateDirectoryOptions createDirectoryOptions = CreateDirectoryOptions.defaults();
Mockito.doThrow(EXCEPTION).when(mFileSystemMasterClient).createDirectory(dir, createDirectoryOptions);
try {
mFileSystem.createDirectory(dir, createDirectoryOptions);
Assert.fail(SHOULD_HAVE_PROPAGATED_MESSAGE);
} catch (Exception e) {
Assert.assertSame(EXCEPTION, e);
}
}
use of alluxio.client.file.options.CreateDirectoryOptions in project alluxio by Alluxio.
the class CheckConsistencyIntegrationTest method before.
@Before
public final void before() throws Exception {
mFileSystemMaster = mLocalAlluxioClusterResource.get().getMaster().getInternalMaster().getFileSystemMaster();
AuthenticatedClientUser.set(TEST_USER);
mFileSystem = FileSystem.Factory.get();
CreateDirectoryOptions dirOptions = CreateDirectoryOptions.defaults().setWriteType(WriteType.CACHE_THROUGH);
CreateFileOptions fileOptions = CreateFileOptions.defaults().setWriteType(WriteType.CACHE_THROUGH);
mFileSystem.createDirectory(DIRECTORY, dirOptions);
mFileSystem.createFile(FILE, fileOptions).close();
}
use of alluxio.client.file.options.CreateDirectoryOptions 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.CreateDirectoryOptions in project alluxio by Alluxio.
the class JournalIntegrationTest method persistDirectoryLater.
@Test
public void persistDirectoryLater() throws Exception {
String[] directories = new String[] { "/d11", "/d11/d21", "/d11/d22", "/d12", "/d12/d21", "/d12/d22" };
CreateDirectoryOptions options = CreateDirectoryOptions.defaults().setRecursive(true).setWriteType(WriteType.MUST_CACHE);
for (String directory : directories) {
mFileSystem.createDirectory(new AlluxioURI(directory), options);
}
options.setWriteType(WriteType.CACHE_THROUGH);
for (String directory : directories) {
mFileSystem.createDirectory(new AlluxioURI(directory), options);
}
Map<String, URIStatus> directoryStatuses = new HashMap<>();
for (String directory : directories) {
directoryStatuses.put(directory, mFileSystem.getStatus(new AlluxioURI(directory)));
}
mLocalAlluxioCluster.stopFS();
persistDirectoryLaterTestUtil(directoryStatuses);
deleteFsMasterJournalLogs();
persistDirectoryLaterTestUtil(directoryStatuses);
}
Aggregations