コード例 #1
0
  @Before
  public final void before() throws Exception {
    mFsMaster =
        mLocalAlluxioClusterResource.get().getMaster().getInternalMaster().getFileSystemMaster();
    mInodeTree = (InodeTree) Whitebox.getInternalState(mFsMaster, "mInodeTree");
    mMasterConfiguration = mLocalAlluxioClusterResource.get().getMasterConf();

    TtlBucketPrivateAccess.setTtlIntervalMs(
        mMasterConfiguration.getLong(Constants.MASTER_TTL_CHECKER_INTERVAL_MS));
  }
コード例 #2
0
  @BeforeClass
  public static void beforeClass() throws Exception {
    Configuration conf = new Configuration();
    conf.set("fs.alluxio.impl", FileSystem.class.getName());

    alluxio.client.file.FileSystem alluxioFS = sLocalAlluxioClusterResource.get().getClient();
    FileSystemTestUtils.createByteFile(alluxioFS, "/testFile1", WriteType.CACHE_THROUGH, FILE_LEN);

    URI uri = URI.create(sLocalAlluxioClusterResource.get().getMasterURI());
    sTFS = org.apache.hadoop.fs.FileSystem.get(uri, conf);
  }
コード例 #3
0
  @Before
  public final void before() throws Exception {
    mFileSystem = mLocalAlluxioClusterResource.get().getClient();
    mMasterConfiguration = mLocalAlluxioClusterResource.get().getMasterConf();
    mWorkerConfiguration = mLocalAlluxioClusterResource.get().getWorkerConf();
    mBlockWorkerServiceHandler =
        mLocalAlluxioClusterResource.get().getWorker().getBlockWorker().getWorkerServiceHandler();

    mBlockMasterClient =
        new BlockMasterClient(
            new InetSocketAddress(
                mLocalAlluxioClusterResource.get().getMasterHostname(),
                mLocalAlluxioClusterResource.get().getMasterPort()),
            mWorkerConfiguration);
  }
コード例 #4
0
 @Before
 public void before() throws Exception {
   AlluxioWorker alluxioWorker = mResource.get().getWorker();
   mBlockWorker = PowerMockito.mock(BlockWorker.class);
   // Replace the block worker created by LocalAlluxioClusterResource with a mock.
   BlockWorker blockWorker = Whitebox.getInternalState(alluxioWorker, "mBlockWorker");
   blockWorker.stop();
   Whitebox.setInternalState(alluxioWorker, "mBlockWorker", mBlockWorker);
 }
コード例 #5
0
  /** Tests load metadata on list. */
  @Test
  public void loadMetadata() throws Exception {
    String dirName = "loadMetaDataRoot";

    String rootDir = PathUtils.concatPath(mUnderfsAddress, dirName);
    mUfs.mkdirs(rootDir, true);

    String rootFile1 = PathUtils.concatPath(rootDir, "file1");
    createEmptyFile(rootFile1);

    String rootFile2 = PathUtils.concatPath(rootDir, "file2");
    createEmptyFile(rootFile2);

    AlluxioURI rootAlluxioURI = new AlluxioURI("/" + dirName);
    FileSystem client = mLocalAlluxioClusterResource.get().getClient();
    client.listStatus(
        rootAlluxioURI, ListStatusOptions.defaults().setLoadMetadataType(LoadMetadataType.Always));

    try {
      client.createDirectory(rootAlluxioURI, CreateDirectoryOptions.defaults());
      Assert.fail("create is expected to fail with FileAlreadyExistsException");
    } catch (FileAlreadyExistsException e) {
      Assert.assertEquals(
          ExceptionMessage.FILE_ALREADY_EXISTS.getMessage(rootAlluxioURI), e.getMessage());
    }

    AlluxioURI file1URI = rootAlluxioURI.join("file1");
    try {
      client.createFile(file1URI, CreateFileOptions.defaults()).close();
      Assert.fail("create is expected to fail with FileAlreadyExistsException");
    } catch (FileAlreadyExistsException e) {
      Assert.assertEquals(
          ExceptionMessage.FILE_ALREADY_EXISTS.getMessage(file1URI), e.getMessage());
    }

    AlluxioURI file2URI = rootAlluxioURI.join("file2");
    try {
      client.createFile(file2URI, CreateFileOptions.defaults()).close();
      Assert.fail("create is expected to fail with FileAlreadyExistsException");
    } catch (FileAlreadyExistsException e) {
      Assert.assertEquals(
          ExceptionMessage.FILE_ALREADY_EXISTS.getMessage(file2URI), e.getMessage());
    }
  }
コード例 #6
0
 @Test
 public void getCapacityBytesTest() {
   BlockMaster blockMaster =
       mLocalAlluxioClusterResource.get().getMaster().getInternalMaster().getBlockMaster();
   Assert.assertEquals(1000, blockMaster.getCapacityBytes());
 }