use of alluxio.client.file.FileSystemContext in project alluxio by Alluxio.
the class FileSystemReadonlyIntegrationTest method before.
@Before
public void before() throws Exception {
FileSystemContext fsCtx = FileSystemContext.create(ServerConfiguration.global());
fsCtx.getClientContext().loadConf(fsCtx.getMasterAddress(), true, true);
mFileSystem = sLocalAlluxioClusterResource.get().getClient(fsCtx);
}
use of alluxio.client.file.FileSystemContext in project alluxio by Alluxio.
the class FileSystemContextReinitIntegrationTest method blockWorkerClientReinit.
@Test
public void blockWorkerClientReinit() throws Exception {
FileSystemContext fsContext = FileSystemContext.create(ServerConfiguration.global());
try (CloseableResource<BlockWorkerClient> client = fsContext.acquireBlockWorkerClient(mLocalAlluxioClusterResource.get().getWorkerAddress())) {
fsContext.reinit(true, true);
fsContext.acquireBlockWorkerClient(mLocalAlluxioClusterResource.get().getWorkerAddress()).close();
}
}
use of alluxio.client.file.FileSystemContext in project alluxio by Alluxio.
the class ImpersonationIntegrationTest method impersonationArbitraryUserDisallowed.
@Test
@LocalAlluxioClusterResource.Config(confParams = { IMPERSONATION_GROUPS_CONFIG, "*" })
public void impersonationArbitraryUserDisallowed() throws Exception {
String arbitraryUser = "arbitrary_user";
ServerConfiguration.set(PropertyKey.SECURITY_LOGIN_IMPERSONATION_USERNAME, arbitraryUser);
FileSystemContext context = FileSystemContext.create(createHdfsSubject(), ServerConfiguration.global());
FileSystem fs = mLocalAlluxioClusterResource.get().getClient(context);
fs.createFile(new AlluxioURI("/impersonation-test")).close();
List<URIStatus> listing = fs.listStatus(new AlluxioURI("/"));
Assert.assertEquals(1, listing.size());
URIStatus status = listing.get(0);
Assert.assertNotEquals(arbitraryUser, status.getOwner());
}
use of alluxio.client.file.FileSystemContext in project alluxio by Alluxio.
the class LineageFileOutStreamTest method persistHandledByMaster.
@Test
public void persistHandledByMaster() throws Exception {
FileSystemContext context = PowerMockito.mock(FileSystemContext.class);
FileSystemMasterClient client = PowerMockito.mock(FileSystemMasterClient.class);
Mockito.when(context.acquireMasterClientResource()).thenReturn(new DummyCloseableResource<>(client));
LineageFileOutStream stream = new LineageFileOutStream(context, new AlluxioURI("/path"), OutStreamOptions.defaults().setWriteType(WriteType.ASYNC_THROUGH));
stream.close();
// The lineage file out stream doesn't manage asynchronous persistence.
Mockito.verify(client, Mockito.times(0)).scheduleAsyncPersist(new AlluxioURI("/path"));
}
use of alluxio.client.file.FileSystemContext in project alluxio by Alluxio.
the class LineageFileSystemTest method before.
/**
* Sets up all dependencies before running a test.
*/
@Before
public void before() throws Exception {
mLineageMasterClient = PowerMockito.mock(LineageMasterClient.class);
mLineageContext = PowerMockito.mock(LineageContext.class);
FileSystemContext fileSystemContext = PowerMockito.mock(FileSystemContext.class);
Mockito.when(mLineageContext.acquireMasterClient()).thenReturn(mLineageMasterClient);
FileSystemMasterClient fileSystemMasterClient = PowerMockito.mock(FileSystemMasterClient.class);
Mockito.when(fileSystemContext.acquireMasterClient()).thenReturn(fileSystemMasterClient);
Mockito.when(fileSystemMasterClient.getStatus(Mockito.any(AlluxioURI.class))).thenReturn(new URIStatus(new FileInfo()));
mAlluxioLineageFileSystem = LineageFileSystem.get(fileSystemContext, mLineageContext);
}
Aggregations