use of alluxio.master.journal.JournalFactory in project alluxio by Alluxio.
the class PermissionCheckerTest method beforeClass.
@BeforeClass
public static void beforeClass() throws Exception {
sFileOptions = CreateFileOptions.defaults().setBlockSizeBytes(Constants.KB).setOwner(TEST_USER_2.getUser()).setGroup(TEST_USER_2.getGroup()).setMode(TEST_NORMAL_MODE);
sWeirdFileOptions = CreateFileOptions.defaults().setBlockSizeBytes(Constants.KB).setOwner(TEST_USER_1.getUser()).setGroup(TEST_USER_1.getGroup()).setMode(TEST_WEIRD_MODE);
sNestedFileOptions = CreateFileOptions.defaults().setBlockSizeBytes(Constants.KB).setOwner(TEST_USER_1.getUser()).setGroup(TEST_USER_1.getGroup()).setMode(TEST_NORMAL_MODE).setRecursive(true);
// setup an InodeTree
JournalFactory journalFactory = new JournalFactory.ReadWrite(sTestFolder.newFolder().getAbsolutePath());
BlockMaster blockMaster = new BlockMaster(journalFactory);
InodeDirectoryIdGenerator directoryIdGenerator = new InodeDirectoryIdGenerator(blockMaster);
MountTable mountTable = new MountTable();
sTree = new InodeTree(blockMaster, directoryIdGenerator, mountTable);
blockMaster.start(true);
GroupMappingServiceTestUtils.resetCache();
Configuration.set(PropertyKey.SECURITY_GROUP_MAPPING_CLASS, FakeUserGroupsMapping.class.getName());
Configuration.set(PropertyKey.SECURITY_AUTHENTICATION_TYPE, AuthType.SIMPLE.getAuthName());
Configuration.set(PropertyKey.SECURITY_AUTHORIZATION_PERMISSION_ENABLED, "true");
Configuration.set(PropertyKey.SECURITY_AUTHORIZATION_PERMISSION_SUPERGROUP, TEST_SUPER_GROUP);
sTree.initializeRoot(TEST_USER_ADMIN.getUser(), TEST_USER_ADMIN.getGroup(), TEST_NORMAL_MODE);
// build file structure
createAndSetPermission(TEST_DIR_FILE_URI, sNestedFileOptions);
createAndSetPermission(TEST_FILE_URI, sFileOptions);
createAndSetPermission(TEST_WEIRD_FILE_URI, sWeirdFileOptions);
}
use of alluxio.master.journal.JournalFactory in project alluxio by Alluxio.
the class BlockMasterTest method before.
/**
* Sets up the dependencies before a test runs.
*/
@Before
public void before() throws Exception {
JournalFactory journalFactory = new JournalFactory.ReadWrite(mTestFolder.newFolder().getAbsolutePath());
mClock = new ManualClock();
mExecutorService = Executors.newFixedThreadPool(2, ThreadFactoryUtils.build("TestBlockMaster-%d", true));
mMaster = new BlockMaster(journalFactory, mClock, ExecutorServiceFactories.constantExecutorServiceFactory(mExecutorService));
mMaster.start(true);
}
use of alluxio.master.journal.JournalFactory in project alluxio by Alluxio.
the class AlluxioMasterRestServiceHandlerTest method before.
@Before
public void before() throws Exception {
mMaster = mock(AlluxioMasterService.class);
mContext = mock(ServletContext.class);
JournalFactory journalFactory = new JournalFactory.ReadWrite(mTestFolder.newFolder().getAbsolutePath());
mClock = new ManualClock();
mExecutorService = Executors.newFixedThreadPool(2, ThreadFactoryUtils.build("TestBlockMaster-%d", true));
mBlockMaster = new BlockMaster(journalFactory, mClock, ExecutorServiceFactories.constantExecutorServiceFactory(mExecutorService));
mBlockMaster.start(true);
when(mMaster.getBlockMaster()).thenReturn(mBlockMaster);
when(mContext.getAttribute(MasterWebServer.ALLUXIO_MASTER_SERVLET_RESOURCE_KEY)).thenReturn(mMaster);
registerFileSystemMock();
mHandler = new AlluxioMasterRestServiceHandler(mContext);
// Register two workers
long worker1 = mBlockMaster.getWorkerId(NET_ADDRESS_1);
long worker2 = mBlockMaster.getWorkerId(NET_ADDRESS_2);
List<String> tiers = Arrays.asList("MEM", "SSD");
mBlockMaster.workerRegister(worker1, tiers, WORKER1_TOTAL_BYTES_ON_TIERS, WORKER1_USED_BYTES_ON_TIERS, NO_BLOCKS_ON_TIERS);
mBlockMaster.workerRegister(worker2, tiers, WORKER2_TOTAL_BYTES_ON_TIERS, WORKER2_USED_BYTES_ON_TIERS, NO_BLOCKS_ON_TIERS);
}
use of alluxio.master.journal.JournalFactory in project alluxio by Alluxio.
the class InodeTreeTest method before.
/**
* Sets up all dependencies before a test runs.
*/
@Before
public void before() throws Exception {
JournalFactory journalFactory = new JournalFactory.ReadWrite(mTestFolder.newFolder().getAbsolutePath());
BlockMaster blockMaster = new BlockMaster(journalFactory);
InodeDirectoryIdGenerator directoryIdGenerator = new InodeDirectoryIdGenerator(blockMaster);
MountTable mountTable = new MountTable();
mTree = new InodeTree(blockMaster, directoryIdGenerator, mountTable);
blockMaster.start(true);
Configuration.set(PropertyKey.SECURITY_AUTHORIZATION_PERMISSION_ENABLED, "true");
Configuration.set(PropertyKey.SECURITY_AUTHORIZATION_PERMISSION_SUPERGROUP, "test-supergroup");
mTree.initializeRoot(TEST_OWNER, TEST_GROUP, TEST_DIR_MODE);
}
use of alluxio.master.journal.JournalFactory in project alluxio by Alluxio.
the class PermissionCheckTest method before.
@Before
public void before() throws Exception {
GroupMappingServiceTestUtils.resetCache();
JournalFactory journalFactory = new JournalFactory.ReadWrite(mTestFolder.newFolder().getAbsolutePath());
mBlockMaster = new BlockMaster(journalFactory);
mFileSystemMaster = new FileSystemMaster(mBlockMaster, journalFactory);
mBlockMaster.start(true);
mFileSystemMaster.start(true);
createDirAndFileForTest();
mInodeTree = Mockito.mock(InodeTree.class);
Mockito.when(mInodeTree.getRootUserName()).thenReturn(TEST_USER_ADMIN.getUser());
}
Aggregations