use of alluxio.underfs.UfsManager.UfsClient in project alluxio by Alluxio.
the class UfsFileWriteHandlerTest method before.
@Before
public void before() throws Exception {
mFile = mTestFolder.newFile();
mOutputStream = new FileOutputStream(mFile);
UnderFileSystem mockUfs = Mockito.mock(UnderFileSystem.class);
UfsManager ufsManager = Mockito.mock(UfsManager.class);
UfsClient ufsClient = new UfsClient(() -> mockUfs, AlluxioURI.EMPTY_URI);
Mockito.when(ufsManager.get(TEST_MOUNT_ID)).thenReturn(ufsClient);
Mockito.when(mockUfs.createNonexistingFile(Mockito.anyString(), Mockito.any(CreateOptions.class))).thenReturn(mOutputStream).thenReturn(new FileOutputStream(mFile, true));
mResponseObserver = Mockito.mock(StreamObserver.class);
mWriteHandler = new UfsFileWriteHandler(ufsManager, mResponseObserver, mUserInfo);
setupResponseTrigger();
}
use of alluxio.underfs.UfsManager.UfsClient in project alluxio by Alluxio.
the class MountTableTest method before.
@Before
public void before() throws Exception {
UfsManager ufsManager = mock(UfsManager.class);
UfsClient ufsClient = new UfsManager.UfsClient(() -> mTestUfs, AlluxioURI.EMPTY_URI);
when(ufsManager.get(anyLong())).thenReturn(ufsClient);
mMountTable = new MountTable(ufsManager, new MountInfo(new AlluxioURI(MountTable.ROOT), new AlluxioURI(ROOT_UFS), IdUtils.ROOT_MOUNT_ID, MountContext.defaults().getOptions().build()));
}
use of alluxio.underfs.UfsManager.UfsClient in project alluxio by Alluxio.
the class UnderFileSystemBlockReaderTest method before.
@Before
public void before() throws Exception {
String ufsFolder = ServerConfiguration.getString(PropertyKey.MASTER_MOUNT_TABLE_ROOT_UFS);
String testFilePath = File.createTempFile("temp", null, new File(ufsFolder)).getAbsolutePath();
byte[] buffer = BufferUtils.getIncreasingByteArray((int) TEST_BLOCK_SIZE * 2);
BufferUtils.writeBufferToFile(testFilePath, buffer);
mAlluxioBlockStore = new TieredBlockStore();
mUfsManager = mock(UfsManager.class);
mUfsInstreamCache = new UfsInputStreamCache();
UfsClient ufsClient = new UfsClient(() -> UnderFileSystem.Factory.create(testFilePath, UnderFileSystemConfiguration.defaults(ServerConfiguration.global())), new AlluxioURI(testFilePath));
when(mUfsManager.get(anyLong())).thenReturn(ufsClient);
mOpenUfsBlockOptions = Protocol.OpenUfsBlockOptions.newBuilder().setMaxUfsReadConcurrency(10).setBlockSize(TEST_BLOCK_SIZE).setOffsetInFile(TEST_BLOCK_SIZE).setUfsPath(testFilePath).build();
mUnderFileSystemBlockMeta = new UnderFileSystemBlockMeta(SESSION_ID, BLOCK_ID, mOpenUfsBlockOptions);
}
Aggregations