/** * @return a list of block ids belonging to the file, empty for directories, immutable */ public List<Long> getBlockIds() { return mInfo.getBlockIds(); }
/** * Tests the {@link FileSystemMaster#getNewBlockIdForFile(AlluxioURI)} method. */ @Test public void getNewBlockIdForFile() throws Exception { mFileSystemMaster.createFile(NESTED_FILE_URI, mNestedFileContext); long blockId = mFileSystemMaster.getNewBlockIdForFile(NESTED_FILE_URI); FileInfo fileInfo = mFileSystemMaster.getFileInfo(NESTED_FILE_URI, GET_STATUS_CONTEXT); assertEquals(Lists.newArrayList(blockId), fileInfo.getBlockIds()); }
/** * Tests that lost files can successfully be detected. */ @Test public void lostFilesDetection() throws Exception { createFileWithSingleBlock(NESTED_FILE_URI); long fileId = mFileSystemMaster.getFileId(NESTED_FILE_URI); FileInfo fileInfo = mFileSystemMaster.getFileInfo(fileId); mBlockMaster.reportLostBlocks(fileInfo.getBlockIds()); assertEquals(PersistenceState.NOT_PERSISTED.name(), fileInfo.getPersistenceState()); // Check with getPersistenceState. assertEquals(PersistenceState.NOT_PERSISTED, mFileSystemMaster.getPersistenceState(fileId)); // run the detector HeartbeatScheduler.execute(HeartbeatContext.MASTER_LOST_FILES_DETECTION); fileInfo = mFileSystemMaster.getFileInfo(fileId); assertEquals(PersistenceState.LOST.name(), fileInfo.getPersistenceState()); // Check with getPersistenceState. assertEquals(PersistenceState.LOST, mFileSystemMaster.getPersistenceState(fileId)); }
.setFolder(fileInfo.isFolder()).setPinned(fileInfo.isPinned()) .setCacheable(fileInfo.isCacheable()).setPersisted(fileInfo.isPersisted()) .addAllBlockIds(fileInfo.getBlockIds()) .setLastModificationTimeMs(fileInfo.getLastModificationTimeMs()).setTtl(fileInfo.getTtl()) .setOwner(fileInfo.getOwner()).setGroup(fileInfo.getGroup()).setMode(fileInfo.getMode())
/** * Tests the {@link MutableInodeDirectory#generateClientFileInfo(String)} method. */ @Test public void generateClientFileInfo() { MutableInodeDirectory inodeDirectory = createInodeDirectory(); String path = "/test/path"; FileInfo info = inodeDirectory.generateClientFileInfo(path); Assert.assertEquals(inodeDirectory.getId(), info.getFileId()); Assert.assertEquals(inodeDirectory.getName(), info.getName()); Assert.assertEquals(path, info.getPath()); Assert.assertEquals("", info.getUfsPath()); Assert.assertEquals(0, info.getLength()); Assert.assertEquals(0, info.getBlockSizeBytes()); Assert.assertEquals(inodeDirectory.getCreationTimeMs(), info.getCreationTimeMs()); Assert.assertTrue(info.isCompleted()); Assert.assertTrue(info.isFolder()); Assert.assertEquals(inodeDirectory.isPinned(), info.isPinned()); Assert.assertFalse(info.isCacheable()); Assert.assertNotNull(info.getBlockIds()); Assert.assertEquals(inodeDirectory.getLastModificationTimeMs(), info.getLastModificationTimeMs()); } }
/** * @return a list of block ids belonging to the file, empty for directories, immutable */ public List<Long> getBlockIds() { return mInfo.getBlockIds(); }
Assert.assertEquals(a.getBlockIds(), b.getBlockIds()); Assert.assertEquals(a.getBlockSizeBytes(), b.getBlockSizeBytes()); Assert.assertEquals(a.getCreationTimeMs(), b.getCreationTimeMs());
/** * @return a list of block ids belonging to the file, empty for directories, immutable */ public List<Long> getBlockIds() { return mInfo.getBlockIds(); }
FileInfo fileInfo = FileInfoTest.createRandom(); URIStatus uriStatus = new URIStatus(fileInfo); Assert.assertEquals(uriStatus.getBlockIds(), fileInfo.getBlockIds()); Assert.assertEquals(uriStatus.getBlockSizeBytes(), fileInfo.getBlockSizeBytes());