.setOwner("user1") .setGroup("group1") .setMode(00755) .setFileBlockInfos(Arrays.asList(blockInfo)); Path path = new Path("/dir/file");
@Test public void getStatus() throws Exception { FileInfo fileInfo = new FileInfo() .setLastModificationTimeMs(111L) .setFolder(false) .setOwner("user1") .setGroup("group1") .setMode(00755); Path path = new Path("/dir"); alluxio.client.file.FileSystem alluxioFs = mock(alluxio.client.file.FileSystem.class); when(alluxioFs.getStatus(new AlluxioURI(HadoopUtils.getPathWithoutScheme(path)))) .thenReturn(new URIStatus(fileInfo)); FileSystem alluxioHadoopFs = new FileSystem(alluxioFs); FileStatus fileStatus = alluxioHadoopFs.getFileStatus(path); assertFileInfoEqualsFileStatus(fileInfo, fileStatus); }
result.setLastModificationTimeMs(lastModificationTimeMs); result.setLength(length); result.setMode(permission); result.setMountPoint(mountPoint); result.setName(name);
/** * Tests that the {@link AbstractFileSystem#listStatus(Path)} method uses * {@link URIStatus#getLastModificationTimeMs()} correctly. */ @Test public void listStatus() throws Exception { FileInfo fileInfo1 = new FileInfo() .setLastModificationTimeMs(111L) .setFolder(false) .setOwner("user1") .setGroup("group1") .setMode(00755); FileInfo fileInfo2 = new FileInfo() .setLastModificationTimeMs(222L) .setFolder(true) .setOwner("user2") .setGroup("group2") .setMode(00644); Path path = new Path("/dir"); alluxio.client.file.FileSystem alluxioFs = mock(alluxio.client.file.FileSystem.class); when(alluxioFs.listStatus(new AlluxioURI(HadoopUtils.getPathWithoutScheme(path)))) .thenReturn(Lists.newArrayList(new URIStatus(fileInfo1), new URIStatus(fileInfo2))); FileSystem alluxioHadoopFs = new FileSystem(alluxioFs); FileStatus[] fileStatuses = alluxioHadoopFs.listStatus(path); assertFileInfoEqualsFileStatus(fileInfo1, fileStatuses[0]); assertFileInfoEqualsFileStatus(fileInfo2, fileStatuses[1]); alluxioHadoopFs.close(); }
ret.setOwner(getOwner()); ret.setGroup(getGroup()); ret.setMode(getMode()); ret.setPersistenceState(getPersistenceState().toString()); ret.setMountPoint(isMountPoint());
ret.setOwner(getOwner()); ret.setGroup(getGroup()); ret.setMode(getMode()); ret.setPersistenceState(getPersistenceState().toString()); ret.setMountPoint(false);
/** * Converts a proto type to a wire type. * * @param pInfo the proto representation of a file information * @return wire representation of the file information */ public static FileInfo fromProto(alluxio.grpc.FileInfo pInfo) { return new FileInfo().setFileId(pInfo.getFileId()).setName(pInfo.getName()) .setPath(pInfo.getPath()).setUfsPath(pInfo.getUfsPath()).setLength(pInfo.getLength()) .setBlockSizeBytes(pInfo.getBlockSizeBytes()).setCreationTimeMs(pInfo.getCreationTimeMs()) .setCompleted(pInfo.getCompleted()).setFolder(pInfo.getFolder()) .setPinned(pInfo.getPinned()).setCacheable(pInfo.getCacheable()) .setPersisted(pInfo.getPersisted()).setBlockIds(pInfo.getBlockIdsList()) .setLastModificationTimeMs(pInfo.getLastModificationTimeMs()).setTtl(pInfo.getTtl()) .setTtlAction(pInfo.getTtlAction()).setOwner(pInfo.getOwner()) .setGroup(pInfo.getGroup()).setMode(pInfo.getMode()) .setPersistenceState(pInfo.getPersistenceState()).setMountPoint(pInfo.getMountPoint()) .setFileBlockInfos(map(GrpcUtils::fromProto, pInfo.getFileBlockInfosList())) .setMountId(pInfo.getMountId()).setInAlluxioPercentage(pInfo.getInAlluxioPercentage()) .setInMemoryPercentage(pInfo.getInMemoryPercentage()) .setUfsFingerprint(pInfo.hasUfsFingerprint() ? pInfo.getUfsFingerprint() : Constants.INVALID_UFS_FINGERPRINT) .setAcl(pInfo.hasAcl() ? (fromProto(pInfo.getAcl())) : AccessControlList.EMPTY_ACL) .setDefaultAcl( pInfo.hasDefaultAcl() ? ((DefaultAccessControlList) fromProto(pInfo.getDefaultAcl())) : DefaultAccessControlList.EMPTY_DEFAULT_ACL) .setReplicationMax(pInfo.getReplicationMax()).setReplicationMin(pInfo.getReplicationMin()); }
ret.setOwner(getOwner()); ret.setGroup(getGroup()); ret.setMode(getMode()); ret.setPersistenceState(getPersistenceState().toString()); ret.setMountPoint(isMountPoint());
@Override public FileInfo generateClientFileInfo(String path) { FileInfo ret = new FileInfo(); // note: in-Alluxio percentage is NOT calculated here, because it needs blocks info stored in // block master ret.setFileId(getId()); ret.setName(getName()); ret.setPath(path); ret.setLength(getLength()); ret.setBlockSizeBytes(getBlockSizeBytes()); ret.setCreationTimeMs(getCreationTimeMs()); ret.setCacheable(isCacheable()); ret.setFolder(isDirectory()); ret.setPinned(isPinned()); ret.setCompleted(isCompleted()); ret.setPersisted(isPersisted()); ret.setBlockIds(getBlockIds()); ret.setLastModificationTimeMs(getLastModificationTimeMs()); ret.setTtl(mTtl); ret.setTtlAction(mTtlAction); ret.setOwner(getOwner()); ret.setGroup(getGroup()); ret.setMode(getMode()); ret.setPersistenceState(getPersistenceState().toString()); ret.setMountPoint(false); ret.setUfsFingerprint(getUfsFingerprint()); return ret; }
.setOwner(info.getOwner()) .setGroup(info.getGroup()) .setMode(info.getMode()) .setPersistenceState(info.getPersistenceState()) .setMountPoint(info.isMountPoint())