Search in sources :

Example 1 with JournalFactory

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);
}
Also used : JournalFactory(alluxio.master.journal.JournalFactory) BlockMaster(alluxio.master.block.BlockMaster) InodeDirectoryIdGenerator(alluxio.master.file.meta.InodeDirectoryIdGenerator) MountTable(alluxio.master.file.meta.MountTable) InodeTree(alluxio.master.file.meta.InodeTree) BeforeClass(org.junit.BeforeClass)

Example 2 with JournalFactory

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);
}
Also used : JournalFactory(alluxio.master.journal.JournalFactory) ManualClock(alluxio.clock.ManualClock) Before(org.junit.Before)

Example 3 with JournalFactory

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);
}
Also used : JournalFactory(alluxio.master.journal.JournalFactory) BlockMaster(alluxio.master.block.BlockMaster) ManualClock(alluxio.clock.ManualClock) ServletContext(javax.servlet.ServletContext) Matchers.anyString(org.mockito.Matchers.anyString) Before(org.junit.Before)

Example 4 with JournalFactory

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);
}
Also used : JournalFactory(alluxio.master.journal.JournalFactory) BlockMaster(alluxio.master.block.BlockMaster) Before(org.junit.Before)

Example 5 with JournalFactory

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());
}
Also used : JournalFactory(alluxio.master.journal.JournalFactory) BlockMaster(alluxio.master.block.BlockMaster) InodeTree(alluxio.master.file.meta.InodeTree) Before(org.junit.Before)

Aggregations

JournalFactory (alluxio.master.journal.JournalFactory)9 BlockMaster (alluxio.master.block.BlockMaster)7 Before (org.junit.Before)5 FileSystemMaster (alluxio.master.file.FileSystemMaster)3 ManualClock (alluxio.clock.ManualClock)2 InodeTree (alluxio.master.file.meta.InodeTree)2 CommandLineJob (alluxio.job.CommandLineJob)1 JobConf (alluxio.job.JobConf)1 InodeDirectoryIdGenerator (alluxio.master.file.meta.InodeDirectoryIdGenerator)1 MountTable (alluxio.master.file.meta.MountTable)1 WorkerNetAddress (alluxio.wire.WorkerNetAddress)1 ImmutableList (com.google.common.collect.ImmutableList)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 ThreadFactory (java.util.concurrent.ThreadFactory)1 ServletContext (javax.servlet.ServletContext)1 BeforeClass (org.junit.BeforeClass)1 Matchers.anyString (org.mockito.Matchers.anyString)1