use of alluxio.AlluxioURI 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.AlluxioURI 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.AlluxioURI in project alluxio by Alluxio.
the class MasterFaultToleranceIntegrationTest method faultTestDataCreation.
/**
* Creates 10 files in the folder.
*
* @param folderName the folder name to create
* @param answer the results, the mapping from file id to file path
*/
private void faultTestDataCreation(AlluxioURI folderName, List<Pair<Long, AlluxioURI>> answer) throws IOException, AlluxioException {
mFileSystem.createDirectory(folderName);
answer.add(new Pair<>(mFileSystem.getStatus(folderName).getFileId(), folderName));
for (int k = 0; k < 10; k++) {
AlluxioURI path = new AlluxioURI(PathUtils.concatPath(folderName, folderName.toString().substring(1) + k));
mFileSystem.createFile(path).close();
answer.add(new Pair<>(mFileSystem.getStatus(path).getFileId(), path));
}
}
use of alluxio.AlluxioURI in project alluxio by Alluxio.
the class FileInStreamConcurrencyIntegrationTest method FileInStreamConcurrency.
/**
* Tests the concurrent read of {@link FileInStream}.
*/
@Test
public void FileInStreamConcurrency() throws Exception {
String uniqPath = PathUtils.uniqPath();
FileSystemTestUtils.createByteFile(sFileSystem, uniqPath, BLOCK_SIZE * 2, sWriteAlluxio);
List<Thread> threads = new ArrayList<>();
for (int i = 0; i < sNumReadThreads; i++) {
threads.add(new Thread(new FileRead(new AlluxioURI(uniqPath))));
}
ConcurrencyTestUtils.assertConcurrent(threads, 100);
}
use of alluxio.AlluxioURI in project alluxio by Alluxio.
the class KeyValueSystemIntegrationTest method deleteStore.
/**
* Tests that a store of various sizes (including empty store) can be correctly deleted.
*/
@Test
public void deleteStore() throws Exception {
List<AlluxioURI> storeUris = new ArrayList<>();
storeUris.add(createStoreOfSize(0, null));
storeUris.add(createStoreOfSize(2, null));
storeUris.add(createStoreOfMultiplePartitions(3, null));
for (AlluxioURI storeUri : storeUris) {
testDeleteStore(storeUri);
}
}
Aggregations